55 if (ControlBoardWrapper_p->verbose())
70 if (ControlBoardWrapper_p->verbose())
81 *ok = rpc_IImpedance->setImpedance(cmd.
get(3).
asInt32(),stiff,damp);
92 *ok = rpc_IImpedance->setImpedanceOffset(cmd.
get(3).
asInt32(),offs);
105 if (ControlBoardWrapper_p->verbose())
114 *ok = rpc_IImpedance->getImpedance(cmd.
get(3).
asInt32(),&stiff, &damp);
123 *ok = rpc_IImpedance->getImpedanceOffset(cmd.
get(3).
asInt32(),&offs);
131 double min_stiff = 0;
132 double max_stiff = 0;
135 *ok = rpc_IImpedance->getCurrentImpedanceLimit(cmd.
get(3).
asInt32(),&min_stiff, &max_stiff, &min_damp, &max_damp);
146 lastRpcStamp.update();
160 if (ControlBoardWrapper_p->verbose())
162 if (! (rpc_iCtrlMode))
178 if (ControlBoardWrapper_p->verbose())
190 *ok = rpc_iCtrlMode->setControlMode(axis, cmd.
get(4).
asVocab());
205 int *js =
new int [n_joints];
206 int *modes =
new int [n_joints];
208 for(
int i=0; i<n_joints; i++)
213 for(
int i=0; i<n_joints; i++)
218 *ok = rpc_iCtrlMode->setControlModes(n_joints, js, modes);
234 if(modeList->
size() != (size_t) controlledJoints)
236 yCError(
CONTROLBOARDWRAPPER,
"received an invalid setControlMode message. Size of vector doesn´t match the number of controlled joints");
240 int *modes =
new int [controlledJoints];
241 for(
int i=0; i<controlledJoints; i++)
246 *ok = rpc_iCtrlMode->setControlModes(modes);
261 yCError(
CONTROLBOARDWRAPPER) <<
" Error, received a set control mode message using a legacy version, trying to be handle the message anyway "
262 <<
" but please update your client to be compatible with the IControlMode2 interface";
296 yCError(
CONTROLBOARDWRAPPER) <<
"The 'impedancePosition' control mode is deprecated. \nUse setInteractionMode(axis, VOCAB_IM_COMPLIANT) + setControlMode(axis, VOCAB_CM_POSITION) instead";
300 yCError(
CONTROLBOARDWRAPPER) <<
"The 'impedanceVelocity' control mode is deprecated. \nUse setInteractionMode(axis, VOCAB_IM_COMPLIANT) + setControlMode(axis, VOCAB_CM_VELOCITY) instead";
305 *ok = rpc_iCtrlMode->setControlMode(axis,
VOCAB_CM_PWM);
358 if (ControlBoardWrapper_p->verbose())
367 if (ControlBoardWrapper_p->verbose())
369 int *p =
new int[controlledJoints];
370 for (
int i = 0; i < controlledJoints; ++i) {
374 *ok = rpc_iCtrlMode->getControlModes(p);
381 for (i = 0; i < controlledJoints; i++)
391 if (ControlBoardWrapper_p->verbose())
397 *ok = rpc_iCtrlMode->getControlMode(axis, &p);
410 if (ControlBoardWrapper_p->verbose())
416 int *js =
new int [n_joints];
417 int *modes =
new int [n_joints];
418 for(
int i=0; i<n_joints; i++)
424 *ok = rpc_iCtrlMode->getControlModes(n_joints, js, modes);
434 for(
int i=0; i<n_joints; i++)
452 lastRpcStamp.update();
468 if (ControlBoardWrapper_p->verbose())
484 if (ControlBoardWrapper_p->verbose())
515 *ok = rpc_ITorque->setMotorTorqueParams(joint, params);
526 const int njs = b->
size();
527 if (njs==controlledJoints)
529 auto* p =
new double[njs];
530 for (i = 0; i < njs; i++)
532 *ok = rpc_ITorque->setRefTorques (p);
542 int *modes =
new int[controlledJoints];
543 for(
int i=0; i<controlledJoints; i++)
545 *ok = rpc_iCtrlMode->setControlModes(modes);
562 if (ControlBoardWrapper_p->verbose())
574 *ok = rpc_ITorque->getAxes(&tmp);
581 *ok = rpc_ITorque->getTorque(cmd.
get(3).
asInt32(), &dtmp);
592 *ok = rpc_ITorque->getMotorTorqueParams(joint, ¶ms);
605 *ok = rpc_ITorque->getTorqueRange(cmd.
get(3).
asInt32(), &dtmp, &dtmp2);
614 auto* p =
new double[controlledJoints];
615 *ok = rpc_ITorque->getTorques(p);
617 for (i = 0; i < controlledJoints; i++)
625 auto* p1 =
new double[controlledJoints];
626 auto* p2 =
new double[controlledJoints];
627 *ok = rpc_ITorque->getTorqueRanges(p1,p2);
630 for (i = 0; i < controlledJoints; i++)
633 for (i = 0; i < controlledJoints; i++)
642 *ok = rpc_ITorque->getRefTorque(cmd.
get(3).
asInt32(), &dtmp);
649 auto* p =
new double[controlledJoints];
650 *ok = rpc_ITorque->getRefTorques(p);
653 for (i = 0; i < controlledJoints; i++)
660 lastRpcStamp.update();
669 if (ControlBoardWrapper_p->verbose())
678 if (ControlBoardWrapper_p->verbose())
708 if( (jointList->
size() != (
size_t) n_joints) || (modeList->
size() != (
size_t) n_joints) )
710 if (ControlBoardWrapper_p->verbose()) {
716 int *joints =
new int[n_joints];
718 for(
int i=0; i<n_joints; i++)
724 *ok = rpc_IInteract->setInteractionModes(n_joints, joints, modes);
736 if(modeList->
size() != (
size_t) controlledJoints)
738 if (ControlBoardWrapper_p->verbose())
739 yCError(
CONTROLBOARDWRAPPER,
"Received an invalid setInteractionMode message. Size of vector doesn´t match the number of controlled joints");
744 for(
int i=0; i<controlledJoints; i++)
748 *ok = rpc_IInteract->setInteractionModes(modes);
755 if (ControlBoardWrapper_p->verbose())
774 *ok = rpc_IInteract->getInteractionMode(cmd.
get(3).
asInt32(), &mode);
786 if(jointList->
size() != (size_t) n_joints )
792 int *joints =
new int[n_joints];
794 for(
int i=0; i<n_joints; i++)
798 *ok = rpc_IInteract->getInteractionModes(n_joints, joints, modes);
801 for(
int i=0; i<n_joints; i++)
806 if (ControlBoardWrapper_p->verbose())
821 *ok = rpc_IInteract->getInteractionModes(modes);
824 for(
int i=0; i<controlledJoints; i++)
828 if (ControlBoardWrapper_p->verbose())
837 lastRpcStamp.update();
852 if (ControlBoardWrapper_p->verbose())
908 if (ControlBoardWrapper_p->verbose())
919 *ok = rpc_ICurrent->getRefCurrent(cmd.
get(3).
asInt32(), &dtmp);
926 auto* p =
new double[controlledJoints];
927 *ok = rpc_ICurrent->getRefCurrents(p);
930 for (i = 0; i < controlledJoints; i++)
939 *ok = rpc_ICurrent->getCurrentRange(cmd.
get(3).
asInt32(), &dtmp, &dtmp2);
947 auto* p1 =
new double[controlledJoints];
948 auto* p2 =
new double[controlledJoints];
949 *ok = rpc_ICurrent->getCurrentRanges(p1,p2);
953 for (i = 0; i < controlledJoints; i++)
957 for (i = 0; i < controlledJoints; i++)
989 if (ControlBoardWrapper_p->verbose())
1010 if (ControlBoardWrapper_p->verbose())
1020 *ok = rpc_IPid->setPidOffset(pidtype, j, v);
1043 *ok = rpc_IPid->setPid(pidtype, j, p);
1055 const int njs = b->
size();
1056 if (njs==controlledJoints)
1062 for (i = 0; i < njs; i++)
1084 *ok = rpc_IPid->setPids(pidtype, p);
1107 const int njs = b->
size();
1108 if (njs==controlledJoints)
1110 auto* p =
new double[njs];
1111 for (i = 0; i < njs; i++)
1113 *ok = rpc_IPid->setPidReferences (pidtype, p);
1133 const int njs = b->
size();
1134 if (njs==controlledJoints)
1136 auto* p =
new double[njs];
1137 for (i = 0; i < njs; i++)
1139 *ok = rpc_IPid->setPidErrorLimits (pidtype, p);
1147 *ok = rpc_IPid->resetPid (pidtype, cmd.
get(4).
asInt32());
1153 *ok = rpc_IPid->disablePid (pidtype, cmd.
get(4).
asInt32());
1159 *ok = rpc_IPid->enablePid (pidtype, cmd.
get(4).
asInt32());
1169 if (ControlBoardWrapper_p->verbose())
1173 response.
add(cmd.
get(1));
1179 auto* p =
new double[controlledJoints];
1180 *ok = rpc_IPid->getPidErrorLimits(pidtype, p);
1183 for (i = 0; i < controlledJoints; i++)
1192 *ok = rpc_IPid->isPidEnabled(pidtype, cmd.
get(4).
asInt32(), &booltmp);
1199 *ok = rpc_IPid->getPidError(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1206 auto* p =
new double[controlledJoints];
1207 *ok = rpc_IPid->getPidErrors(pidtype, p);
1210 for (i = 0; i < controlledJoints; i++)
1218 *ok = rpc_IPid->getPidOutput(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1225 auto* p =
new double[controlledJoints];
1226 *ok = rpc_IPid->getPidOutputs(pidtype, p);
1229 for (i = 0; i < controlledJoints; i++)
1238 *ok = rpc_IPid->getPid(pidtype, cmd.
get(4).
asInt32(), &p);
1255 Pid *p =
new Pid[controlledJoints];
1256 *ok = rpc_IPid->getPids(pidtype, p);
1259 for (i = 0; i < controlledJoints; i++)
1279 *ok = rpc_IPid->getPidReference(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1286 auto* p =
new double[controlledJoints];
1287 *ok = rpc_IPid->getPidReferences(pidtype, p);
1290 for (i = 0; i < controlledJoints; i++)
1298 *ok = rpc_IPid->getPidErrorLimit(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1318 if (ControlBoardWrapper_p->verbose())
1338 if (ControlBoardWrapper_p->verbose())
1364 if (ControlBoardWrapper_p->verbose())
1368 response.
add(cmd.
get(1));
1374 *ok = rpc_IPWM->getRefDutyCycle(cmd.
get(3).
asInt32(), &dtmp);
1381 auto* p =
new double[controlledJoints];
1382 *ok = rpc_IPWM->getRefDutyCycles(p);
1385 for (i = 0; i < controlledJoints; i++)
1393 *ok = rpc_IPWM->getDutyCycle(cmd.
get(3).
asInt32(), &dtmp);
1400 auto* p =
new double[controlledJoints];
1401 *ok = rpc_IPWM->getRefDutyCycles(p);
1404 for (i = 0; i < controlledJoints; i++)
1432 if (ControlBoardWrapper_p->verbose())
1435 if (!rpc_IRemoteCalibrator)
1457 *ok = rpc_IVar->setRemoteVariable(cmd.
get(3).
asString(), btail);
1474 response.
add(cmd.
get(1));
1477 if (ControlBoardWrapper_p->verbose())
1484 *ok = rpc_IVar->getRemoteVariable(cmd.
get(3).
asString(), btmp);
1492 *ok = rpc_IVar->getRemoteVariablesList(&btmp);
1504 if(ControlBoardWrapper_p->verbose())
1507 if (!rpc_IRemoteCalibrator)
1528 if (ControlBoardWrapper_p->verbose())
1530 *ok = rpc_IRemoteCalibrator->calibrateSingleJoint(cmd.
get(3).
asInt32());
1535 if (ControlBoardWrapper_p->verbose())
1537 *ok = rpc_IRemoteCalibrator->calibrateWholePart();
1542 if (ControlBoardWrapper_p->verbose())
1544 *ok = rpc_IRemoteCalibrator->homingSingleJoint(cmd.
get(3).
asInt32());
1550 if (ControlBoardWrapper_p->verbose())
1552 *ok = rpc_IRemoteCalibrator->homingWholePart();
1557 if (ControlBoardWrapper_p->verbose())
1559 *ok = rpc_IRemoteCalibrator->parkSingleJoint(cmd.
get(3).
asInt32());
1564 if (ControlBoardWrapper_p->verbose())
1566 *ok = rpc_IRemoteCalibrator->parkWholePart();
1571 if (ControlBoardWrapper_p->verbose())
1573 *ok = rpc_IRemoteCalibrator->quitCalibrate();
1578 if (ControlBoardWrapper_p->verbose())
1580 *ok = rpc_IRemoteCalibrator->quitPark();
1595 response.
add(cmd.
get(1));
1602 if (ControlBoardWrapper_p->verbose())
1604 *ok = rpc_IRemoteCalibrator->isCalibratorDevicePresent(&tmp);
1619 if (ControlBoardWrapper_p->verbose())
1633 handlePidMsg(cmd, response, &rec, &ok);
1637 handleTorqueMsg(cmd, response, &rec, &ok);
1641 handleControlModeMsg(cmd, response, &rec, &ok);
1645 handleImpedanceMsg(cmd, response, &rec, &ok);
1649 handleInteractionModeMsg(cmd, response, &rec, &ok);
1653 handleProtocolVersionRequest(cmd, response, &rec, &ok);
1657 handleRemoteCalibratorMsg(cmd, response, &rec, &ok);
1661 handleRemoteVariablesMsg(cmd, response, &rec, &ok);
1665 handleCurrentMsg(cmd, response, &rec, &ok);
1669 handlePWMMsg(cmd, response, &rec, &ok);
1679 if (ControlBoardWrapper_p->verbose())
1687 if (rpc_Icalib==
nullptr)
1690 ok=rpc_Icalib->calibrateAxisWithParams(j,ui,v1,v2,v3);
1697 if (ControlBoardWrapper_p->verbose())
1707 if (rpc_Icalib ==
nullptr)
1710 ok = rpc_Icalib->setCalibrationParameters(j, params);
1717 if (ControlBoardWrapper_p->verbose())
1719 ok=rpc_Icalib->calibrateRobot();
1726 if (ControlBoardWrapper_p->verbose())
1729 ok=rpc_Icalib->calibrationDone(j);
1736 if (ControlBoardWrapper_p->verbose())
1740 ok=rpc_Icalib->park(
true);
1742 ok=rpc_Icalib->park(
false);
1750 if (ControlBoardWrapper_p->verbose())
1768 const int njs = b->
size();
1769 if (njs!=controlledJoints)
1771 tmpVect.resize(njs);
1772 for (i = 0; i < njs; i++)
1775 if (rpc_IPosCtrl!=
nullptr)
1776 ok = rpc_IPosCtrl->positionMove(&tmpVect[0]);
1786 if (rpc_IPosCtrl ==
nullptr)
1789 if (jlut==
nullptr || pos_val==
nullptr)
1791 if ((
size_t) len!=jlut->
size() || (
size_t) len!=pos_val->
size())
1794 int *j_tmp=
new int [len];
1795 auto* pos_tmp=
new double [len];
1797 for (
int i = 0; i < len; i++)
1800 for (
int i = 0; i < len; i++)
1803 ok = rpc_IPosCtrl->positionMove(len, j_tmp, pos_tmp);
1817 const int njs = b->
size();
1818 if (njs!=controlledJoints)
1820 tmpVect.resize(njs);
1821 for (i = 0; i < njs; i++)
1823 if (rpc_IVelCtrl!=
nullptr)
1824 ok = rpc_IVelCtrl->velocityMove(&tmpVect[0]);
1841 if (rpc_IPosCtrl ==
nullptr)
1844 if (jBottle_p==
nullptr || posBottle_p==
nullptr)
1846 if ((
size_t) len!=jBottle_p->
size() || (
size_t) len!=posBottle_p->
size())
1849 int *j_tmp=
new int [len];
1850 auto* pos_tmp=
new double [len];
1852 for (
int i = 0; i < len; i++)
1855 for (
int i = 0; i < len; i++)
1858 ok = rpc_IPosCtrl->relativeMove(len, j_tmp, pos_tmp);
1873 const int njs = b->
size();
1874 if(njs!=controlledJoints)
1876 auto* p =
new double[njs];
1877 for (i = 0; i < njs; i++)
1879 ok = rpc_IPosCtrl->relativeMove(p);
1896 if (rpc_IPosCtrl ==
nullptr)
1899 if (jBottle_p==
nullptr || velBottle_p==
nullptr)
1901 if ((
size_t) len!=jBottle_p->
size() || (
size_t) len!=velBottle_p->
size())
1904 int *j_tmp=
new int [len];
1905 auto* spds_tmp=
new double [len];
1907 for (
int i = 0; i < len; i++)
1910 for (
int i = 0; i < len; i++)
1913 ok = rpc_IPosCtrl->setRefSpeeds(len, j_tmp, spds_tmp);
1927 const int njs = b->
size();
1928 if (njs!=controlledJoints)
1930 auto* p =
new double[njs];
1931 for (i = 0; i < njs; i++)
1933 ok = rpc_IPosCtrl->setRefSpeeds(p);
1950 if (rpc_IPosCtrl ==
nullptr)
1953 if (jBottle_p==
nullptr || accBottle_p==
nullptr)
1955 if ((
size_t) len!=jBottle_p->
size() || (
size_t) len!=accBottle_p->
size())
1958 int *j_tmp =
new int [len];
1959 auto* accs_tmp =
new double [len];
1961 for (
int i = 0; i < len; i++)
1964 for (
int i = 0; i < len; i++)
1967 ok = rpc_IPosCtrl->setRefAccelerations(len, j_tmp, accs_tmp);
1981 const int njs = b->
size();
1982 if(njs!=controlledJoints)
1984 auto* p =
new double[njs];
1985 for (i = 0; i < njs; i++)
1987 ok = rpc_IPosCtrl->setRefAccelerations(p);
1994 ok = rpc_IPosCtrl->stop(cmd.
get(2).
asInt32());
2003 if (rpc_IPosCtrl ==
nullptr)
2006 if (jBottle_p==
nullptr)
2008 if ((
size_t) len!=jBottle_p->
size())
2011 int *j_tmp =
new int [len];
2013 for (
int i = 0; i < len; i++)
2016 ok = rpc_IPosCtrl->stop(len, j_tmp);
2023 ok = rpc_IPosCtrl->stop();
2029 ok = rpc_IEncTimed->resetEncoder(cmd.
get(2).
asInt32());
2035 ok = rpc_IEncTimed->resetEncoders();
2053 const int njs = b->
size();
2054 if (njs!=controlledJoints)
2056 auto* p =
new double[njs];
2057 for (i = 0; i < njs; i++)
2059 ok = rpc_IEncTimed->setEncoders(p);
2072 ok = rpc_IMotEnc->resetMotorEncoder(cmd.
get(2).
asInt32());
2078 ok = rpc_IMotEnc->resetMotorEncoders();
2096 const int njs = b->
size();
2097 if (njs!=controlledJoints)
2099 auto* p =
new double[njs];
2100 for (i = 0; i < njs; i++)
2102 ok = rpc_IMotEnc->setMotorEncoders(p);
2109 ok = rcp_IAmp->enableAmp(cmd.
get(2).
asInt32());
2115 ok = rcp_IAmp->disableAmp(cmd.
get(2).
asInt32());
2180 if (ControlBoardWrapper_p->verbose())
2186 response.
add(cmd.
get(1));
2193 ok = rpc_IMotor->getTemperatureLimit(cmd.
get(2).
asInt32(), &dtmp);
2200 ok = rpc_IMotor->getTemperature(cmd.
get(2).
asInt32(), &dtmp);
2207 ok = rpc_IMotor->getGearboxRatio(cmd.
get(2).
asInt32(), &dtmp);
2214 auto* p =
new double[controlledJoints];
2215 ok = rpc_IMotor->getTemperatures(p);
2218 for (i = 0; i < controlledJoints; i++)
2226 ok = rcp_IAmp->getMaxCurrent(cmd.
get(2).
asInt32(), &dtmp);
2233 if (ControlBoardWrapper_p->verbose())
2236 ok = rpc_IPosCtrl->getTargetPosition(cmd.
get(2).
asInt32(), &dtmp);
2247 int *jointList =
new int[len];
2248 auto* refs =
new double[len];
2250 for(
int j=0; j<len; j++)
2254 ok = rpc_IPosCtrl->getTargetPositions(len, jointList, refs);
2257 for (
int i = 0; i < len; i++)
2267 auto* refs =
new double[controlledJoints];
2268 ok = rpc_IPosCtrl->getTargetPositions(refs);
2271 for (i = 0; i < controlledJoints; i++)
2279 if (ControlBoardWrapper_p->verbose())
2282 ok = rpc_IPosDirect->getRefPosition(cmd.
get(2).
asInt32(), &dtmp);
2293 int *jointList =
new int[len];
2294 auto* refs =
new double[len];
2296 for(
int j=0; j<len; j++)
2300 ok = rpc_IPosDirect->getRefPositions(len, jointList, refs);
2303 for (
int i = 0; i < len; i++)
2313 auto* refs =
new double[controlledJoints];
2314 ok = rpc_IPosDirect->getRefPositions(refs);
2317 for (i = 0; i < controlledJoints; i++)
2325 if (ControlBoardWrapper_p->verbose())
2328 ok = rpc_IVelCtrl->getRefVelocity(cmd.
get(2).
asInt32(), &dtmp);
2337 if (ControlBoardWrapper_p->verbose())
2342 int *jointList =
new int[len];
2343 auto* refs =
new double[len];
2345 for(
int j=0; j<len; j++)
2349 ok = rpc_IVelCtrl->getRefVelocities(len, jointList, refs);
2352 for (
int i = 0; i < len; i++)
2362 if (ControlBoardWrapper_p->verbose())
2365 auto* refs =
new double[controlledJoints];
2366 ok = rpc_IVelCtrl->getRefVelocities(refs);
2369 for (i = 0; i < controlledJoints; i++)
2378 ok = rpc_IMotor->getNumberOfMotors(&tmp);
2386 ok = rpc_IPosCtrl->getAxes(&tmp);
2394 ok = rpc_IPosCtrl->checkMotionDone(cmd.
get(2).
asInt32(), &x);
2404 int *jointList =
new int[len];
2405 for(
int j=0; j<len; j++)
2409 if(rpc_IPosCtrl!=
nullptr)
2410 ok = rpc_IPosCtrl->checkMotionDone(len, jointList, &x);
2420 ok = rpc_IPosCtrl->checkMotionDone(&x);
2427 ok = rpc_IPosCtrl->getRefSpeed(cmd.
get(2).
asInt32(), &dtmp);
2436 int *jointList =
new int[len];
2437 auto* speeds =
new double[len];
2439 for(
int j=0; j<len; j++)
2443 ok = rpc_IPosCtrl->getRefSpeeds(len, jointList, speeds);
2446 for (
int i = 0; i < len; i++)
2456 auto* p =
new double[controlledJoints];
2457 ok = rpc_IPosCtrl->getRefSpeeds(p);
2460 for (i = 0; i < controlledJoints; i++)
2468 ok = rpc_IPosCtrl->getRefAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2477 int *jointList =
new int[len];
2478 auto* accs =
new double[len];
2480 for(
int j=0; j<len; j++)
2484 ok = rpc_IPosCtrl->getRefAccelerations(len, jointList, accs);
2487 for (
int i = 0; i < len; i++)
2497 auto* p =
new double[controlledJoints];
2498 ok = rpc_IPosCtrl->getRefAccelerations(p);
2501 for (i = 0; i < controlledJoints; i++)
2509 ok = rpc_IEncTimed->getEncoder(cmd.
get(2).
asInt32(), &dtmp);
2516 auto* p =
new double[controlledJoints];
2517 ok = rpc_IEncTimed->getEncoders(p);
2520 for (i = 0; i < controlledJoints; i++)
2528 ok = rpc_IEncTimed->getEncoderSpeed(cmd.
get(2).
asInt32(), &dtmp);
2535 auto* p =
new double[controlledJoints];
2536 ok = rpc_IEncTimed->getEncoderSpeeds(p);
2539 for (i = 0; i < controlledJoints; i++)
2547 ok = rpc_IEncTimed->getEncoderAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2554 auto* p =
new double[controlledJoints];
2555 ok = rpc_IEncTimed->getEncoderAccelerations(p);
2558 for (i = 0; i < controlledJoints; i++)
2566 ok = rpc_IMotEnc->getMotorEncoderCountsPerRevolution(cmd.
get(2).
asInt32(), &dtmp);
2573 ok = rpc_IMotEnc->getMotorEncoder(cmd.
get(2).
asInt32(), &dtmp);
2580 auto* p =
new double[controlledJoints];
2581 ok = rpc_IMotEnc->getMotorEncoders(p);
2584 for (i = 0; i < controlledJoints; i++)
2592 ok = rpc_IMotEnc->getMotorEncoderSpeed(cmd.
get(2).
asInt32(), &dtmp);
2599 auto* p =
new double[controlledJoints];
2600 ok = rpc_IMotEnc->getMotorEncoderSpeeds(p);
2603 for (i = 0; i < controlledJoints; i++)
2611 ok = rpc_IMotEnc->getMotorEncoderAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2618 auto* p =
new double[controlledJoints];
2619 ok = rpc_IMotEnc->getMotorEncoderAccelerations(p);
2622 for (i = 0; i < controlledJoints; i++)
2631 ok = rpc_IMotEnc->getNumberOfMotorEncoders(&num);
2638 ok = rcp_IAmp->getCurrent(cmd.
get(2).
asInt32(), &dtmp);
2645 auto* p =
new double[controlledJoints];
2646 ok = rcp_IAmp->getCurrents(p);
2649 for (i = 0; i < controlledJoints; i++)
2657 int *p =
new int[controlledJoints];
2658 ok = rcp_IAmp->getAmpStatus(p);
2661 for (i = 0; i < controlledJoints; i++)
2671 ok = rcp_IAmp->getAmpStatus(j, &itmp);
2679 ok = rcp_IAmp->getNominalCurrent(m, &dtmp);
2687 ok = rcp_IAmp->getPeakCurrent(m, &dtmp);
2695 ok = rcp_IAmp->getPWM(m, &dtmp);
2704 ok = rcp_IAmp->getPWMLimit(m, &dtmp);
2712 ok = rcp_IAmp->getPowerSupplyVoltage(m, &dtmp);
2719 double min = 0.0, max = 0.0;
2720 ok = rcp_Ilim->getLimits(cmd.
get(2).
asInt32(), &min, &max);
2728 double min = 0.0, max = 0.0;
2729 ok = rcp_Ilim->getVelLimits(cmd.
get(2).
asInt32(), &min, &max);
2737 std::string name =
"undocumented";
2738 ok = rpc_AxisInfo->getAxisName(cmd.
get(2).
asInt32(),name);
2746 ok = rpc_AxisInfo->getJointType(cmd.
get(2).
asInt32(), type);
2758 lastRpcStamp.update();
2767 ok = DeviceResponder::respond(cmd,response);
2789 ok = rpc_IPosCtrl->getAxes(&controlledJoints);
2792 DeviceResponder::makeUsage();
2793 addUsage(
"[get] [axes]",
"get the number of axes");
2794 addUsage(
"[get] [name] $iAxisNumber",
"get a human-readable name for an axis, if available");
2795 addUsage(
"[set] [pos] $iAxisNumber $fPosition",
"command the position of an axis");
2796 addUsage(
"[set] [rel] $iAxisNumber $fPosition",
"command the relative position of an axis");
2797 addUsage(
"[set] [vmo] $iAxisNumber $fVelocity",
"command the velocity of an axis");
2798 addUsage(
"[get] [enc] $iAxisNumber",
"get the encoder value for an axis");
2801 for (
int i=0; i<controlledJoints; i++) {
2808 addUsage((std::string(
"[set] [poss] (")+args+
")").c_str(),
2809 "command the position of all axes");
2810 addUsage((std::string(
"[set] [rels] (")+args+
")").c_str(),
2811 "command the relative position of all axes");
2812 addUsage((std::string(
"[set] [vmos] (")+args+
")").c_str(),
2813 "command the velocity of all axes");
2815 addUsage(
"[set] [aen] $iAxisNumber",
"enable (amplifier for) the given axis");
2816 addUsage(
"[set] [adi] $iAxisNumber",
"disable (amplifier for) the given axis");
2817 addUsage(
"[get] [acu] $iAxisNumber",
"get current for the given axis");
2818 addUsage(
"[get] [acus]",
"get current for all axes");
2824 ControlBoardWrapper_p(nullptr),
2826 rpc_IPosCtrl(nullptr),
2827 rpc_IPosDirect(nullptr),
2828 rpc_IVelCtrl(nullptr),
2829 rpc_IEncTimed(nullptr),
2830 rpc_IMotEnc(nullptr),
2833 rpc_ITorque(nullptr),
2834 rpc_iCtrlMode(nullptr),
2835 rpc_AxisInfo(nullptr),
2836 rpc_IRemoteCalibrator(nullptr),
2837 rpc_Icalib(nullptr),
2838 rpc_IImpedance(nullptr),
2839 rpc_IInteract(nullptr),
2840 rpc_IMotor(nullptr),
2842 rpc_ICurrent(nullptr),
constexpr yarp::conf::vocab32_t VOCAB_PARK_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_REMOTE_CALIBRATOR_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_HOMING_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_PARK_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_QUIT_PARK
constexpr yarp::conf::vocab32_t VOCAB_IS_CALIBRATOR_PRESENT
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_HOMING_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_QUIT_CALIBRATE
constexpr yarp::conf::vocab32_t VOCAB_TIMESTAMP
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEED
constexpr yarp::conf::vocab32_t VOCAB_STOPS
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONE
constexpr yarp::conf::vocab32_t VOCAB_STOP
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONES
constexpr yarp::conf::vocab32_t VOCAB_PROTOCOL_VERSION
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVE
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVES
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVE
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVES
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVES
const yarp::os::LogComponent & CONTROLBOARDWRAPPER()
#define PROTOCOL_VERSION_TWEAK
#define PROTOCOL_VERSION_MAJOR
#define PROTOCOL_VERSION_MINOR
constexpr yarp::conf::vocab32_t VOCAB_LIM
constexpr yarp::conf::vocab32_t VOCAB_OUTPUTS
constexpr yarp::conf::vocab32_t VOCAB_ENABLE
constexpr yarp::conf::vocab32_t VOCAB_DISABLE
constexpr yarp::conf::vocab32_t VOCAB_OK
constexpr yarp::conf::vocab32_t VOCAB_REF
constexpr yarp::conf::vocab32_t VOCAB_IS
constexpr yarp::conf::vocab32_t VOCAB_ERRS
constexpr yarp::conf::vocab32_t VOCAB_GET
constexpr yarp::conf::vocab32_t VOCAB_OUTPUT
constexpr yarp::conf::vocab32_t VOCAB_REFERENCE
constexpr yarp::conf::vocab32_t VOCAB_FAILED
constexpr yarp::conf::vocab32_t VOCAB_ERR
constexpr yarp::conf::vocab32_t VOCAB_REFS
constexpr yarp::conf::vocab32_t VOCAB_REFERENCES
constexpr yarp::conf::vocab32_t VOCAB_RESET
constexpr yarp::conf::vocab32_t VOCAB_AXES
constexpr yarp::conf::vocab32_t VOCAB_SET
constexpr yarp::conf::vocab32_t VOCAB_OFFSET
constexpr yarp::conf::vocab32_t VOCAB_LIMS
constexpr yarp::conf::vocab32_t VOCAB_AMP_DISABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_PEAK_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_ENABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_VOLTAGE_SUPPLY
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_MAXCURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS_SINGLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS
constexpr yarp::conf::vocab32_t VOCAB_AMP_NOMINAL_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_PWM
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENTS
constexpr yarp::conf::vocab32_t VOCAB_AMP_PWM_LIMIT
constexpr yarp::conf::vocab32_t VOCAB_INFO_TYPE
constexpr yarp::conf::vocab32_t VOCAB_INFO_NAME
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_JOINT_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_DONE
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE
constexpr yarp::conf::vocab32_t VOCAB_PARK
constexpr yarp::conf::vocab32_t VOCAB_LIMITS
constexpr yarp::conf::vocab32_t VOCAB_VEL_LIMITS
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_CM_MIXED
constexpr yarp::conf::vocab32_t VOCAB_CM_TORQUE
constexpr yarp::conf::vocab32_t VOCAB_CM_PWM
constexpr yarp::conf::vocab32_t VOCAB_CM_IMPEDANCE_VEL
constexpr yarp::conf::vocab32_t VOCAB_CM_POSITION
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODES
constexpr yarp::conf::vocab32_t VOCAB_CM_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_CM_IMPEDANCE_POS
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODE
constexpr yarp::conf::vocab32_t VOCAB_CM_POSITION_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_ICONTROLMODE
constexpr yarp::conf::vocab32_t VOCAB_CM_VELOCITY
constexpr yarp::conf::vocab32_t VOCAB_CM_FORCE_IDLE
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF_GROUP
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REFS
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_RANGE
constexpr yarp::conf::vocab32_t VOCAB_CURRENTCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_RANGES
constexpr yarp::conf::vocab32_t VOCAB_E_RESET
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_ENCODER
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_E_RESETS
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_SPEED
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_ENCODERS
constexpr yarp::conf::vocab32_t VOCAB_IMPEDANCE
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODES
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODE
constexpr yarp::conf::vocab32_t VOCAB_INTERFACE_INTERACTION_MODE
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEED
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESETS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESET
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODERS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_CPR
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURES
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE_LIMIT
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE
constexpr yarp::conf::vocab32_t VOCAB_GEARBOX_RATIO
constexpr yarp::conf::vocab32_t VOCAB_MOTORS_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUTS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWMS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWM
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUT
constexpr yarp::conf::vocab32_t VOCAB_PIDS
constexpr yarp::conf::vocab32_t VOCAB_PID
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATION_GROUP
constexpr yarp::conf::vocab32_t VOCAB_STOP_GROUP
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEED_GROUP
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECTS
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT_GROUP
constexpr yarp::conf::vocab32_t VOCAB_LIST_VARIABLES
constexpr yarp::conf::vocab32_t VOCAB_VARIABLE
constexpr yarp::conf::vocab32_t VOCAB_REMOTE_VARIABILE_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_TORQUE
constexpr yarp::conf::vocab32_t VOCAB_TRQ
constexpr yarp::conf::vocab32_t VOCAB_TRQS
constexpr yarp::conf::vocab32_t VOCAB_RANGE
constexpr yarp::conf::vocab32_t VOCAB_IMP_OFFSET
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_IMP_PARAM
constexpr yarp::conf::vocab32_t VOCAB_RANGES
constexpr yarp::conf::vocab32_t VOCAB_TORQUE_MODE
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE_GROUP
void appendTimeStamp(Bottle &bot, Stamp &st)
void handleRemoteCalibratorMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
yarp::dev::IControlCalibration * rpc_Icalib
yarp::dev::IEncodersTimed * rpc_IEncTimed
yarp::dev::IControlMode * rpc_iCtrlMode
yarp::dev::IRemoteCalibrator * rpc_IRemoteCalibrator
void init(ControlBoardWrapper *x)
Initialization.
yarp::dev::IAxisInfo * rpc_AxisInfo
yarp::dev::ITorqueControl * rpc_ITorque
yarp::dev::IPidControl * rpc_IPid
void handleProtocolVersionRequest(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
void handlePWMMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
yarp::dev::IRemoteVariables * rpc_IVar
yarp::dev::IImpedanceControl * rpc_IImpedance
void handleCurrentMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
void handleInteractionModeMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
void handleControlModeMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
yarp::dev::IPositionDirect * rpc_IPosDirect
yarp::dev::ICurrentControl * rpc_ICurrent
void handleTorqueMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
yarp::dev::IMotorEncoders * rpc_IMotEnc
yarp::dev::IInteractionMode * rpc_IInteract
void handlePidMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
RPCMessagesParser()
Constructor.
virtual bool initialize()
Initialize the internal data.
yarp::dev::IPositionControl * rpc_IPosCtrl
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
yarp::dev::IVelocityControl * rpc_IVelCtrl
yarp::dev::IPWMControl * rpc_IPWM
yarp::dev::IAmplifierControl * rcp_IAmp
ControlBoardWrapper * ControlBoardWrapper_p
yarp::dev::IMotor * rpc_IMotor
yarp::dev::IControlLimits * rcp_Ilim
void handleImpedanceMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
void handleRemoteVariablesMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
Interface for control devices, amplifier commands.
Interface for getting information about specific axes, if available.
Interface for control devices, calibration commands.
Interface for control devices, commands to get/set position and veloity limits.
Interface for setting control mode in control board.
Interface for control boards implementing current control.
Control board, extend encoder interface with timestamps.
Interface for control boards implementing impedance control.
Interface settings the way the robot interacts with the environment: basic interaction types are Stif...
Control board, encoder interface.
Control board, encoder interface.
Interface for controlling an axis, by sending directly a PWM reference signal to a motor.
Interface for a generic control board device implementing a PID controller, with scaled arguments.
Interface for a generic control board device implementing position control.
Interface for a generic control board device implementing position control.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
IRemoteVariables interface.
Interface for control boards implementing torque control.
Interface for control boards implementing velocity control.
Contains the parameters for a PID.
double scale
scale for the pid output
double offset
pwm offset added to the pid output
double stiction_down_val
down stiction offset added to the pid output
double stiction_up_val
up stiction offset added to the pid output
double max_output
max output
double kff
feedforward gain
double ki
integrative gain
double max_int
saturation threshold for the integrator
double kp
proportional gain
A simple collection of objects that can be described and transmitted in a portable way.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
size_type size() const
Gets the number of elements in the bottle.
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Bottle tail() const
Get all but the first element of a bottle.
void clear()
Empties the bottle of any objects it contains.
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
An abstraction for a time stamp and/or sequence number.
double getTime() const
Get the time stamp.
int getCount() const
Get the sequence number.
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual Bottle * asList() const
Get list value.
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCTrace(component,...)
#define yCDebug(component,...)
An interface for the device drivers.
std::string decode(NetInt32 code)
Convert a vocabulary identifier into a string.
An interface to the operating system, including Port based communication.