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) noexcept :
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)
30 icub_kin_arm_.setAllConstraints(
false);
31 icub_kin_arm_.releaseLink(0);
32 icub_kin_arm_.releaseLink(1);
33 icub_kin_arm_.releaseLink(2);
36 port_arm_enc_.open (
"/hand-tracking/" + ID_ +
"/" + port_prefix_ +
"/" + laterality_ +
"_arm:i");
37 port_torso_enc_.open(
"/hand-tracking/" + ID_ +
"/" + port_prefix_ +
"/torso:i");
40 yInfo() << log_ID_ <<
"Succesfully initialized.";
45 const yarp::os::ConstString& robot,
const yarp::os::ConstString& laterality,
const yarp::os::ConstString& port_prefix) noexcept :
46 PlayGatePose(std::move(visual_correction), 0.1, 0.1, 0.1, 5, 30, robot, laterality, port_prefix) { }
54 Bottle* b = port_torso_enc_.read(
true);
55 if (!b)
return Vector(3, 0.0);
58 torso_enc(0) = b->get(2).asDouble();
59 torso_enc(1) = b->get(1).asDouble();
60 torso_enc(2) = b->get(0).asDouble();
68 Bottle* b = port_arm_enc_.read(
true);
69 if (!b)
return Vector(10, 0.0);
71 Vector root_ee_enc(10);
72 root_ee_enc.setSubvector(0, readTorso());
73 for (
size_t i = 0; i < 7; ++i)
75 root_ee_enc(i+3) = b->get(i).asDouble();
84 Vector ee_pose = icub_kin_arm_.EndEffPose(CTRL_DEG2RAD * readRootToEE());
86 return toEigen(ee_pose);
PlayGatePose(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) noexcept
Eigen::VectorXd readPose() override
yarp::sig::Vector readTorso()
~PlayGatePose() noexcept override
yarp::sig::Vector readRootToEE()