6 #include <iCub/ctrl/math.h> 7 #include <yarp/eigen/Eigen.h> 8 #include <yarp/math/Math.h> 9 #include <yarp/os/Bottle.h> 10 #include <yarp/os/Property.h> 11 #include <yarp/os/LogStream.h> 14 using namespace Eigen;
24 icub_kin_arm_(iCubArm(laterality+
"_v2")),
25 robot_(robot), laterality_(laterality), port_prefix_(port_prefix)
28 opt_arm_enc.put(
"device",
"remote_controlboard");
29 opt_arm_enc.put(
"local",
"/hand-tracking/" +
ID_ +
"/" + port_prefix +
"/control_" +
laterality_ +
"_arm");
30 opt_arm_enc.put(
"remote",
"/" +
robot_ +
"/right_arm");
36 yInfo() <<
log_ID_ <<
"Succesfully opened " + laterality_ +
" arm remote_controlboard interface.";
38 yInfo() <<
log_ID_ <<
"Getting " + laterality_ +
" arm encoder interface...";
43 yError() <<
log_ID_ <<
"Cannot get " + laterality_ +
" arm encoder interface!";
46 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::INTERFACE\nERROR: cannot get " + laterality_ +
" arm encoder interface!");
49 yInfo() <<
log_ID_ <<
"Succesfully got " + laterality_ +
" arm encoder interface.";
53 yError() <<
log_ID_ <<
"Cannot open " + laterality_ +
" arm remote_controlboard!";
55 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::DRIVER\nERROR: cannot open " + laterality_ +
" arm remote_controlboard!");
63 Property opt_torso_enc;
64 opt_torso_enc.put(
"device",
"remote_controlboard");
65 opt_torso_enc.put(
"local",
"/hand-tracking/" +
ID_ +
"/" + port_prefix +
"/control_torso");
66 opt_torso_enc.put(
"remote",
"/" +
robot_ +
"/torso");
68 yInfo() <<
log_ID_ <<
"Opening torso remote_controlboard driver...";
72 yInfo() <<
log_ID_ <<
"Succesfully opened torso remote_controlboard driver.";
74 yInfo() <<
log_ID_ <<
"Getting torso encoder interface...";
79 yError() <<
log_ID_ <<
"Cannot get torso encoder interface!";
82 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::INTERFACE\nERROR: cannot get torso encoder interface!");
85 yInfo() <<
log_ID_ <<
"Succesfully got torso encoder interface.";
89 yError() <<
log_ID_ <<
"Cannot open torso remote_controlboard!";
91 throw std::runtime_error(
"ERROR::" +
ID_ +
"::CTOR::DRIVER\nERROR: cannot open torso remote_controlboard!");
94 yInfo() <<
log_ID_ <<
"Succesfully initialized.";
115 return toEigen(ee_pose);
123 Vector enc_torso(torso_enc_num);
127 std::swap(enc_torso(0), enc_torso(2));
137 Vector enc_arm(arm_enc_num);
139 Vector root_ee_enc(10);
141 root_ee_enc.setSubvector(0,
readTorso());
144 for (
size_t i = 0; i < 7; ++i)
145 root_ee_enc(i + 3) = enc_arm(i);
yarp::os::ConstString log_ID_
yarp::sig::Vector readRootToEE()
yarp::dev::IEncoders * itf_arm_enc_
iCubFwdKinModel(const yarp::os::ConstString &robot, const yarp::os::ConstString &laterality, const yarp::os::ConstString &port_prefix)
bool setProperty(const std::string &property) override
yarp::os::ConstString robot_
yarp::dev::IEncoders * itf_torso_enc_
iCub::iKin::iCubArm icub_kin_arm_
yarp::os::ConstString ID_
~iCubFwdKinModel() noexcept
yarp::dev::PolyDriver drv_arm_enc_
yarp::sig::Vector readTorso()
Eigen::VectorXd readPose() override
yarp::os::ConstString laterality_
bool setProperty(const std::string &property) override
yarp::dev::PolyDriver drv_torso_enc_