56 if (!rpc_IImpedance) {
73 *ok = rpc_IImpedance->setImpedance(cmd.
get(3).
asInt32(), stiff, damp);
81 *ok = rpc_IImpedance->setImpedanceOffset(cmd.
get(3).
asInt32(), offs);
97 *ok = rpc_IImpedance->getImpedance(cmd.
get(3).
asInt32(), &stiff, &damp);
104 *ok = rpc_IImpedance->getImpedanceOffset(cmd.
get(3).
asInt32(), &offs);
110 double min_stiff = 0;
111 double max_stiff = 0;
114 *ok = rpc_IImpedance->getCurrentImpedanceLimit(cmd.
get(3).
asInt32(), &min_stiff, &max_stiff, &min_damp, &max_damp);
124 lastRpcStamp.update();
140 if (!(rpc_iCtrlMode)) {
141 yCError(
CONTROLBOARD,
"ControlBoardWrapper: I do not have a valid iControlMode interface");
162 *ok = rpc_iCtrlMode->setControlMode(axis, cmd.
get(4).
asVocab32());
164 yCError(
CONTROLBOARD) <<
"ControlBoardWrapper: Unable to handle setControlMode request! This should not happen!";
174 int* js =
new int[n_joints];
175 int* modes =
new int[n_joints];
177 for (
int i = 0; i < n_joints; i++) {
181 for (
int i = 0; i < n_joints; i++) {
185 *ok = rpc_iCtrlMode->setControlModes(n_joints, js, modes);
198 if (modeList->
size() != controlledJoints) {
199 yCError(
CONTROLBOARD,
"received an invalid setControlMode message. Size of vector doesn´t match the number of controlled joints");
203 int* modes =
new int[controlledJoints];
204 for (
size_t i = 0; i < controlledJoints; i++) {
208 *ok = rpc_iCtrlMode->setControlModes(modes);
221 yCError(
CONTROLBOARD) <<
" Error, received a set control mode message using a legacy version, trying to be handle the message anyway "
222 <<
" but please update your client to be compatible with the IControlMode interface";
257 yCError(
CONTROLBOARD) <<
"The 'impedancePosition' control mode is deprecated. \nUse setInteractionMode(axis, VOCAB_IM_COMPLIANT) + setControlMode(axis, VOCAB_CM_POSITION) instead";
261 yCError(
CONTROLBOARD) <<
"The 'impedanceVelocity' control mode is deprecated. \nUse setInteractionMode(axis, VOCAB_IM_COMPLIANT) + setControlMode(axis, VOCAB_CM_VELOCITY) instead";
266 *ok = rpc_iCtrlMode->setControlMode(axis,
VOCAB_CM_PWM);
318 int* p =
new int[controlledJoints];
319 for (
size_t i = 0; i < controlledJoints; ++i) {
323 *ok = rpc_iCtrlMode->getControlModes(p);
330 for (
size_t i = 0; i < controlledJoints; i++) {
344 *ok = rpc_iCtrlMode->getControlMode(axis, &p);
361 int* js =
new int[n_joints];
362 int* modes =
new int[n_joints];
363 for (
int i = 0; i < n_joints; i++) {
368 *ok = rpc_iCtrlMode->getControlModes(n_joints, js, modes);
377 for (
int i = 0; i < n_joints; i++) {
393 lastRpcStamp.update();
438 if (b->
size() != 4) {
439 yCError(
CONTROLBOARD,
"received a SET VOCAB_MOTOR_PARAMS command not understood, size!=4");
448 *ok = rpc_ITorque->setMotorTorqueParams(joint, params);
457 const size_t njs = b->
size();
458 if (njs == controlledJoints) {
459 auto* p =
new double[njs];
460 for (
size_t i = 0; i < njs; i++) {
463 *ok = rpc_ITorque->setRefTorques(p);
470 int* modes =
new int[controlledJoints];
471 for (
size_t i = 0; i < controlledJoints; i++) {
474 *ok = rpc_iCtrlMode->setControlModes(modes);
494 *ok = rpc_ITorque->getAxes(&tmp);
499 *ok = rpc_ITorque->getTorque(cmd.
get(3).
asInt32(), &dtmp);
508 *ok = rpc_ITorque->getMotorTorqueParams(joint, ¶ms);
519 *ok = rpc_ITorque->getTorqueRange(cmd.
get(3).
asInt32(), &dtmp, &dtmp2);
525 auto* p =
new double[controlledJoints];
526 *ok = rpc_ITorque->getTorques(p);
528 for (
size_t i = 0; i < controlledJoints; i++) {
535 auto* p1 =
new double[controlledJoints];
536 auto* p2 =
new double[controlledJoints];
537 *ok = rpc_ITorque->getTorqueRanges(p1, p2);
539 for (
size_t i = 0; i < controlledJoints; i++) {
543 for (
size_t i = 0; i < controlledJoints; i++) {
551 *ok = rpc_ITorque->getRefTorque(cmd.
get(3).
asInt32(), &dtmp);
556 auto* p =
new double[controlledJoints];
557 *ok = rpc_ITorque->getRefTorques(p);
559 for (
size_t i = 0; i < controlledJoints; i++) {
566 lastRpcStamp.update();
578 if (!rpc_IInteract) {
602 auto n_joints =
static_cast<size_t>(cmd.
get(3).
asInt32());
605 if ((jointList->
size() != n_joints) || (modeList->
size() != n_joints)) {
606 yCWarning(
CONTROLBOARD,
"Received an invalid setInteractionMode message. Size of vectors doesn´t match");
610 int* joints =
new int[n_joints];
612 for (
size_t i = 0; i < n_joints; i++) {
617 *ok = rpc_IInteract->setInteractionModes(n_joints, joints, modes);
627 if (modeList->
size() != controlledJoints) {
628 yCWarning(
CONTROLBOARD,
"Received an invalid setInteractionMode message. Size of vector doesn´t match the number of controlled joints");
633 for (
size_t i = 0; i < controlledJoints; i++) {
636 *ok = rpc_IInteract->setInteractionModes(modes);
655 *ok = rpc_IInteract->getInteractionMode(cmd.
get(3).
asInt32(), &mode);
665 if (jointList->
size() !=
static_cast<size_t>(n_joints)) {
666 yCError(
CONTROLBOARD,
"Received an invalid getInteractionMode message. Size of vectors doesn´t match");
670 int* joints =
new int[n_joints];
672 for (
int i = 0; i < n_joints; i++) {
675 *ok = rpc_IInteract->getInteractionModes(n_joints, joints, modes);
678 for (
int i = 0; i < n_joints; i++) {
692 *ok = rpc_IInteract->getInteractionModes(modes);
695 for (
size_t i = 0; i < controlledJoints; i++) {
704 lastRpcStamp.update();
709 yCError(
CONTROLBOARD,
"Error while Handling IInteractionMode message, command was not SET nor GET");
720 yCError(
CONTROLBOARD,
"controlBoardWrapper: I do not have a valid ICurrentControl interface");
767 *ok = rpc_ICurrent->getRefCurrent(cmd.
get(3).
asInt32(), &dtmp);
772 auto* p =
new double[controlledJoints];
773 *ok = rpc_ICurrent->getRefCurrents(p);
775 for (
size_t i = 0; i < controlledJoints; i++) {
783 *ok = rpc_ICurrent->getCurrentRange(cmd.
get(3).
asInt32(), &dtmp, &dtmp2);
789 auto* p1 =
new double[controlledJoints];
790 auto* p2 =
new double[controlledJoints];
791 *ok = rpc_ICurrent->getCurrentRanges(p1, p2);
794 for (
size_t i = 0; i < controlledJoints; i++) {
797 for (
size_t i = 0; i < controlledJoints; i++) {
848 *ok = rpc_IPid->setPidOffset(pidtype, j, v);
870 *ok = rpc_IPid->setPid(pidtype, j, p);
880 const size_t njs = b->
size();
881 if (njs == controlledJoints) {
886 for (
size_t i = 0; i < njs; i++) {
904 *ok = rpc_IPid->setPids(pidtype, p);
924 const size_t njs = b->
size();
925 if (njs == controlledJoints) {
926 auto* p =
new double[njs];
927 for (
size_t i = 0; i < njs; i++) {
930 *ok = rpc_IPid->setPidReferences(pidtype, p);
946 const size_t njs = b->
size();
947 if (njs == controlledJoints) {
948 auto* p =
new double[njs];
949 for (
size_t i = 0; i < njs; i++) {
952 *ok = rpc_IPid->setPidErrorLimits(pidtype, p);
958 *ok = rpc_IPid->resetPid(pidtype, cmd.
get(4).
asInt32());
962 *ok = rpc_IPid->disablePid(pidtype, cmd.
get(4).
asInt32());
966 *ok = rpc_IPid->enablePid(pidtype, cmd.
get(4).
asInt32());
980 auto* p =
new double[controlledJoints];
981 *ok = rpc_IPid->getPidErrorLimits(pidtype, p);
983 for (
size_t i = 0; i < controlledJoints; i++) {
990 bool booltmp =
false;
991 *ok = rpc_IPid->isPidEnabled(pidtype, cmd.
get(4).
asInt32(), &booltmp);
996 *ok = rpc_IPid->getPidError(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1001 auto* p =
new double[controlledJoints];
1002 *ok = rpc_IPid->getPidErrors(pidtype, p);
1004 for (
size_t i = 0; i < controlledJoints; i++) {
1011 *ok = rpc_IPid->getPidOutput(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1016 auto* p =
new double[controlledJoints];
1017 *ok = rpc_IPid->getPidOutputs(pidtype, p);
1019 for (
size_t i = 0; i < controlledJoints; i++) {
1027 *ok = rpc_IPid->getPid(pidtype, cmd.
get(4).
asInt32(), &p);
1042 Pid* p =
new Pid[controlledJoints];
1043 *ok = rpc_IPid->getPids(pidtype, p);
1045 for (
size_t i = 0; i < controlledJoints; i++) {
1062 *ok = rpc_IPid->getPidReference(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1067 auto* p =
new double[controlledJoints];
1068 *ok = rpc_IPid->getPidReferences(pidtype, p);
1070 for (
size_t i = 0; i < controlledJoints; i++) {
1077 *ok = rpc_IPid->getPidErrorLimit(pidtype, cmd.
get(4).
asInt32(), &dtmp);
1097 yCError(
CONTROLBOARD,
"controlBoardWrapper: I do not have a valid IPWMControl interface");
1132 response.
add(cmd.
get(1));
1136 *ok = rpc_IPWM->getRefDutyCycle(cmd.
get(3).
asInt32(), &dtmp);
1141 auto* p =
new double[controlledJoints];
1142 *ok = rpc_IPWM->getRefDutyCycles(p);
1144 for (
size_t i = 0; i < controlledJoints; i++) {
1151 *ok = rpc_IPWM->getDutyCycle(cmd.
get(3).
asInt32(), &dtmp);
1156 auto* p =
new double[controlledJoints];
1157 *ok = rpc_IPWM->getRefDutyCycles(p);
1159 for (
size_t i = 0; i < controlledJoints; i++) {
1186 if (!rpc_IRemoteCalibrator) {
1187 yCError(
CONTROLBOARD,
"controlBoardWrapper: I do not have a valid IRemoteCalibrator interface");
1203 *ok = rpc_IVar->setRemoteVariable(cmd.
get(3).
asString(), btail);
1219 response.
add(cmd.
get(1));
1224 *ok = rpc_IVar->getRemoteVariable(cmd.
get(3).
asString(), btmp);
1230 *ok = rpc_IVar->getRemoteVariablesList(&btmp);
1243 if (!rpc_IRemoteCalibrator) {
1244 yCError(
CONTROLBOARD,
"controlBoardWrapper: I do not have a valid IRemoteCalibrator interface");
1260 *ok = rpc_IRemoteCalibrator->calibrateSingleJoint(cmd.
get(3).
asInt32());
1265 *ok = rpc_IRemoteCalibrator->calibrateWholePart();
1270 *ok = rpc_IRemoteCalibrator->homingSingleJoint(cmd.
get(3).
asInt32());
1276 *ok = rpc_IRemoteCalibrator->homingWholePart();
1281 *ok = rpc_IRemoteCalibrator->parkSingleJoint(cmd.
get(3).
asInt32());
1286 *ok = rpc_IRemoteCalibrator->parkWholePart();
1291 *ok = rpc_IRemoteCalibrator->quitCalibrate();
1296 *ok = rpc_IRemoteCalibrator->quitPark();
1310 response.
add(cmd.
get(1));
1316 *ok = rpc_IRemoteCalibrator->isCalibratorDevicePresent(&tmp);
1335 if (cmd.
size() < 2) {
1340 handlePidMsg(cmd, response, &rec, &ok);
1344 handleTorqueMsg(cmd, response, &rec, &ok);
1348 handleControlModeMsg(cmd, response, &rec, &ok);
1352 handleImpedanceMsg(cmd, response, &rec, &ok);
1356 handleInteractionModeMsg(cmd, response, &rec, &ok);
1360 handleProtocolVersionRequest(cmd, response, &rec, &ok);
1364 handleRemoteCalibratorMsg(cmd, response, &rec, &ok);
1368 handleRemoteVariablesMsg(cmd, response, &rec, &ok);
1372 handleCurrentMsg(cmd, response, &rec, &ok);
1376 handlePWMMsg(cmd, response, &rec, &ok);
1391 if (rpc_Icalib ==
nullptr) {
1394 ok = rpc_Icalib->calibrateAxisWithParams(j, ui, v1, v2, v3);
1409 if (rpc_Icalib ==
nullptr) {
1412 ok = rpc_Icalib->setCalibrationParameters(j, params);
1419 ok = rpc_Icalib->calibrateRobot();
1426 ok = rpc_Icalib->calibrationDone(j);
1433 ok = rpc_Icalib->park(flag ?
true :
false);
1452 const size_t njs = b->
size();
1453 if (njs != controlledJoints) {
1456 tmpVect.resize(njs);
1457 for (
size_t i = 0; i < njs; i++) {
1461 if (rpc_IPosCtrl !=
nullptr) {
1462 ok = rpc_IPosCtrl->positionMove(&tmpVect[0]);
1467 auto len =
static_cast<size_t>(cmd.
get(2).
asInt32());
1471 if (rpc_IPosCtrl ==
nullptr) {
1475 if (jlut ==
nullptr || pos_val ==
nullptr) {
1478 if (len != jlut->
size() || len != pos_val->
size()) {
1482 auto* j_tmp =
new int[len];
1483 auto* pos_tmp =
new double[len];
1484 for (
size_t i = 0; i < len; i++) {
1489 ok = rpc_IPosCtrl->positionMove(len, j_tmp, pos_tmp);
1501 const size_t njs = b->
size();
1502 if (njs != controlledJoints) {
1505 tmpVect.resize(njs);
1506 for (
size_t i = 0; i < njs; i++) {
1509 if (rpc_IVelCtrl !=
nullptr) {
1510 ok = rpc_IVelCtrl->velocityMove(&tmpVect[0]);
1520 auto len =
static_cast<size_t>(cmd.
get(2).
asInt32());
1524 if (rpc_IPosCtrl ==
nullptr) {
1528 if (jBottle_p ==
nullptr || posBottle_p ==
nullptr) {
1531 if (len != jBottle_p->
size() || len != posBottle_p->
size()) {
1535 int* j_tmp =
new int[len];
1536 auto* pos_tmp =
new double[len];
1538 for (
size_t i = 0; i < len; i++) {
1542 for (
size_t i = 0; i < len; i++) {
1546 ok = rpc_IPosCtrl->relativeMove(len, j_tmp, pos_tmp);
1559 const size_t njs = b->
size();
1560 if (njs != controlledJoints) {
1563 auto* p =
new double[njs];
1564 for (
size_t i = 0; i < njs; i++) {
1567 ok = rpc_IPosCtrl->relativeMove(p);
1576 auto len =
static_cast<size_t>(cmd.
get(2).
asInt32());
1580 if (rpc_IPosCtrl ==
nullptr) {
1584 if (jBottle_p ==
nullptr || velBottle_p ==
nullptr) {
1587 if (len != jBottle_p->
size() || len != velBottle_p->
size()) {
1591 int* j_tmp =
new int[len];
1592 auto* spds_tmp =
new double[len];
1594 for (
size_t i = 0; i < len; i++) {
1598 for (
size_t i = 0; i < len; i++) {
1602 ok = rpc_IPosCtrl->setRefSpeeds(len, j_tmp, spds_tmp);
1614 const size_t njs = b->
size();
1615 if (njs != controlledJoints) {
1618 auto* p =
new double[njs];
1619 for (
size_t i = 0; i < njs; i++) {
1622 ok = rpc_IPosCtrl->setRefSpeeds(p);
1631 auto len =
static_cast<size_t>(cmd.
get(2).
asInt32());
1635 if (rpc_IPosCtrl ==
nullptr) {
1639 if (jBottle_p ==
nullptr || accBottle_p ==
nullptr) {
1642 if (len != jBottle_p->
size() || len != accBottle_p->
size()) {
1646 int* j_tmp =
new int[len];
1647 auto* accs_tmp =
new double[len];
1649 for (
size_t i = 0; i < len; i++) {
1653 for (
size_t i = 0; i < len; i++) {
1657 ok = rpc_IPosCtrl->setRefAccelerations(len, j_tmp, accs_tmp);
1669 const size_t njs = b->
size();
1670 if (njs != controlledJoints) {
1673 auto* p =
new double[njs];
1674 for (
size_t i = 0; i < njs; i++) {
1677 ok = rpc_IPosCtrl->setRefAccelerations(p);
1682 ok = rpc_IPosCtrl->stop(cmd.
get(2).
asInt32());
1686 auto len =
static_cast<size_t>(cmd.
get(2).
asInt32());
1689 if (rpc_IPosCtrl ==
nullptr) {
1693 if (jBottle_p ==
nullptr) {
1696 if (len != jBottle_p->
size()) {
1700 int* j_tmp =
new int[len];
1702 for (
size_t i = 0; i < len; i++) {
1706 ok = rpc_IPosCtrl->stop(len, j_tmp);
1711 ok = rpc_IPosCtrl->stop();
1715 ok = rpc_IEncTimed->resetEncoder(cmd.
get(2).
asInt32());
1719 ok = rpc_IEncTimed->resetEncoders();
1733 const size_t njs = b->
size();
1734 if (njs != controlledJoints) {
1737 auto* p =
new double[njs];
1738 for (
size_t i = 0; i < njs; i++) {
1741 ok = rpc_IEncTimed->setEncoders(p);
1750 ok = rpc_IMotEnc->resetMotorEncoder(cmd.
get(2).
asInt32());
1754 ok = rpc_IMotEnc->resetMotorEncoders();
1768 const size_t njs = b->
size();
1769 if (njs != controlledJoints) {
1772 auto* p =
new double[njs];
1773 for (
size_t i = 0; i < njs; i++) {
1776 ok = rpc_IMotEnc->setMotorEncoders(p);
1781 ok = rcp_IAmp->enableAmp(cmd.
get(2).
asInt32());
1785 ok = rcp_IAmp->disableAmp(cmd.
get(2).
asInt32());
1836 response.
add(cmd.
get(1));
1841 ok = rpc_IMotor->getTemperatureLimit(cmd.
get(2).
asInt32(), &dtmp);
1846 ok = rpc_IMotor->getTemperature(cmd.
get(2).
asInt32(), &dtmp);
1851 ok = rpc_IMotor->getGearboxRatio(cmd.
get(2).
asInt32(), &dtmp);
1856 auto* p =
new double[controlledJoints];
1857 ok = rpc_IMotor->getTemperatures(p);
1859 for (
size_t i = 0; i < controlledJoints; i++) {
1866 ok = rcp_IAmp->getMaxCurrent(cmd.
get(2).
asInt32(), &dtmp);
1872 ok = rpc_IPosCtrl->getTargetPosition(cmd.
get(2).
asInt32(), &dtmp);
1881 int* jointList =
new int[len];
1882 auto* refs =
new double[len];
1884 for (
int j = 0; j < len; j++) {
1887 ok = rpc_IPosCtrl->getTargetPositions(len, jointList, refs);
1890 for (
int i = 0; i < len; i++) {
1899 auto* refs =
new double[controlledJoints];
1900 ok = rpc_IPosCtrl->getTargetPositions(refs);
1902 for (
size_t i = 0; i < controlledJoints; i++) {
1910 ok = rpc_IPosDirect->getRefPosition(cmd.
get(2).
asInt32(), &dtmp);
1919 int* jointList =
new int[len];
1920 auto* refs =
new double[len];
1922 for (
int j = 0; j < len; j++) {
1925 ok = rpc_IPosDirect->getRefPositions(len, jointList, refs);
1928 for (
int i = 0; i < len; i++) {
1937 auto* refs =
new double[controlledJoints];
1938 ok = rpc_IPosDirect->getRefPositions(refs);
1940 for (
size_t i = 0; i < controlledJoints; i++) {
1948 ok = rpc_IVelCtrl->getRefVelocity(cmd.
get(2).
asInt32(), &dtmp);
1959 int* jointList =
new int[len];
1960 auto* refs =
new double[len];
1962 for (
int j = 0; j < len; j++) {
1965 ok = rpc_IVelCtrl->getRefVelocities(len, jointList, refs);
1968 for (
int i = 0; i < len; i++) {
1979 auto* refs =
new double[controlledJoints];
1980 ok = rpc_IVelCtrl->getRefVelocities(refs);
1982 for (
size_t i = 0; i < controlledJoints; i++) {
1990 ok = rpc_IMotor->getNumberOfMotors(&tmp);
1996 ok = rpc_IPosCtrl->getAxes(&tmp);
2003 ok = rpc_IPosCtrl->checkMotionDone(cmd.
get(2).
asInt32(), &x);
2011 int* jointList =
new int[len];
2012 for (
int j = 0; j < len; j++) {
2015 if (rpc_IPosCtrl !=
nullptr) {
2016 ok = rpc_IPosCtrl->checkMotionDone(len, jointList, &x);
2025 ok = rpc_IPosCtrl->checkMotionDone(&x);
2030 ok = rpc_IPosCtrl->getRefSpeed(cmd.
get(2).
asInt32(), &dtmp);
2037 int* jointList =
new int[len];
2038 auto* speeds =
new double[len];
2040 for (
int j = 0; j < len; j++) {
2043 ok = rpc_IPosCtrl->getRefSpeeds(len, jointList, speeds);
2046 for (
int i = 0; i < len; i++) {
2055 auto* p =
new double[controlledJoints];
2056 ok = rpc_IPosCtrl->getRefSpeeds(p);
2058 for (
size_t i = 0; i < controlledJoints; i++) {
2065 ok = rpc_IPosCtrl->getRefAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2072 int* jointList =
new int[len];
2073 auto* accs =
new double[len];
2075 for (
int j = 0; j < len; j++) {
2078 ok = rpc_IPosCtrl->getRefAccelerations(len, jointList, accs);
2081 for (
int i = 0; i < len; i++) {
2090 auto* p =
new double[controlledJoints];
2091 ok = rpc_IPosCtrl->getRefAccelerations(p);
2093 for (
size_t i = 0; i < controlledJoints; i++) {
2100 ok = rpc_IEncTimed->getEncoder(cmd.
get(2).
asInt32(), &dtmp);
2105 auto* p =
new double[controlledJoints];
2106 ok = rpc_IEncTimed->getEncoders(p);
2108 for (
size_t i = 0; i < controlledJoints; i++) {
2115 ok = rpc_IEncTimed->getEncoderSpeed(cmd.
get(2).
asInt32(), &dtmp);
2120 auto* p =
new double[controlledJoints];
2121 ok = rpc_IEncTimed->getEncoderSpeeds(p);
2123 for (
size_t i = 0; i < controlledJoints; i++) {
2130 ok = rpc_IEncTimed->getEncoderAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2135 auto* p =
new double[controlledJoints];
2136 ok = rpc_IEncTimed->getEncoderAccelerations(p);
2138 for (
size_t i = 0; i < controlledJoints; i++) {
2145 ok = rpc_IMotEnc->getMotorEncoderCountsPerRevolution(cmd.
get(2).
asInt32(), &dtmp);
2150 ok = rpc_IMotEnc->getMotorEncoder(cmd.
get(2).
asInt32(), &dtmp);
2155 auto* p =
new double[controlledJoints];
2156 ok = rpc_IMotEnc->getMotorEncoders(p);
2158 for (
size_t i = 0; i < controlledJoints; i++) {
2165 ok = rpc_IMotEnc->getMotorEncoderSpeed(cmd.
get(2).
asInt32(), &dtmp);
2170 auto* p =
new double[controlledJoints];
2171 ok = rpc_IMotEnc->getMotorEncoderSpeeds(p);
2173 for (
size_t i = 0; i < controlledJoints; i++) {
2180 ok = rpc_IMotEnc->getMotorEncoderAcceleration(cmd.
get(2).
asInt32(), &dtmp);
2185 auto* p =
new double[controlledJoints];
2186 ok = rpc_IMotEnc->getMotorEncoderAccelerations(p);
2188 for (
size_t i = 0; i < controlledJoints; i++) {
2196 ok = rpc_IMotEnc->getNumberOfMotorEncoders(&num);
2201 ok = rcp_IAmp->getCurrent(cmd.
get(2).
asInt32(), &dtmp);
2206 auto* p =
new double[controlledJoints];
2207 ok = rcp_IAmp->getCurrents(p);
2209 for (
size_t i = 0; i < controlledJoints; i++) {
2216 int* p =
new int[controlledJoints];
2217 ok = rcp_IAmp->getAmpStatus(p);
2219 for (
size_t i = 0; i < controlledJoints; i++) {
2228 ok = rcp_IAmp->getAmpStatus(j, &itmp);
2234 ok = rcp_IAmp->getNominalCurrent(m, &dtmp);
2240 ok = rcp_IAmp->getPeakCurrent(m, &dtmp);
2246 ok = rcp_IAmp->getPWM(m, &dtmp);
2253 ok = rcp_IAmp->getPWMLimit(m, &dtmp);
2259 ok = rcp_IAmp->getPowerSupplyVoltage(m, &dtmp);
2266 ok = rcp_Ilim->getLimits(cmd.
get(2).
asInt32(), &min, &max);
2274 ok = rcp_Ilim->getVelLimits(cmd.
get(2).
asInt32(), &min, &max);
2280 std::string name =
"undocumented";
2281 ok = rpc_AxisInfo->getAxisName(cmd.
get(2).
asInt32(), name);
2287 ok = rpc_AxisInfo->getJointType(cmd.
get(2).
asInt32(), type);
2297 lastRpcStamp.update();
2305 ok = DeviceResponder::respond(cmd, response);
2326 ok = rpc_IPosCtrl->getAxes(&tmp_axes);
2327 controlledJoints =
static_cast<size_t>(tmp_axes);
2330 DeviceResponder::makeUsage();
2331 addUsage(
"[get] [axes]",
"get the number of axes");
2332 addUsage(
"[get] [name] $iAxisNumber",
"get a human-readable name for an axis, if available");
2333 addUsage(
"[set] [pos] $iAxisNumber $fPosition",
"command the position of an axis");
2334 addUsage(
"[set] [rel] $iAxisNumber $fPosition",
"command the relative position of an axis");
2335 addUsage(
"[set] [vmo] $iAxisNumber $fVelocity",
"command the velocity of an axis");
2336 addUsage(
"[get] [enc] $iAxisNumber",
"get the encoder value for an axis");
2339 for (
size_t i = 0; i < controlledJoints; i++) {
2346 addUsage((std::string(
"[set] [poss] (") + args +
")").c_str(),
2347 "command the position of all axes");
2348 addUsage((std::string(
"[set] [rels] (") + args +
")").c_str(),
2349 "command the relative position of all axes");
2350 addUsage((std::string(
"[set] [vmos] (") + args +
")").c_str(),
2351 "command the velocity of all axes");
2353 addUsage(
"[set] [aen] $iAxisNumber",
"enable (amplifier for) the given axis");
2354 addUsage(
"[set] [adi] $iAxisNumber",
"disable (amplifier for) the given axis");
2355 addUsage(
"[get] [acu] $iAxisNumber",
"get current for the given axis");
2356 addUsage(
"[get] [acus]",
"get current for all axes");
2364 x->
view(rpc_IPosCtrl);
2365 x->
view(rpc_IPosDirect);
2366 x->
view(rpc_IVelCtrl);
2367 x->
view(rpc_IEncTimed);
2368 x->
view(rpc_IMotEnc);
2369 x->
view(rpc_IMotor);
2373 x->
view(rpc_AxisInfo);
2374 x->
view(rpc_IRemoteCalibrator);
2375 x->
view(rpc_Icalib);
2376 x->
view(rpc_IImpedance);
2377 x->
view(rpc_ITorque);
2378 x->
view(rpc_iCtrlMode);
2379 x->
view(rpc_IInteract);
2380 x->
view(rpc_ICurrent);
2382 controlledJoints = 0;
2388 rpc_IPosCtrl =
nullptr;
2389 rpc_IPosDirect =
nullptr;
2390 rpc_IVelCtrl =
nullptr;
2391 rpc_IEncTimed =
nullptr;
2392 rpc_IMotEnc =
nullptr;
2393 rpc_IMotor =
nullptr;
2397 rpc_AxisInfo =
nullptr;
2398 rpc_IRemoteCalibrator =
nullptr;
2399 rpc_Icalib =
nullptr;
2400 rpc_IImpedance =
nullptr;
2401 rpc_ITorque =
nullptr;
2402 rpc_iCtrlMode =
nullptr;
2403 rpc_IInteract =
nullptr;
2404 rpc_ICurrent =
nullptr;
2406 controlledJoints = 0;
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
const yarp::os::LogComponent & CONTROLBOARD()
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
constexpr int PROTOCOL_VERSION_TWEAK
constexpr int PROTOCOL_VERSION_MINOR
constexpr int PROTOCOL_VERSION_MAJOR
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)
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)
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)
void init(yarp::dev::DeviceDriver *x)
Initialization.
void handleTorqueMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
void handlePidMsg(const yarp::os::Bottle &cmd, yarp::os::Bottle &response, bool *rec, bool *ok)
virtual bool initialize()
Initialize the internal data.
bool respond(const yarp::os::Bottle &cmd, yarp::os::Bottle &response) override
Respond to a message.
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 implemented by all device drivers.
bool view(T *&x)
Get an interface to the device driver.
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.
void addVocab32(yarp::conf::vocab32_t x)
Places a vocabulary item in 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.
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 yarp::conf::vocab32_t asVocab32() const
Get vocabulary identifier as an integer.
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual Bottle * asList() const
Get list value.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(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.