3 #include <iCub/ctrl/math.h> 4 #include <yarp/eigen/Eigen.h> 5 #include <yarp/os/LogStream.h> 6 #include <yarp/os/Property.h> 10 using namespace Eigen;
20 const double gate_x,
const double gate_y,
const double gate_z,
21 const double gate_rotation,
22 const double gate_aperture,
23 const yarp::os::ConstString& robot,
const yarp::os::ConstString& laterality,
const yarp::os::ConstString& port_prefix) :
24 GatePose(std::move(visual_correction),
25 gate_x, gate_y, gate_z,
28 icub_kin_arm_(iCubArm(laterality +
"_v2")), robot_(robot), laterality_(laterality), port_prefix_(port_prefix)
37 opt_arm_enc.put(
"device",
"remote_controlboard");
38 opt_arm_enc.put(
"local",
"/hand-tracking/" +
ID_ +
"/" + port_prefix +
"/control_" +
laterality_ +
"_arm");
44 yInfo() <<
log_ID_ <<
"Succesfully opened " + laterality_ +
" arm remote_controlboard interface.";
46 yInfo() <<
log_ID_ <<
"Getting " + laterality_ +
" arm encoder interface...";
51 yError() <<
log_ID_ <<
"Cannot get " + laterality_ +
" arm encoder interface!";
54 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::INTERFACE\nERROR: cannot get " + laterality_ +
" arm encoder interface!");
57 yInfo() <<
log_ID_ <<
"Succesfully got " + laterality_ +
" arm encoder interface.";
61 yError() <<
log_ID_ <<
"Cannot open " + laterality_ +
" arm remote_controlboard!";
63 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::DRIVER\nERROR: cannot open " + laterality_ +
" arm remote_controlboard!");
67 Property opt_torso_enc;
68 opt_torso_enc.put(
"device",
"remote_controlboard");
69 opt_torso_enc.put(
"local",
"/hand-tracking/" +
ID_ +
"/" + port_prefix +
"/control_torso");
70 opt_torso_enc.put(
"remote",
"/" +
robot_ +
"/torso");
72 yInfo() <<
log_ID_ <<
"Opening torso remote_controlboard driver...";
76 yInfo() <<
log_ID_ <<
"Succesfully opened torso remote_controlboard driver.";
78 yInfo() <<
log_ID_ <<
"Getting torso encoder interface...";
83 yError() <<
log_ID_ <<
"Cannot get torso encoder interface!";
86 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::INTERFACE\nERROR: cannot get torso encoder interface!");
89 yInfo() <<
log_ID_ <<
"Succesfully got torso encoder interface.";
93 yError() <<
log_ID_ <<
"Cannot open torso remote_controlboard!";
95 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::DRIVER\nERROR: cannot open torso remote_controlboard!");
98 yInfo() <<
log_ID_ <<
"Succesfully initialized.";
103 const yarp::os::ConstString& robot,
const yarp::os::ConstString& laterality,
const yarp::os::ConstString& port_prefix) :
104 iCubGatePose(std::move(visual_correction), 0.1, 0.1, 0.1, 5, 30, robot, laterality, port_prefix) { }
114 Vector enc_torso(torso_enc_num);
118 std::swap(enc_torso(0), enc_torso(2));
128 Vector enc_arm(arm_enc_num);
130 Vector root_ee_enc(10);
132 root_ee_enc.setSubvector(0,
readTorso());
136 for (
size_t i = 0; i < 7; ++i)
137 root_ee_enc(i + 3) = enc_arm(i);
147 return toEigen(ee_pose);
iCubGatePose(std::unique_ptr< PFVisualCorrection > visual_correction, const double gate_x, const double gate_y, const double gate_z, const double gate_aperture, const double gate_rotation, const yarp::os::ConstString &robot, const yarp::os::ConstString &laterality, const yarp::os::ConstString &port_prefix)
iCub::iKin::iCubArm icub_kin_arm_
yarp::sig::Vector readTorso()
yarp::dev::IEncoders * itf_torso_enc_
~iCubGatePose() noexcept override
const yarp::os::ConstString ID_
yarp::os::ConstString robot_
yarp::os::ConstString laterality_
yarp::sig::Vector readRootToEE()
Eigen::VectorXd readPose() override
yarp::dev::IEncoders * itf_arm_enc_
const yarp::os::ConstString log_ID_
yarp::dev::PolyDriver drv_arm_enc_
yarp::dev::PolyDriver drv_torso_enc_