8#include <RobotsIO/Camera/iCubCameraRelative.h>
10using namespace RobotsIO::Camera;
13iCubCameraRelative::iCubCameraRelative
15 const std::string& robot_name,
16 const std::string& port_prefix,
17 const bool& use_calibration,
18 const std::string& calibration_path
20 iCubCamera(robot_name,
"right", port_prefix +
"_relative_right", use_calibration, calibration_path)
23 left_camera_= std::unique_ptr<iCubCamera>
25 new iCubCamera(robot_name,
"left", port_prefix +
"_relative_left")
30iCubCameraRelative::iCubCameraRelative
32 const std::string& data_path_left,
33 const std::string& data_path_right,
34 const std::size_t& width,
35 const std::size_t& height,
44 const bool& load_encoders_data,
45 const bool& use_calibration,
46 const std::string& calibration_path
48 iCubCamera(data_path_right,
"right", width, height, fx_r, cx_r, fy_r, cy_r, load_encoders_data, use_calibration, calibration_path)
51 left_camera_= std::unique_ptr<iCubCamera>
53 new iCubCamera(data_path_left,
"left", width, height, fx_l, cx_l, fy_l, cy_l, load_encoders_data)
58iCubCameraRelative::~iCubCameraRelative()
62bool iCubCameraRelative::status()
const
64 return iCubCamera::status() && get_relative_camera().status();
70 bool ok = iCubCamera::step_frame();
71 ok &= left_camera_->step_frame();
77bool iCubCameraRelative::set_frame_index(
const std::int32_t& index)
79 bool ok = iCubCamera::set_frame_index(index);
81 ok &= left_camera_->set_frame_index(index);
101 bool valid_left =
false;
102 Eigen::Transform<double, 3, Eigen::Affine> pose_left;
103 std::tie(valid_left, pose_left) = get_relative_camera().pose(
false);
105 return std::make_pair(
false, Eigen::Transform<double, 3, Eigen::Affine>());
107 bool valid_right =
false;
108 Eigen::Transform<double, 3, Eigen::Affine> pose_right;
109 std::tie(valid_right, pose_right) = iCubCamera::pose(
false);
111 return std::make_pair(
false, Eigen::Transform<double, 3, Eigen::Affine>());
114 Eigen::Transform<double, 3, Eigen::Affine> pose_relative;
115 pose_relative = pose_left.inverse() * pose_right;
117 return std::make_pair(
true, pose_relative);
bool step_frame() override
std::pair< bool, Eigen::Transform< double, 3, Eigen::Affine > > pose(const bool &blocking) override