10#include <yarp/os/LogStream.h>
16YARP_LOG_COMPONENT(COUPLINGICUBEYE,
"yarp.device.couplingICubEye")
20 yarp::sig::VectorOf<size_t> coupled_physical_joints{1, 2};
21 yarp::sig::VectorOf<size_t> coupled_actuated_axes{1, 2};
22 std::vector<std::pair<double, double>> physical_joint_limits;
24 physical_joint_limits.resize(m_jointNames.size());
25 for (
int i = 0; i< m_jointNames.size(); i++)
27 physical_joint_limits[i] = std::make_pair(m_LIMITS_jntPosMin[i], m_LIMITS_jntPosMax[i]);
29 initialise(coupled_physical_joints, coupled_actuated_axes, m_jointNames, m_COUPLING_actuatedAxesNames, physical_joint_limits);
36 yCError(COUPLINGICUBEYE) <<
"Error parsing parameters";
40 if(!populateCouplingParameters()) {
41 yCError(COUPLINGICUBEYE) <<
"Error populating coupling parameters";
45 yCDebug(COUPLINGICUBEYE) <<
"Opening couplingICubEye" << config.toString();
50 size_t nrOfPhysicalJoints;
51 size_t nrOfActuatedAxes;
52 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
53 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
54 if (!
ok || physJointsPos.size() != nrOfPhysicalJoints || actAxesPos.size() != nrOfActuatedAxes) {
55 yCError(COUPLINGICUBEYE) <<
"convertFromPhysicalJointsToActuatedAxesPos: input or output vectors have wrong size";
60 actAxesPos[0] = physJointsPos[0];
62 actAxesPos[1] = (physJointsPos[1] + physJointsPos[2])/2;
64 actAxesPos[2] = (physJointsPos[1] - physJointsPos[2]);
70 size_t nrOfPhysicalJoints;
71 size_t nrOfActuatedAxes;
72 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
73 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
74 if (!
ok || physJointsVel.size() != nrOfPhysicalJoints || actAxesVel.size() != nrOfActuatedAxes) {
75 yCError(COUPLINGICUBEYE) <<
"convertFromPhysicalJointsToActuatedAxesVel: input or output vectors have wrong size";
79 actAxesVel[0] = physJointsVel[0];
81 actAxesVel[1] = (physJointsVel[1] + physJointsVel[2])/2;
83 actAxesVel[2] = (physJointsVel[1] - physJointsVel[2]);
89 size_t nrOfPhysicalJoints;
90 size_t nrOfActuatedAxes;
91 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
92 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
93 if (!
ok || physJointsAcc.size() != nrOfPhysicalJoints || actAxesAcc.size() != nrOfActuatedAxes) {
94 yCError(COUPLINGICUBEYE) <<
"convertFromPhysicalJointsToActuatedAxesAcc: input or output vectors have wrong size";
99 actAxesAcc[0] = physJointsAcc[0];
101 actAxesAcc[1] = (physJointsAcc[1] + physJointsAcc[2])/2;
103 actAxesAcc[2] = (physJointsAcc[1] - physJointsAcc[2]);
113 size_t nrOfPhysicalJoints;
114 size_t nrOfActuatedAxes;
115 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
116 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
117 if (!
ok || physJointsPos.size() != nrOfPhysicalJoints || actAxesPos.size() != nrOfActuatedAxes) {
118 yCError(COUPLINGICUBEYE) <<
"convertFromActuatedAxesToPhysicalJointsPos: input or output vectors have wrong size";
123 physJointsPos[0] = actAxesPos[0];
125 physJointsPos[1] = actAxesPos[1] + actAxesPos[2]/2;
127 physJointsPos[2] = actAxesPos[1] - actAxesPos[2]/2;
133 size_t nrOfPhysicalJoints;
134 size_t nrOfActuatedAxes;
135 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
136 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
137 if (!
ok || actAxesPos.size() != nrOfActuatedAxes || physJointsVel.size() != nrOfPhysicalJoints || actAxesVel.size() != nrOfActuatedAxes) {
138 yCError(COUPLINGICUBEYE) <<
"convertFromPhysicalJointsToActuatedAxesVel: input or output vectors have wrong size";
143 physJointsVel[0] = actAxesVel[0];
145 physJointsVel[1] = actAxesVel[1] + actAxesVel[2]/2;
147 physJointsVel[2] = actAxesVel[1] - actAxesVel[2]/2;
153 size_t nrOfPhysicalJoints;
154 size_t nrOfActuatedAxes;
155 auto ok = getNrOfPhysicalJoints(nrOfPhysicalJoints);
156 ok =
ok && getNrOfActuatedAxes(nrOfActuatedAxes);
157 if (!
ok || actAxesPos.size() != nrOfActuatedAxes || physJointsAcc.size() != nrOfPhysicalJoints || actAxesAcc.size() != nrOfActuatedAxes) {
158 yCError(COUPLINGICUBEYE) <<
"convertFromPhysicalJointsToActuatedAxesAcc: input or output vectors have wrong size";
163 physJointsAcc[0] = actAxesAcc[0];
165 physJointsAcc[1] = actAxesAcc[1] + actAxesAcc[2]/2;
167 physJointsAcc[2] = actAxesAcc[1] - actAxesAcc[2]/2;
bool parseParams(const yarp::os::Searchable &config) override
Coupling law from https://icub-tech-iit.github.io/documentation/icub_kinematics/icub-vergence-version...
bool open(yarp::os::Searchable &config) override
Configure with a set of options.
bool convertFromActuatedAxesToPhysicalJointsTrq(const yarp::sig::Vector &actAxesPos, const yarp::sig::Vector &actAxesTrq, yarp::sig::Vector &physJointsTrq) override
bool convertFromPhysicalJointsToActuatedAxesTrq(const yarp::sig::Vector &physJointsPos, const yarp::sig::Vector &physJointsTrq, yarp::sig::Vector &actAxesTrq) override
bool convertFromActuatedAxesToPhysicalJointsVel(const yarp::sig::Vector &actAxesPos, const yarp::sig::Vector &actAxesVel, yarp::sig::Vector &physJointsVel) override
bool convertFromPhysicalJointsToActuatedAxesPos(const yarp::sig::Vector &physJointsPos, yarp::sig::Vector &actAxesPos) override
bool convertFromActuatedAxesToPhysicalJointsPos(const yarp::sig::Vector &actAxesPos, yarp::sig::Vector &physJointsPos) override
bool convertFromPhysicalJointsToActuatedAxesVel(const yarp::sig::Vector &physJointsPos, const yarp::sig::Vector &physJointsVel, yarp::sig::Vector &actAxesVel) override
bool convertFromActuatedAxesToPhysicalJointsAcc(const yarp::sig::Vector &actAxesPos, const yarp::sig::Vector &actAxesVel, const yarp::sig::Vector &actAxesAcc, yarp::sig::Vector &physJointsAcc) override
bool convertFromPhysicalJointsToActuatedAxesAcc(const yarp::sig::Vector &physJointsPos, const yarp::sig::Vector &physJointsVel, const yarp::sig::Vector &physJointsAcc, yarp::sig::Vector &actAxesAcc) override