8#ifndef ROBOTSIO_ICUBCAMERA_H
9#define ROBOTSIO_ICUBCAMERA_H
11#include <RobotsIO/Camera/Camera.h>
15#include <iCub/iKin/iKinFwd.h>
16#include <iCub/learningMachine/LSSVMLearner.h>
18#include <opencv2/opencv.hpp>
22#include <yarp/dev/GazeControl.h>
23#include <yarp/dev/IEncoders.h>
24#include <yarp/dev/PolyDriver.h>
25#include <yarp/os/Bottle.h>
26#include <yarp/os/BufferedPort.h>
27#include <yarp/os/Network.h>
28#include <yarp/sig/Image.h>
41 iCubCamera(
const std::string& robot_name,
const std::string& laterality,
const std::string& port_prefix,
const bool& use_calibration =
false,
const std::string& calibration_path =
"");
43 iCubCamera(
const std::string& data_path,
const std::string& laterality,
const std::size_t& width,
const std::size_t& height,
const double& fx,
const double& cx,
const double& fy,
const double& cy,
const bool& load_encoders_data,
const bool& use_calibration =
false,
const std::string& calibration_path =
"");
53 yarp::dev::IGazeControl& controller();
59 std::pair<bool, Eigen::MatrixXf>
depth(
const bool& blocking)
override;
61 std::pair<bool, Eigen::Transform<double, 3, Eigen::Affine>> pose(
const bool& blocking)
override;
63 std::pair<bool, cv::Mat> rgb(
const bool& blocking)
override;
65 std::pair<bool, double> time_stamp_rgb()
const override;
67 std::pair<bool, double> time_stamp_depth()
const override;
73 std::pair<bool, Eigen::VectorXd>
auxiliary_data(
const bool& blocking)
override;
75 std::size_t auxiliary_data_size()
const override;
78 std::string laterality();
80 std::pair<bool, Eigen::Transform<double, 3, Eigen::Affine>> laterality_pose(
const std::string& laterality,
const bool& blocking);
82 void set_laterality(
const std::string& laterality);
85 std::string laterality_;
87 yarp::os::Network yarp_;
93 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelFloat>> port_depth_;
95 yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb>> port_rgb_;
102 bool getLateralityEyePose(
const std::string& laterality, yarp::sig::Vector& position, yarp::sig::Vector& orientation);
104 yarp::dev::PolyDriver driver_gaze_;
106 yarp::dev::IGazeControl* gaze_control_;
108 bool use_driver_gaze_ =
true;
114 yarp::dev::PolyDriver drv_torso_;
116 yarp::dev::IEncoders *itorso_;
118 yarp::dev::PolyDriver drv_head_;
120 yarp::dev::IEncoders *ihead_;
122 iCub::iKin::iCubEye left_eye_kinematics_;
124 iCub::iKin::iCubEye right_eye_kinematics_;
130 Eigen::Transform<double, 3, Eigen::Affine> exp_map(
const Eigen::VectorXd& se3);
132 bool load_calibration_model(
const std::string& model_path);
134 bool use_calibration_ =
false;
136 iCub::learningmachine::LSSVMLearner calibration_;
142 bool load_encoders_data_ =
false;
148 double time_stamp_rgb_;
150 double time_stamp_depth_;
152 bool is_time_stamp_rgb_ =
false;
154 bool is_time_stamp_depth_ =
false;
160 const std::string log_name_ =
"iCubCamera";
std::pair< bool, Eigen::VectorXd > auxiliary_data(const bool &blocking) override
bool is_controller_available()
std::pair< bool, Eigen::MatrixXf > depth(const bool &blocking) override