6 #include <iCub/ctrl/math.h> 7 #include <yarp/math/Math.h> 8 #include <yarp/eigen/Eigen.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)
27 port_arm_enc_.open (
"/hand-tracking/" + ID_ +
"/" + port_prefix_ +
"/" + laterality_ +
"_arm:i");
28 port_torso_enc_.open(
"/hand-tracking/" + ID_ +
"/" + port_prefix_ +
"/torso:i");
30 icub_kin_arm_.setAllConstraints(
false);
31 icub_kin_arm_.releaseLink(0);
32 icub_kin_arm_.releaseLink(1);
33 icub_kin_arm_.releaseLink(2);
35 yInfo() << log_ID_ <<
"Succesfully initialized.";
40 port_torso_enc_.interrupt();
41 port_torso_enc_.close();
43 port_arm_enc_.interrupt();
44 port_arm_enc_.close();
56 Vector ee_pose = icub_kin_arm_.EndEffPose(CTRL_DEG2RAD * readRootToEE());
57 return toEigen(ee_pose);
63 Bottle* b = port_torso_enc_.read(
true);
64 if (!b)
return Vector(3, 0.0);
67 torso_enc(0) = b->get(2).asDouble();
68 torso_enc(1) = b->get(1).asDouble();
69 torso_enc(2) = b->get(0).asDouble();
77 Bottle* b = port_arm_enc_.read(
true);
78 if (!b)
return Vector(10, 0.0);
80 Vector root_ee_enc(10);
81 root_ee_enc.setSubvector(0, readTorso());
82 for (
size_t i = 0; i < 7; ++i)
83 root_ee_enc(i + 3) = b->get(i).asDouble();
Eigen::VectorXd readPose() override
yarp::sig::Vector readRootToEE()
bool setProperty(const std::string &property) override
~PlayFwdKinModel() noexcept
PlayFwdKinModel(const yarp::os::ConstString &robot, const yarp::os::ConstString &laterality, const yarp::os::ConstString &port_prefix) noexcept
bool setProperty(const std::string &property) override
yarp::sig::Vector readTorso()