33 _verb = (prop.
check(
"verbose",
"if present, give detailed output"));
39 if(!parseOptions(prop))
47bool ControlBoardRemapper::parseOptions(
Property& prop)
51 usingAxesNamesForAttachAll = prop.
check(
"axesNames",
"list of networks merged by this wrapper");
52 usingNetworksForAttachAll = prop.
check(
"networks",
"list of networks merged by this wrapper");
55 if( usingAxesNamesForAttachAll &&
56 usingNetworksForAttachAll )
62 if( !usingAxesNamesForAttachAll &&
63 !usingNetworksForAttachAll )
69 if( usingAxesNamesForAttachAll )
71 ok = parseAxesNames(prop);
74 if( usingNetworksForAttachAll )
76 ok = parseNetworks(prop);
82bool ControlBoardRemapper::parseAxesNames(
const Property& prop)
97 this->setNrOfControlledAxes(axesNames.size());
102bool ControlBoardRemapper::parseNetworks(
const Property& prop)
111 if (!prop.
check(
"joints",
"number of joints of the part"))
117 this->setNrOfControlledAxes((
size_t)prop.
find(
"joints").
asInt32());
120 remappedControlBoards.
lut.resize(controlledJoints);
124 for(
size_t k=0;
k<
nets->size();
k++)
134 if(parameters.
size()==2)
147 <<
"Check network parameters in part description"
148 <<
"--> I was expecting" <<
nets->get(
k).asString() <<
"followed by a list of four integers in parenthesis"
164 else if (parameters.
size()==5)
175 <<
"Check network parameters in part description"
176 <<
"--> I was expecting" <<
nets->get(
k).asString() <<
"followed by a list of four integers in parenthesis"
187 <<
"Check network parameters in network " <<
nets->get(
k).asString().c_str()
188 <<
"I was expecting a well form quadruple of numbers, got instead: "<< parameters.
toString().c_str();
196 remappedControlBoards.
lut[
j].subControlBoardIndex=
k;
197 remappedControlBoards.
lut[
j].axisIndexInSubControlBoard=base+
off;
212bool ControlBoardRemapper::updateAxesName()
215 axesNames.resize(controlledJoints);
217 for(
int l=0;
l < controlledJoints;
l++)
238 if( usingAxesNamesForAttachAll )
240 ok = attachAllUsingAxesNames(
polylist);
243 if( usingNetworksForAttachAll )
245 ok = attachAllUsingNetworks(
polylist);
252 if (!remappedControlBoards.
subdevices[
k].isAttached())
296 polylist[p]->poly->view(calibrator);
341 <<
"multiple axes have the same name" <<
axName
343 <<
"and another on device" <<
it->second.subDeviceKey <<
"with index" <<
it->second.indexInSubDevice;
363 for(
const auto&
axesName : axesNames)
370 <<
"specified in axesNames was not found in the axes of the controlboards passed to attachAll, attachAll failed.";
386 assert(controlledJoints == (
int) axesNames.size());
390 remappedControlBoards.
lut.resize(controlledJoints);
409 for(
size_t l=0;
l < axesNames.size();
l++)
425 std::string subDeviceKey =
polylist[p]->key;
426 if(subDeviceKey ==
"Calibrator" || subDeviceKey ==
"calibrator")
430 polylist[p]->poly->view(calibrator);
440 if (remappedControlBoards.
subdevices[
k].id==subDeviceKey)
451 bool ok = updateAxesName();
466 for (
int k = 0;
k < devices;
k++) {
474void ControlBoardRemapper::configureBuffers()
476 allJointsBuffers.
configure(remappedControlBoards);
477 selectedJointsBuffers.
configure(remappedControlBoards);
481bool ControlBoardRemapper::setControlModeAllAxes(
const int cm)
483 std::lock_guard<std::mutex> lock(buffers.
mutex);
485 for(
int j=0;
j < controlledJoints;
j++)
502 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
503 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
523 for(
int l=0;
l<controlledJoints;
l++)
525 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
527 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
550 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
551 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
572 for(
int l=0;
l<controlledJoints;
l++)
574 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
576 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
599 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
600 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
620 for(
int l=0;
l<controlledJoints;
l++)
622 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
624 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
647 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
648 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
669 for(
int l=0;
l<controlledJoints;
l++)
671 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
672 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
695 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
696 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
716 for(
int l=0;
l<controlledJoints;
l++)
718 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
720 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
742 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
743 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
761 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
762 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
782 for(
int l=0;
l<controlledJoints;
l++)
784 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
785 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
809 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
810 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
830 for(
int l=0;
l<controlledJoints;
l++)
832 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
834 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
857 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
858 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
878 for(
int l=0;
l<controlledJoints;
l++)
880 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
882 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
906 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
907 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
926 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
927 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
941 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
942 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
961 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
962 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
982 *
ax=controlledJoints;
988 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
989 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1009 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1035 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1060 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1061 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1082 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1113 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1145 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1146 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1166 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1191 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1215 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1216 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1238 for(
int l=0;
l<controlledJoints;
l++)
1240 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1241 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1270 for(
int j=0;
j<n_joints;
j++)
1274 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1275 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1302 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1303 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1323 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1349 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1374 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1375 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1395 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1421 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1446 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1447 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1467 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1497 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1529 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1530 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1550 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1580 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1611 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1612 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1632 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1652 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
1653 std::lock_guard<std::mutex>
lock2(buffers.
mutex);
1679 int off = (
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1680 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
1701 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1702 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1722 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
1748 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1749 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1769 for(
int l=0;
l<controlledJoints;
l++)
1771 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1772 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1795 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1796 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1817 for(
int l=0;
l<controlledJoints;
l++)
1819 int off = (
int) remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1820 size_t subIndex = remappedControlBoards.
lut[
l].subControlBoardIndex;
1844 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1845 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1866 for(
int l=0;
l<controlledJoints;
l++)
1868 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1869 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1895 for(
int l=0;
l<controlledJoints;
l++)
1897 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1898 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1922 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1923 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1942 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1943 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
1964 for(
int l=0;
l<controlledJoints;
l++)
1966 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
1967 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
1991 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
1992 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2013 for(
int l=0;
l<controlledJoints;
l++)
2015 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2016 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2041 *
num=controlledJoints;
2047 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2048 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2068 for(
int l=0;
l<controlledJoints;
l++)
2070 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2071 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2093 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2094 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2113 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2114 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2133 int off = (
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2134 size_t subIndex = remappedControlBoards.
lut[
m].subControlBoardIndex;
2153 int off = (
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2154 size_t subIndex = remappedControlBoards.
lut[
m].subControlBoardIndex;
2243 size_t subIndex = remappedControlBoards.
lut[0].subControlBoardIndex;
2263 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2264 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2285 for(
int l=0;
l<controlledJoints;
l++)
2287 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2288 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2312 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2313 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2334 for(
int l=0;
l<controlledJoints;
l++)
2336 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2337 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2362 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2363 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2382 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2383 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2402 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2403 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2424 for(
int l=0;
l<controlledJoints;
l++)
2426 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2427 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2448 for(
int l=0;
l<controlledJoints;
l++)
2450 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2451 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2475 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2476 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2495 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2496 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2517 for(
int l=0;
l<controlledJoints;
l++)
2519 int off = (
int) remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2520 size_t subIndex = remappedControlBoards.
lut[
l].subControlBoardIndex;
2544 int off = (
int) remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2545 size_t subIndex = remappedControlBoards.
lut[
m].subControlBoardIndex;
2566 for(
int l=0;
l<controlledJoints;
l++)
2568 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2569 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2595 *
num=controlledJoints;
2602 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2603 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2629 for(
int l=0;
l<controlledJoints;
l++)
2631 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
2632 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
2657 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2658 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2677 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2678 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2697 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2698 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2717 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2718 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2737 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2738 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2757 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2758 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2777 int off = (
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2778 size_t subIndex = remappedControlBoards.
lut[
m].subControlBoardIndex;
2797 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2798 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2816 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2817 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2836 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2837 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2856 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
2857 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
2879 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2880 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2899 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2900 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2919 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2920 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2939 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2940 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
2972 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
2973 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3024 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3025 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3051 for(
int l=0;
l<controlledJoints;
l++)
3069 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3070 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3097 for(
int l=0;
l<controlledJoints;
l++)
3168 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3169 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3182 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3183 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3197 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3198 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3231 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3232 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3251 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3252 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3273 for(
int l=0;
l<controlledJoints;
l++)
3275 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
3276 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
3300 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3301 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3320 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
3349 int off = (
int) remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3350 size_t subIndex = remappedControlBoards.
lut[
j].subControlBoardIndex;
3368 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
3387 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3388 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3407 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3408 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3427 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3428 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3447 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3448 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3467 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3468 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3489 for(
int l=0;
l<controlledJoints;
l++)
3491 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
3492 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
3517 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3518 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3539 for(
int l=0;
l<controlledJoints;
l++)
3541 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
3542 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
3566 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3567 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3586 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3587 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3606 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3607 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3626 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3627 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3650 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
3681 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
3715 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3716 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3740 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
3766 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
3791 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3792 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3812 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
3838 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
3866 for(
int l=0;
l<controlledJoints;
l++)
3868 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
3885 std::lock_guard<std::mutex> lock(buffers.
mutex);
3896 return buffers.
stamp;
3901 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
3902 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
3923 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
3954 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
3990 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
4016 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
4017 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
4039 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
4069 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
4101 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
4102 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
4122 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
4155 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
4184 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
4185 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
4205 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
4225 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
4246 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4252 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4263 for(
int l=0;
l<controlledJoints;
l++)
4265 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4266 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
4293 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4299 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4310 for(
int l=0;
l<controlledJoints;
l++)
4312 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4313 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
4340 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4346 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4357 for(
int l=0;
l<controlledJoints;
l++)
4359 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4360 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
4387 size_t subIndex=remappedControlBoards.
lut[
j].subControlBoardIndex;
4393 int off=(
int)remappedControlBoards.
lut[
j].axisIndexInSubControlBoard;
4404 for(
int l=0;
l<controlledJoints;
l++)
4406 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4407 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
4434 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4440 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4451 for(
int l=0;
l<controlledJoints;
l++)
4453 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4454 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
4481 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4487 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4497 std::lock_guard<std::mutex> lock(selectedJointsBuffers.
mutex);
4505 if (!(p && p->
iCurr))
4523 std::lock_guard<std::mutex> lock(allJointsBuffers.
mutex);
4544 size_t subIndex=remappedControlBoards.
lut[
m].subControlBoardIndex;
4550 int off=(
int)remappedControlBoards.
lut[
m].axisIndexInSubControlBoard;
4561 for(
int l=0;
l<controlledJoints;
l++)
4563 int off=(
int)remappedControlBoards.
lut[
l].axisIndexInSubControlBoard;
4564 size_t subIndex=remappedControlBoards.
lut[
l].subControlBoardIndex;
const yarp::os::LogComponent & CONTROLBOARDREMAPPER()
constexpr yarp::conf::vocab32_t VOCAB_CM_IDLE
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
std::vector< std::vector< double > > m_bufferForSubControlBoard
std::vector< std::vector< yarp::dev::InteractionModeEnum > > m_bufferForSubControlBoardInteractionModes
void fillSubControlBoardBuffersFromArbitraryJointVector(const double *arbitraryVec, const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Fill buffers for the SubControlBoard from a vector of joints of the RemappedControlBoards.
std::vector< std::vector< int > > m_jointsInSubControlBoard
void resizeSubControlBoardBuffers(const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Resize buffers to have the dimension of specified by the method (used for multi joint methods that re...
std::vector< std::vector< int > > m_bufferForSubControlBoardControlModes
void fillArbitraryJointVectorFromSubControlBoardBuffers(double *arbitraryVec, const int n_joints, const int *joints, const RemappedControlBoards &remappedControlBoards)
Fill a vector of joints of the ControlBoardRemapper from the buffers of the SubControlBoard .
std::vector< int > m_nJointsInSubControlBoard
std::mutex mutex
Mutex to grab to use this class.
std::vector< double > dummyBuffer
std::vector< int > controlBoardModes
bool parkWholePart() override
parkWholePart: start the parking procedure for the whole part
bool setImpedance(int j, double stiff, double damp) override
Set current impedance gains (stiffness,damping) for a specific joint.
bool getPidErrorLimit(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *limit) override
Get the error limit for the controller on a specific joint.
bool setRefAccelerations(const double *accs) override
Set reference acceleration on all joints.
bool resetMotorEncoder(int m) override
Reset motor encoder, single motor.
bool getTorqueRange(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
bool getTargetPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool getMotorEncoderCountsPerRevolution(int m, double *cpr) override
Gets number of counts per revolution for motor encoder m.
bool getAmpStatus(int *st) override
bool setTemperatureLimit(int m, const double val) override
Set the temperature limit for a specific motor.
bool setPid(const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &p) override
ControlBoard methods.
bool setRefCurrent(int m, double curr) override
Set the reference value of the current for a single motor.
bool getEncoderSpeeds(double *spds) override
Read the instantaneous speed of all axes.
bool getControlMode(int j, int *mode) override
Get the current control mode.
bool getRefPositions(double *refs) override
Get the last position reference for all axes.
bool setRefSpeed(int j, double sp) override
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
bool setNominalCurrent(int m, const double val) override
bool getMotorEncoderTimed(int m, double *v, double *t) override
Read the instantaneous position of a motor encoder.
bool getRefCurrents(double *currs) override
Get the reference value of the currents for all motors.
bool close() override
Close the device driver by deallocating all resources and closing ports.
bool getTorques(double *t) override
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
bool getRemoteVariable(std::string key, yarp::os::Bottle &val) override
bool checkMotionDone(int j, bool *flag) override
Check if the current trajectory is terminated.
bool calibrationDone(int j) override
Check if the calibration is terminated, on a particular joint.
bool getCurrentImpedanceLimit(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp) override
Get the current impedandance limits for a specific joint.
bool setPWMLimit(int m, const double val) override
bool getTemperatureLimit(int m, double *val) override
Retreives the current temperature limit for a specific motor.
bool getAxes(int *ax) override
Get the number of controlled axes.
bool setPidOffset(const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
Set offset value for a given controller.
bool setEncoder(int j, double val) override
Set the value of the encoder for a given joint.
bool setRefAcceleration(int j, double acc) override
Set reference acceleration for a joint.
bool getPid(const yarp::dev::PidControlTypeEnum &pidtype, int j, yarp::dev::Pid *p) override
Get current pid value for a specific joint.
bool getImpedanceOffset(int j, double *offset) override
Get current force Offset for a specific joint.
bool getEncoderSpeed(int j, double *sp) override
Read the istantaneous speed of an axis.
bool getRefSpeed(int j, double *ref) override
Get reference speed for a joint.
bool resetEncoder(int j) override
Reset encoder, single joint.
bool getDutyCycles(double *vals) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool getEncoderAcceleration(int j, double *acc) override
Read the instantaneous acceleration of an axis.
bool setControlModes(const int n_joints, const int *joints, int *modes) override
Set the current control mode for a subset of axes.
bool getEncoderTimed(int j, double *v, double *t) override
Read the instantaneous acceleration of all axes.
bool getImpedance(int j, double *stiff, double *damp) override
Get current impedance gains (stiffness,damping,offset) for a specific joint.
bool getEncoders(double *encs) override
Read the position of all axes.
bool getRefPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool setVelLimits(int j, double min, double max) override
Set the software speed limits for a particular axis, the behavior of the control card when these limi...
bool getEncoder(int j, double *v) override
Read the value of an encoder.
bool getMotorEncoder(int m, double *v) override
Read the value of a motor encoder.
bool getTorqueRanges(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
bool getMotorEncodersTimed(double *encs, double *t) override
Read the instantaneous position of all motor encoders.
bool setRefTorque(int j, double t) override
Set the reference value of the torque for a given joint.
bool getNumberOfMotors(int *num) override
Retrieves the number of controlled motors from the current physical interface.
bool disableAmp(int j) override
Disable the amplifier on a specific joint.
bool setInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
Set the interaction mode of the robot for a set of joints, values can be stiff or compliant.
bool getPeakCurrent(int m, double *val) override
bool setGearboxRatio(int m, const double val) override
Set the gearbox ratio for a specific motor.
bool quitCalibrate() override
quitCalibrate: interrupt the calibration procedure
bool calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3) override
Start calibration, this method is very often platform specific.
bool getAxisName(int j, std::string &name) override
bool getControlModes(int *modes) override
Get the current control mode (multiple joints).
bool getRefTorques(double *refs) override
Get the reference value of the torque for all joints.
bool getPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
bool isPidEnabled(const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid.
bool getRefVelocity(const int joint, double *vel) override
Get the last reference speed set by velocityMove for single joint.
bool setPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
bool setRefCurrents(const double *currs) override
Set the reference value of the currents for all motors.
bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) override
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool open(yarp::os::Searchable &prop) override
Open the device driver.
bool setPidErrorLimit(const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specifi joint.
bool setMaxCurrent(int j, double v) override
yarp::dev::IRemoteCalibrator * getCalibratorDevice() override
getCalibratorDevice: return the pointer stored with the setCalibratorDevice
bool abortCalibration() override
bool enablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
bool calibrateWholePart() override
calibrateWholePart: call the procedure for calibrating the whole device
bool getLimits(int j, double *min, double *max) override
Get the software limits for a particular axis.
bool getRefDutyCycles(double *refs) override
Gets the last reference sent using the setRefDutyCycles function.
bool getPidReference(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *ref) override
Get the current reference of the pid controller for a specific joint.
bool setRefSpeeds(const double *spds) override
Set reference speed on all joints.
bool getNominalCurrent(int m, double *val) override
bool getRefVelocities(double *vels) override
Get the last reference speed set by velocityMove for all joints.
bool setEncoders(const double *vals) override
Set the value of all encoders.
bool getInteractionMode(int j, yarp::dev::InteractionModeEnum *mode) override
Get the current interaction mode of the robot, values can be stiff or compliant.
bool setMotorEncoder(int m, const double val) override
Set the value of the motor encoder for a given motor.
bool getPidErrors(const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
bool getPidError(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
bool getPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
bool getCurrent(int m, double *curr) override
Get the instantaneous current measurement for a single motor.
bool detachAll() override
Detach the object (you must have first called attach).
bool setPids(const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *ps) override
Set new pid value on multiple axes.
bool parkSingleJoint(int j, bool _wait=true) override
parkSingleJoint(): start the parking procedure for the single joint
bool calibrateSingleJoint(int j) override
calibrateSingleJoint: call the calibration procedure for the single joint
bool getRefTorque(int j, double *t) override
Get the reference value of the torque for a given joint.
bool quitPark() override
quitPark: interrupt the park procedure
bool velocityMove(int j, double v) override
Start motion at a given speed, single joint.
bool getRefDutyCycle(int m, double *ref) override
Gets the last reference sent using the setRefDutyCycle function.
bool getNumberOfMotorEncoders(int *num) override
Get the number of available motor encoders.
bool getPidOutput(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
bool getMotorEncoderAcceleration(int m, double *acc) override
Read the instantaneous acceleration of a motor encoder.
bool setLimits(int j, double min, double max) override
Set the software limits for a particular axis, the behavior of the control card when these limits are...
bool setMotorEncoders(const double *vals) override
Set the value of all motor encoders.
bool getMotorEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all motor encoders.
bool setPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
bool getTargetPositions(double *refs) override
Get the last position reference for all axes.
bool getPWM(int m, double *val) override
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
bool setImpedanceOffset(int j, double offset) override
Set current force Offset for a specific joint.
bool getPidOutputs(const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
bool getJointType(int j, yarp::dev::JointTypeEnum &type) override
bool resetEncoders() override
Reset encoders.
bool setRefDutyCycles(const double *refs) override
Sets the reference dutycycle for all the motors.
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
bool getDutyCycle(int m, double *val) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool getCurrentRanges(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) override
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool setRefTorques(const double *t) override
Set the reference value of the torque for all joints.
bool getLastJointFault(int j, int &fault, std::string &message) override
bool resetMotorEncoders() override
Reset motor encoders.
bool getTorque(int j, double *t) override
Get the value of the torque on a given joint (this is the feedback if you have a torque sensor).
bool getRefCurrent(int m, double *curr) override
Get the reference value of the current for a single motor.
bool setInteractionMode(int j, yarp::dev::InteractionModeEnum mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
bool getGearboxRatio(int m, double *val) override
Get the gearbox ratio for a specific motor.
bool getVelLimits(int j, double *min, double *max) override
Get the software speed limits for a particular axis.
bool getRefAccelerations(double *accs) override
Get reference acceleration of all joints.
bool enableAmp(int j) override
Enable the amplifier on a specific joint.
bool positionMove(int j, double ref) override
Set new reference point for a single axis.
bool disablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
bool getTemperatures(double *vals) override
Get temperature of all the motors.
bool resetPid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
bool getCurrentRange(int m, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
bool getTemperature(int m, double *val) override
Get temperature of a motor.
bool setControlMode(const int j, const int mode) override
Set the current control mode.
bool getInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes) override
Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
bool abortPark() override
bool isCalibratorDevicePresent(bool *isCalib) override
isCalibratorDevicePresent: check if a calibrator device has been set
bool setMotorEncoderCountsPerRevolution(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
bool getPowerSupplyVoltage(int m, double *val) override
bool getMotorEncoders(double *encs) override
Read the position of all motor encoders.
bool setPositions(const int n_joints, const int *joints, const double *dpos) override
Set new reference point for all axes.
bool setCalibrationParameters(int j, const yarp::dev::CalibrationParameters ¶ms) override
Start calibration, this method is very often platform specific.
bool stop() override
Stop motion, multiple joints.
bool getCurrents(double *currs) override
Get the instantaneous current measurement for all motors.
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
bool getPWMLimit(int m, double *val) override
bool getEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all axes.
bool setPeakCurrent(int m, const double val) override
bool homingWholePart() override
homingWholePart: call the homing procedure for a the whole part/device
bool getMotorEncoderSpeed(int m, double *sp) override
Read the istantaneous speed of a motor encoder.
bool homingSingleJoint(int j) override
homingSingleJoint: call the homing procedure for a single joint
bool getRefAcceleration(int j, double *acc) override
Get reference acceleration for a joint.
bool getEncodersTimed(double *encs, double *t) override
Read the instantaneous acceleration of all axes.
bool getRefSpeeds(double *spds) override
Get reference speed of all joints.
bool setRefDutyCycle(int m, double ref) override
Sets the reference dutycycle to a single motor.
bool getMaxCurrent(int j, double *v) override
Returns the maximum electric current allowed for a given motor.
bool setPidReference(const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
bool getMotorEncoderSpeeds(double *spds) override
Read the instantaneous speed of all motor encoders.
bool getPids(const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
Get current pid value for a specific joint.
bool setPosition(int j, double ref) override
Set new position for a single axis.
bool relativeMove(int j, double delta) override
Set relative position.
std::vector< int > m_nJointsInSubControlBoard
bool configure(const RemappedControlBoards &remappedControlBoards)
Resize the buffers using the information in the RemappedControlBoards.
std::mutex mutex
Mutex to grab to use this class.
std::vector< std::vector< int > > m_jointsInSubControlBoard
void fillCompleteJointVectorFromSubControlBoardBuffers(double *full, const RemappedControlBoards &remappedControlBoards)
Fill a vector of joints of the ControlBoardRemapper from the buffers of the SubControlBoard .
void fillSubControlBoardBuffersFromCompleteJointVector(const double *full, const RemappedControlBoards &remappedControlBoards)
Fill buffers for the SubControlBoard from a vector of joints of the RemappedControlBoards.
std::vector< std::vector< double > > m_bufferForSubControlBoard
std::vector< std::vector< int > > m_bufferForSubControlBoardControlModes
std::vector< std::vector< yarp::dev::InteractionModeEnum > > m_bufferForSubControlBoardInteractionModes
size_t getNrOfSubControlBoards() const
std::vector< RemappedSubControlBoard > subdevices
Vector of dimension getNrOfSubControlBoards .
std::vector< RemappedAxis > lut
Vector of dimension getNrOfRemappedAxes .
RemappedSubControlBoard * getSubControlBoard(size_t i)
Given a controlboard index between 0 and getNrOfSubControlBoards()-1, return the relative SubControlB...
yarp::dev::IPositionControl * pos
yarp::dev::IImpedanceControl * iImpedance
yarp::dev::IAmplifierControl * amp
yarp::dev::IEncodersTimed * iJntEnc
yarp::dev::IInteractionMode * iInteract
yarp::dev::IRemoteVariables * iVar
yarp::dev::ICurrentControl * iCurr
yarp::dev::ITorqueControl * iTorque
yarp::dev::IVelocityControl * vel
yarp::dev::IControlMode * iMode
yarp::dev::IJointFault * iFault
yarp::dev::IPositionDirect * posDir
yarp::dev::IRemoteCalibrator * remcalib
yarp::dev::IPidControl * pid
yarp::dev::IAxisInfo * info
yarp::dev::IControlLimits * lim
yarp::dev::IMotor * imotor
yarp::dev::IPWMControl * iPwm
yarp::dev::IControlCalibration * calib
yarp::dev::IMotorEncoders * iMotEnc
yarp::dev::IPreciselyTimed * iTimed
virtual bool getPWMLimit(int j, double *val)
virtual bool enableAmp(int j)=0
Enable the amplifier on a specific joint.
virtual bool setNominalCurrent(int m, const double val)
virtual bool getPWM(int j, double *val)
virtual bool getAmpStatus(int *st)=0
virtual bool setPWMLimit(int j, const double val)
virtual bool getMaxCurrent(int j, double *v)=0
Returns the maximum electric current allowed for a given motor.
virtual bool getNominalCurrent(int m, double *val)
virtual bool getPowerSupplyVoltage(int j, double *val)
virtual bool setMaxCurrent(int j, double v)=0
virtual bool setPeakCurrent(int m, const double val)
virtual bool getPeakCurrent(int m, double *val)
Interface for getting information about specific axes, if available.
virtual bool getAxisName(int axis, std::string &name)=0
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
virtual bool setCalibrationParameters(int axis, const CalibrationParameters ¶ms)
Start calibration, this method is very often platform specific.
virtual bool calibrationDone(int j)=0
Check if the calibration is terminated, on a particular joint.
virtual bool calibrateAxisWithParams(int axis, unsigned int type, double p1, double p2, double p3)=0
Start calibration, this method is very often platform specific.
virtual bool getVelLimits(int axis, double *min, double *max)=0
Get the software speed limits for a particular axis.
virtual bool getLimits(int axis, double *min, double *max)=0
Get the software limits for a particular axis.
virtual bool setLimits(int axis, double min, double max)=0
Set the software limits for a particular axis, the behavior of the control card when these limits are...
virtual bool setVelLimits(int axis, double min, double max)=0
Set the software speed limits for a particular axis, the behavior of the control card when these limi...
virtual bool setControlMode(const int j, const int mode)=0
Set the current control mode.
virtual bool setControlModes(const int n_joint, const int *joints, int *modes)=0
Set the current control mode for a subset of axes.
virtual bool getControlModes(int *modes)=0
Get the current control mode (multiple joints).
virtual bool getControlMode(int j, int *mode)=0
Get the current control mode.
virtual bool setRefCurrent(int m, double curr)=0
Set the reference value of the current for a single motor.
virtual bool setRefCurrents(const double *currs)=0
Set the reference value of the currents for all motors.
virtual bool getCurrent(int m, double *curr)=0
Get the instantaneous current measurement for a single motor.
virtual bool getCurrentRange(int m, double *min, double *max)=0
Get the full scale of the current measurement for a given motor (e.g.
virtual bool getRefCurrent(int m, double *curr)=0
Get the reference value of the current for a single motor.
virtual bool getEncoderTimed(int j, double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
Control board, encoder interface.
virtual bool getEncoderSpeed(int j, double *sp)=0
Read the istantaneous speed of an axis.
virtual bool setEncoder(int j, double val)=0
Set the value of the encoder for a given joint.
virtual bool getEncoder(int j, double *v)=0
Read the value of an encoder.
virtual bool resetEncoder(int j)=0
Reset encoder, single joint.
virtual bool getEncoderAcceleration(int j, double *spds)=0
Read the instantaneous acceleration of an axis.
virtual bool setImpedance(int j, double stiffness, double damping)=0
Set current impedance gains (stiffness,damping) for a specific joint.
virtual bool getImpedanceOffset(int j, double *offset)=0
Get current force Offset for a specific joint.
virtual bool setImpedanceOffset(int j, double offset)=0
Set current force Offset for a specific joint.
virtual bool getImpedance(int j, double *stiffness, double *damping)=0
Get current impedance gains (stiffness,damping,offset) for a specific joint.
virtual bool getCurrentImpedanceLimit(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp)=0
Get the current impedandance limits for a specific joint.
virtual bool getInteractionMode(int axis, yarp::dev::InteractionModeEnum *mode)=0
Get the current interaction mode of the robot, values can be stiff or compliant.
virtual bool getInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes)=0
Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
virtual bool setInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes)=0
Set the interaction mode of the robot for a set of joints, values can be stiff or compliant.
virtual bool setInteractionMode(int axis, yarp::dev::InteractionModeEnum mode)=0
Set the interaction mode of the robot, values can be stiff or compliant.
virtual bool getLastJointFault(int j, int &fault, std::string &message)=0
virtual bool getMotorEncoderCountsPerRevolution(int m, double *cpr)=0
Gets number of counts per revolution for motor encoder m.
virtual bool setMotorEncoderCountsPerRevolution(int m, const double cpr)=0
Sets number of counts per revolution for motor encoder m.
virtual bool resetMotorEncoder(int m)=0
Reset motor encoder, single motor.
virtual bool getMotorEncoderSpeed(int m, double *sp)=0
Read the istantaneous speed of a motor encoder.
virtual bool getMotorEncoderTimed(int m, double *encs, double *time)=0
Read the instantaneous position of a motor encoder.
virtual bool getMotorEncoderAcceleration(int m, double *acc)=0
Read the instantaneous acceleration of a motor encoder.
virtual bool setMotorEncoder(int m, const double val)=0
Set the value of the motor encoder for a given motor.
virtual bool getMotorEncoder(int m, double *v)=0
Read the value of a motor encoder.
virtual bool getTemperature(int m, double *val)=0
Get temperature of a motor.
virtual bool getTemperatureLimit(int m, double *temp)=0
Retreives the current temperature limit for a specific motor.
virtual bool getGearboxRatio(int m, double *val)
Get the gearbox ratio for a specific motor.
virtual bool setTemperatureLimit(int m, const double temp)=0
Set the temperature limit for a specific motor.
virtual bool setGearboxRatio(int m, const double val)
Set the gearbox ratio for a specific motor.
virtual bool getDutyCycle(int m, double *val)=0
Gets the current dutycycle of the output of the amplifier (i.e.
virtual bool setRefDutyCycle(int m, double ref)=0
Sets the reference dutycycle to a single motor.
virtual bool getRefDutyCycle(int m, double *ref)=0
Gets the last reference sent using the setRefDutyCycle function.
virtual bool setPid(const PidControlTypeEnum &pidtype, int j, const Pid &pid)=0
Set new pid value for a joint axis.
virtual bool getPidReference(const PidControlTypeEnum &pidtype, int j, double *ref)=0
Get the current reference of the pid controller for a specific joint.
virtual bool getPidOutput(const PidControlTypeEnum &pidtype, int j, double *out)=0
Get the output of the controller (e.g.
virtual bool resetPid(const PidControlTypeEnum &pidtype, int j)=0
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
virtual bool setPidOffset(const PidControlTypeEnum &pidtype, int j, double v)=0
Set offset value for a given controller.
virtual bool getPidError(const PidControlTypeEnum &pidtype, int j, double *err)=0
Get the current error for a joint.
virtual bool getPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double *limit)=0
Get the error limit for the controller on a specific joint.
virtual bool setPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double limit)=0
Set the error limit for the controller on a specifi joint.
virtual bool disablePid(const PidControlTypeEnum &pidtype, int j)=0
Disable the pid computation for a joint.
virtual bool setPidReference(const PidControlTypeEnum &pidtype, int j, double ref)=0
Set the controller reference for a given axis.
virtual bool enablePid(const PidControlTypeEnum &pidtype, int j)=0
Enable the pid computation for a joint.
virtual bool isPidEnabled(const PidControlTypeEnum &pidtype, int j, bool *enabled)=0
Get the current status (enabled/disabled) of the pid.
virtual bool getPid(const PidControlTypeEnum &pidtype, int j, Pid *pid)=0
Get current pid value for a specific joint.
virtual bool getRefAcceleration(int j, double *acc)=0
Get reference acceleration for a joint.
virtual bool setRefSpeed(int j, double sp)=0
Set reference speed for a joint, this is the speed used during the interpolation of the trajectory.
virtual bool setRefAcceleration(int j, double acc)=0
Set reference acceleration for a joint.
virtual bool relativeMove(int j, double delta)=0
Set relative position.
virtual bool getTargetPosition(const int joint, double *ref)
Get the last position reference for the specified axis.
virtual bool setRefSpeeds(const double *spds)=0
Set reference speed on all joints.
virtual bool checkMotionDone(int j, bool *flag)=0
Check if the current trajectory is terminated.
virtual bool getRefSpeeds(double *spds)=0
Get reference speed of all joints.
virtual bool stop(int j)=0
Stop motion, single joint.
virtual bool setRefAccelerations(const double *accs)=0
Set reference acceleration on all joints.
virtual bool getRefAccelerations(double *accs)=0
Get reference acceleration of all joints.
virtual bool getRefSpeed(int j, double *ref)=0
Get reference speed for a joint.
virtual bool positionMove(int j, double ref)=0
Set new reference point for a single axis.
virtual bool getTargetPositions(double *refs)
Get the last position reference for all axes.
virtual bool getRefPositions(double *refs)
Get the last position reference for all axes.
virtual bool setPositions(const int n_joint, const int *joints, const double *refs)=0
Set new reference point for all axes.
virtual bool setPosition(int j, double ref)=0
Set new position for a single axis.
virtual bool getRefPosition(const int joint, double *ref)
Get the last position reference for the specified axis.
virtual yarp::os::Stamp getLastInputStamp()=0
Return the time stamp relative to the last acquisition.
IRemoteCalibrator interface is meant to remotize the access of the calibration device in order to all...
virtual bool parkWholePart()=0
parkWholePart: start the parking procedure for the whole part
virtual bool homingSingleJoint(int j)=0
homingSingleJoint: call the homing procedure for a single joint
virtual bool setCalibratorDevice(yarp::dev::IRemoteCalibrator *dev)
setCalibratorDevice: store the pointer to the calibrator device.
virtual void releaseCalibratorDevice()
releaseCalibratorDevice: reset the internal pointer to NULL when stop using the calibrator
virtual bool isCalibratorDevicePresent(bool *isCalib)
isCalibratorDevicePresent: check if a calibrator device has been set
virtual bool quitPark()=0
quitPark: interrupt the park procedure
virtual bool parkSingleJoint(int j, bool _wait=true)=0
parkSingleJoint(): start the parking procedure for the single joint
virtual bool calibrateSingleJoint(int j)=0
calibrateSingleJoint: call the calibration procedure for the single joint
virtual bool calibrateWholePart()=0
calibrateWholePart: call the procedure for calibrating the whole device
virtual bool quitCalibrate()=0
quitCalibrate: interrupt the calibration procedure
virtual yarp::dev::IRemoteCalibrator * getCalibratorDevice()
getCalibratorDevice: return the pointer stored with the setCalibratorDevice
virtual bool setRemoteVariable(std::string key, const yarp::os::Bottle &val)=0
virtual bool getRemoteVariable(std::string key, yarp::os::Bottle &val)=0
virtual bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys)=0
virtual bool setRefTorque(int j, double t)=0
Set the reference value of the torque for a given joint.
virtual bool setRefTorques(const double *t)=0
Set the reference value of the torque for all joints.
virtual bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params)
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
virtual bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params)
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
virtual bool getTorqueRange(int j, double *min, double *max)=0
Get the full scale of the torque sensor of a given joint.
virtual bool getRefTorque(int j, double *t)=0
Get the reference value of the torque for a given joint.
virtual bool getTorque(int j, double *t)=0
Get the value of the torque on a given joint (this is the feedback if you have a torque sensor).
virtual bool getRefVelocity(const int joint, double *vel)
Get the last reference speed set by velocityMove for single joint.
virtual bool velocityMove(int j, double sp)=0
Start motion at a given speed, single joint.
virtual bool getRefVelocities(double *vels)
Get the last reference speed set by velocityMove for all joints.
Contains the parameters for a PID.
A simple collection of objects that can be described and transmitted in a portable way.
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
size_type size() const
Gets the number of elements in the bottle.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A mini-server for performing network communication in the background.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
A base class for nested structures that can be searched.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
An abstraction for a time stamp and/or sequence number.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
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 yCInfo(component,...)
#define yCError(component,...)
#define yCWarning(component,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
size_t indexOfSubDeviceInPolyDriverList