34 streaming_parser.
init(
this);
35 RPC_parser.
init(
this);
40 subDeviceOwned =
nullptr;
52 void ControlBoardWrapper::cleanup_yarpPorts()
59 inputStreamingPort.interrupt();
60 inputStreamingPort.close();
63 outputPositionStatePort.
close();
66 extendedOutputStatePort.
close();
88 if(rosNode !=
nullptr)
98 if(subDeviceOwned !=
nullptr)
100 subDeviceOwned->
close();
101 delete subDeviceOwned;
102 subDeviceOwned =
nullptr;
112 bool ControlBoardWrapper::checkPortName(
Searchable ¶ms)
117 if(params.
check(
"rootName"))
120 "************************************************************************************\n"
121 "* controlboardwrapper2 is using the deprecated parameter 'rootName' for port name, *\n"
122 "* It has to be removed and substituted with: *\n"
123 "* name: full port prefix name with leading '/', e.g. /robotName/part/ *\n"
124 "************************************************************************************";
129 if(!params.
check(
"name"))
132 "************************************************************************************\n"
133 "* controlboardwrapper2 missing mandatory parameter 'name' for port name, usage is: *\n"
134 "* name: full port prefix name with leading '/', e.g. /robotName/part/ *\n"
135 "************************************************************************************";
140 if(partName[0] !=
'/')
143 "************************************************************************************\n"
144 "* controlboardwrapper2 'name' parameter for port name does not follow convention, *\n"
145 "* it MUST start with a leading '/' since it is used as the full prefix port name *\n"
146 "* name: full port prefix name with leading '/', e.g. /robotName/part/ *\n"
147 "* A temporary automatic fix will be done for you, but please fix your config file *\n"
148 "************************************************************************************";
149 rootName =
"/" + partName;
159 bool ControlBoardWrapper::checkROSParams(
Searchable &config)
162 if(!config.
check(
"ROS") )
179 if(!rosGroup.
check(
"useROS"))
182 Allowed values are true, false, ROS_only";
186 std::string ros_use_type = rosGroup.
find(
"useROS").
asString();
187 if(ros_use_type ==
"false")
193 else if(ros_use_type ==
"true")
198 else if(ros_use_type ==
"only")
205 yCInfo(
CONTROLBOARDWRAPPER) << partName <<
"useROS parameter is seet to unvalid value ('" << ros_use_type <<
"'), supported values are 'true', 'false', 'only'";
211 if(!rosGroup.
check(
"ROS_nodeName"))
221 if(!rosGroup.
check(
"ROS_topicName"))
227 rosTopicName = rosGroup.
find(
"ROS_topicName").
asString();
233 if(!rosGroup.
check(
"jointNames"))
235 yCInfo(
CONTROLBOARDWRAPPER) << partName <<
"ROS topic has been required, jointNames will be got from motionControl subdevice.";
247 if(nameList.
size() != (
size_t) controlledJoints)
249 yCError(
CONTROLBOARDWRAPPER) << partName <<
" jointNames incorrect number of entries. \n jointNames is " << nameList.
toString() <<
"while expected length is " << controlledJoints;
255 for(
int i=0; i<controlledJoints; i++)
263 bool ControlBoardWrapper::initialize_ROS()
265 bool success =
false;
273 if(rosNode ==
nullptr)
280 if (!rosPublisherPort.
topic(rosTopicName) )
312 bool success =
false;
333 rootName = prop.
check(
"rootName",
Value(
"/"),
"starting '/' if needed.").asString();
334 partName=prop.
check(
"name",
Value(
"controlboard"),
"prefix for port names").asString();
335 rootName+=(partName);
336 if( rootName.find(
"//") != std::string::npos )
338 rootName.replace(rootName.find(
"//"), 2,
"/");
342 if(! inputRPCPort.
open((rootName+
"/rpc:i")) )
349 inputRPC_buffer.
attach(inputRPCPort);
350 RPC_parser.
attach(inputRPC_buffer);
352 if(!inputStreamingPort.open(rootName+
"/command:i") )
360 inputStreamingPort.setStrict();
361 inputStreamingPort.useCallback(streaming_parser);
363 if(!outputPositionStatePort.
open(rootName+
"/state:o") )
371 if(!extendedOutputStatePort.
open(rootName+
"/stateExt:o") )
377 extendedOutputState_buffer.
attach(extendedOutputStatePort);
396 _verb = (prop.
check(
"verbose",
"if present, give detailed output"));
400 if(!checkPortName(config) )
407 if(prop.
check(
"threadrate"))
414 if(prop.
check(
"period"))
436 if(prop.
check(
"subdevice"))
439 prop.setMonitor(config.getMonitor());
440 if(! openAndAttachSubDevice(prop))
449 if(!openDeferredAttach(prop))
458 if(!checkROSParams(config) )
465 if(!initialize_ROS() )
471 if(!initialize_YARP(prop) )
477 times.
resize(controlledJoints);
478 ros_struct.
name.resize(controlledJoints);
479 ros_struct.
position.resize(controlledJoints);
480 ros_struct.
velocity.resize(controlledJoints);
481 ros_struct.
effort.resize(controlledJoints);
487 PeriodicThread::setPeriod(period);
488 if (!PeriodicThread::start())
497 bool ControlBoardWrapper::openDeferredAttach(
Property& prop)
499 if (!prop.
check(
"networks",
"list of networks merged by this wrapper"))
512 if (!prop.
check(
"joints",
"number of joints of the part"))
517 int nsubdevices=nets->
size();
518 device.
lut.resize(controlledJoints);
523 for(
size_t k=0;k<nets->
size();k++)
531 if(parameters.
size()==2)
541 if(tmpBot.
size() != 4)
544 <<
"--> I was expecting "<<nets->
get(k).
asString() <<
" followed by a list of four integers in parenthesis"
560 else if (parameters.
size()==5)
571 <<
"--> I was expecting "<<nets->
get(k).
asString() <<
" followed by a list of four integers in parenthesis"
593 if( (wBase < 0) || (wBase >= controlledJoints) )
596 "First index " << wBase <<
"must be inside range from 0 to 'joints' ("<< controlledJoints <<
")";
600 if( (wTop < 0) || (wTop >= controlledJoints) )
603 "Second index " << wTop <<
"must be inside range from 0 to 'joints' ("<< controlledJoints <<
")";
610 "First index " << wBase <<
"must be lower than second index " << wTop;
614 for(
int j=wBase, jInDev=base;j<=wTop;j++, jInDev++)
616 device.
lut[j].deviceEntry=k;
617 device.
lut[j].offset=j-wBase;
618 device.
lut[j].jointIndexInDev=jInDev;
624 if (totalJ!=controlledJoints)
626 yCError(
CONTROLBOARDWRAPPER) <<
"Error total number of mapped joints ("<< totalJ <<
") does not correspond to part joints (" << controlledJoints <<
")";
634 bool ControlBoardWrapper::openAndAttachSubDevice(
Property& prop)
640 std::string subdevice = prop.
find(
"subdevice").
asString();
641 p.setMonitor(prop.getMonitor(), subdevice.c_str());
643 p.
put(
"device", subdevice);
647 subDeviceOwned->
open(p);
649 if (!subDeviceOwned->
isValid())
657 subDeviceOwned->
view(iencs);
659 if (iencs ==
nullptr)
665 bool getAx = iencs->
getAxes(&controlledJoints);
675 device.
lut.resize(controlledJoints);
680 top = controlledJoints-1;
687 std::string subDevName ((partName +
"_" + subdevice));
688 if (!tmpDevice->
configure(wbase, wtop, base, top, controlledJoints, subDevName,
this) )
694 for(
int j=0; j<controlledJoints; j++)
696 device.
lut[j].deviceEntry = 0;
697 device.
lut[j].offset = j;
701 if (!device.
subdevices[0].attach(subDeviceOwned, subDevName))
707 calculateMaxNumOfJointsInDevices();
711 void ControlBoardWrapper::calculateMaxNumOfJointsInDevices()
715 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
723 bool ControlBoardWrapper::updateAxisName()
740 vector<string> tmpVect;
744 for(
int i=0; i < controlledJoints; i++)
748 std::string tmp2(tmp);
749 tmpVect.push_back(tmp2);
755 if(jointNames.size() != 0)
757 yCWarning(
CONTROLBOARDWRAPPER) <<
"Found 2 instance of jointNames parameter: one in the wrapper [ROS] group and another one in the subdevice, the latter one will be used.";
758 std::string fullNames;
759 for(
int i=0; i < controlledJoints; i++) fullNames.append(tmpVect[i]);
763 jointNames = tmpVect;
767 if(jointNames.size() == 0)
775 "************************************************************************************************** \n" <<
776 "* Joint names for ROS topic were found in the [ROS] group in the wrapper config file for\n" <<
777 "* '" << partName <<
"' device.\n" <<
778 "* They should be in the MotionControl device(s) instead. Please update the config files.\n" <<
779 "**************************************************************************************************";
792 for(
int p=0;p<polylist.
size();p++)
795 std::string tmpKey=polylist[p]->key;
796 if(tmpKey ==
"Calibrator" || tmpKey ==
"calibrator")
800 polylist[p]->poly->view(calibrator);
802 IRemoteCalibrator::setCalibratorDevice(calibrator);
812 if (!device.
subdevices[k].attach(polylist[p]->poly, tmpKey))
825 if (!subdevice.isAttached())
836 for(
int p=0;p<polylist.
size();p++)
838 ss << polylist[p]->key.c_str() <<
" ";
848 calculateMaxNumOfJointsInDevices();
849 PeriodicThread::setPeriod(period);
850 return PeriodicThread::start();
864 for(
int k=0;k<devices;k++) {
869 IRemoteCalibrator::releaseCalibratorDevice();
876 if(inputStreamingPort.getPendingReads() >= 20)
878 yCWarning(
CONTROLBOARDWRAPPER) <<
"Number of streaming intput messages to be read is " << inputStreamingPort.getPendingReads() <<
" and can overflow";
895 time.
update(std::accumulate(times.
begin(), times.
end(), 0.0) / controlledJoints);
902 jointData &yarp_struct = extendedOutputState_buffer.
get();
938 extendedOutputState_buffer.
write();
942 v.
resize(controlledJoints);
946 outputPositionStatePort.
write();
953 for(
int i=0; i< controlledJoints; i++)
963 ros_struct.
name=jointNames;
968 rosPublisherPort.
write(ros_struct);
977 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
978 int subIndex=device.
lut[j].deviceEntry;
995 for(
int l=0;l<controlledJoints;l++)
997 int off=device.
lut[l].offset;
998 int subIndex=device.
lut[l].deviceEntry;
1016 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1017 int subIndex=device.
lut[j].deviceEntry;
1034 for(
int l=0;l<controlledJoints;l++)
1036 int off=device.
lut[l].offset;
1037 int subIndex=device.
lut[l].deviceEntry;
1055 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1056 int subIndex=device.
lut[j].deviceEntry;
1073 for(
int l=0;l<controlledJoints;l++)
1075 int off=device.
lut[l].offset;
1076 int subIndex=device.
lut[l].deviceEntry;
1094 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1095 int subIndex=device.
lut[j].deviceEntry;
1114 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1124 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1126 errs[juser] = errors[jdevice];
1131 printError(
"getPidErrors", p->
id,
ret);
1143 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1144 int subIndex=device.
lut[j].deviceEntry;
1162 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1173 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1175 outs[juser] = outputs[jdevice];
1180 printError(
"getPidOutouts", p->
id,
ret);
1192 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1193 int subIndex=device.
lut[j].deviceEntry;
1209 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1210 int subIndex=device.
lut[j].deviceEntry;
1227 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1238 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1240 pids[juser] = pids_device[jdevice];
1245 printError(
"getPids", p->
id,
ret);
1251 delete[] pids_device;
1256 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1257 int subIndex=device.
lut[j].deviceEntry;
1273 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1284 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1286 refs[juser] = references[jdevice];
1291 printError(
"getPidReferences", p->
id,
ret);
1297 delete [] references;
1302 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1303 int subIndex=device.
lut[j].deviceEntry;
1320 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1331 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1333 limits[juser] = lims[jdevice];
1338 printError(
"getPidErrorLimits", p->
id,
ret);
1349 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1350 int subIndex=device.
lut[j].deviceEntry;
1364 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1365 int subIndex=device.
lut[j].deviceEntry;
1379 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1380 int subIndex=device.
lut[j].deviceEntry;
1395 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1396 int subIndex=device.
lut[j].deviceEntry;
1420 *ax=controlledJoints;
1431 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1432 int subIndex=device.
lut[j].deviceEntry;
1456 for(
int subDev_idx=0; subDev_idx < nDev; subDev_idx++)
1458 int subIndex=device.
lut[j_wrap].deviceEntry;
1466 int wrapped_joints=(p->
top - p->
base) + 1;
1467 int *joints =
new int[wrapped_joints];
1472 for(
int j_dev = 0; j_dev < wrapped_joints; j_dev++)
1474 joints[j_dev] = p->
base + j_dev;
1478 j_wrap+=wrapped_joints;
1502 rpcDataMutex.lock();
1508 for(
int j=0; j<n_joints; j++)
1510 subIndex = device.
lut[joints[j]].deviceEntry;
1516 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1522 rpcData.
values[subIndex]);
1529 rpcDataMutex.unlock();
1535 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1536 int subIndex=device.
lut[j].deviceEntry;
1562 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
1573 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
1575 spds[juser] = targets[jdevice];
1580 printError(
"getTargetPositions", p->
id,
ret);
1595 rpcDataMutex.lock();
1601 for(
int j=0; j<n_joints; j++)
1603 subIndex = device.
lut[joints[j]].deviceEntry;
1608 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1614 rpcData.
values[subIndex]);
1625 for(
int j=0; j<n_joints; j++)
1627 subIndex = device.
lut[joints[j]].deviceEntry;
1634 for(
int j=0; j<n_joints; j++)
1639 rpcDataMutex.unlock();
1650 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1651 int subIndex=device.
lut[j].deviceEntry;
1672 for(
int l=0;l<controlledJoints;l++)
1674 int off=device.
lut[l].offset;
1675 int subIndex=device.
lut[l].deviceEntry;
1700 rpcDataMutex.lock();
1706 for(
int j=0; j<n_joints; j++)
1708 subIndex = device.
lut[joints[j]].deviceEntry;
1714 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1720 rpcData.
values[subIndex]);
1727 rpcDataMutex.unlock();
1738 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1739 int subIndex=device.
lut[j].deviceEntry;
1763 rpcDataMutex.lock();
1773 for(
int j=0; j<controlledJoints; j++)
1775 subIndex = device.
lut[j].deviceEntry;
1780 bool tmp_subdeviceDone =
true;
1781 bool tmp_deviceDone =
true;
1784 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1790 &tmp_subdeviceDone);
1791 tmp_deviceDone &= tmp_subdeviceDone;
1794 rpcDataMutex.unlock();
1797 *flag = tmp_deviceDone;
1814 rpcDataMutex.lock();
1820 for(
int j=0; j<n_joints; j++)
1822 subIndex = device.
lut[joints[j]].deviceEntry;
1827 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1834 tmp = tmp && XFlags;
1845 rpcDataMutex.unlock();
1856 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1857 int subIndex=device.
lut[j].deviceEntry;
1880 for(
unsigned int subDev_idx=0; subDev_idx < device.
subdevices.size(); subDev_idx++)
1887 int wrapped_joints=(p->
top - p->
base) + 1;
1888 int *joints =
new int[wrapped_joints];
1893 for(
int j_dev = 0; j_dev < wrapped_joints; j_dev++)
1895 joints[j_dev] = p->
base + j_dev;
1899 j_wrap += wrapped_joints;
1925 rpcDataMutex.lock();
1931 for(
int j=0; j<n_joints; j++)
1933 subIndex = device.
lut[joints[j]].deviceEntry;
1940 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
1946 rpcData.
values[subIndex]);
1953 rpcDataMutex.unlock();
1964 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
1965 int subIndex=device.
lut[j].deviceEntry;
1990 for(
unsigned int subDev_idx=0; subDev_idx < device.
subdevices.size(); subDev_idx++)
1997 int wrapped_joints=(p->
top - p->
base) + 1;
1998 int *joints =
new int[wrapped_joints];
2003 for(
int j_dev = 0; j_dev < wrapped_joints; j_dev++)
2005 joints[j_dev] = p->
base + j_dev;
2009 j_wrap += wrapped_joints;
2034 rpcDataMutex.lock();
2040 for(
int j=0; j<n_joints; j++)
2042 subIndex = device.
lut[joints[j]].deviceEntry;
2049 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
2055 rpcData.
values[subIndex]);
2062 rpcDataMutex.unlock();
2074 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2075 int subIndex=device.
lut[j].deviceEntry;
2100 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2111 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2113 spds[juser] = references[jdevice];
2118 printError(
"getRefSpeeds", p->
id,
ret);
2124 delete [] references;
2139 rpcDataMutex.lock();
2145 for(
int j=0; j<n_joints; j++)
2147 subIndex = device.
lut[joints[j]].deviceEntry;
2152 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
2158 rpcData.
values[subIndex]);
2173 for(
int j=0; j<n_joints; j++)
2175 subIndex = device.
lut[joints[j]].deviceEntry;
2182 for(
int j=0; j<n_joints; j++)
2187 rpcDataMutex.unlock();
2198 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2199 int subIndex=device.
lut[j].deviceEntry;
2224 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2235 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2237 accs[juser] = references[jdevice];
2242 printError(
"getRefAccelerations", p->
id,
ret);
2248 delete [] references;
2263 rpcDataMutex.lock();
2269 for(
int j=0; j<n_joints; j++)
2271 subIndex = device.
lut[joints[j]].deviceEntry;
2276 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
2282 rpcData.
values[subIndex]);
2297 for(
int j=0; j<n_joints; j++)
2299 subIndex = device.
lut[joints[j]].deviceEntry;
2306 for(
int j=0; j<n_joints; j++)
2311 rpcDataMutex.unlock();
2320 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2321 int subIndex=device.
lut[j].deviceEntry;
2343 for(
int l=0;l<controlledJoints;l++)
2345 int off=device.
lut[l].offset;
2346 int subIndex=device.
lut[l].deviceEntry;
2372 rpcDataMutex.lock();
2378 for(
int j=0; j<n_joints; j++)
2380 subIndex = device.
lut[joints[j]].deviceEntry;
2385 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
2397 rpcDataMutex.unlock();
2405 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2406 int subIndex=device.
lut[j].deviceEntry;
2425 for(
unsigned int subDev_idx=0; subDev_idx < device.
subdevices.size(); subDev_idx++)
2432 int wrapped_joints=(p->
top - p->
base) + 1;
2433 int *joints =
new int[wrapped_joints];
2438 for(
int j_dev = 0; j_dev < wrapped_joints; j_dev++)
2440 joints[j_dev] = p->
base + j_dev;
2444 j_wrap += wrapped_joints;
2462 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2463 int subIndex=device.
lut[j].deviceEntry;
2479 for(
int l=0;l<controlledJoints;l++)
2481 int off=device.
lut[l].offset;
2482 int subIndex=device.
lut[l].deviceEntry;
2499 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2500 int subIndex=device.
lut[j].deviceEntry;
2516 for(
int l=0;l<controlledJoints;l++)
2518 int off=device.
lut[l].offset;
2519 int subIndex=device.
lut[l].deviceEntry;
2536 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2537 int subIndex=device.
lut[j].deviceEntry;
2555 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2566 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2568 encs[juser] = encValues[jdevice];
2573 printError(
"getEncoders", p->
id,
ret);
2579 delete [] encValues;
2589 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2600 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2602 encs[juser] = encValues[jdevice];
2603 t[juser] = tValues[jdevice];
2608 printError(
"getEncodersTimed", p->
id,
ret);
2614 delete [] encValues;
2620 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2621 int subIndex=device.
lut[j].deviceEntry;
2636 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2637 int subIndex=device.
lut[j].deviceEntry;
2655 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2666 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2668 spds[juser] = sValues[jdevice];
2673 printError(
"getEncoderSpeeds", p->
id,
ret);
2684 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
2685 int subIndex=device.
lut[j].deviceEntry;
2703 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2714 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2716 accs[juser] = aValues[jdevice];
2721 printError(
"getEncoderAccelerations", p->
id,
ret);
2733 *num=controlledJoints;
2738 int off=device.
lut[m].offset;
2739 int subIndex=device.
lut[m].deviceEntry;
2757 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
2768 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
2770 vals[juser] = temps[jdevice];
2775 printError(
"getTemperatures", p->
id,
ret);
2786 int off=device.
lut[m].offset;
2787 int subIndex=device.
lut[m].deviceEntry;
2802 int off=device.
lut[m].offset;
2803 int subIndex=device.
lut[m].deviceEntry;
2817 int off = device.
lut[m].offset;
2818 int subIndex = device.
lut[m].deviceEntry;
2833 int off = device.
lut[m].offset;
2834 int subIndex = device.
lut[m].deviceEntry;
2851 for (
unsigned int i = 0; i < device.
subdevices.size(); i++)
2855 if (!p)
return false;
2856 if (!p->
iVar)
return false;
2859 if (b) val.
append(tmpval);
2867 size_t bottle_size = val.
size();
2868 size_t device_size = device.
subdevices.size();
2869 if (bottle_size != device_size)
2876 for (
unsigned int i = 0; i < device_size; i++)
2899 int subIndex = device.
lut[0].deviceEntry;
2915 int off=device.
lut[m].offset;
2916 int subIndex=device.
lut[m].deviceEntry;
2932 for(
int l=0;l<controlledJoints;l++)
2934 int off=device.
lut[l].offset;
2935 int subIndex=device.
lut[l].deviceEntry;
2952 int off=device.
lut[m].offset;
2953 int subIndex=device.
lut[m].deviceEntry;
2969 for(
int l=0;l<controlledJoints;l++)
2971 int off=device.
lut[l].offset;
2972 int subIndex=device.
lut[l].deviceEntry;
2989 int off=device.
lut[m].offset;
2990 int subIndex=device.
lut[m].deviceEntry;
3004 int off=device.
lut[m].offset;
3005 int subIndex=device.
lut[m].deviceEntry;
3020 int off=device.
lut[m].offset;
3021 int subIndex=device.
lut[m].deviceEntry;
3040 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3051 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3053 encs[juser] = encValues[jdevice];
3058 printError(
"getMotorEncoders", p->
id,
ret);
3064 delete [] encValues;
3073 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3084 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3086 encs[juser] = encValues[jdevice];
3087 t[juser] = tValues[jdevice];
3092 printError(
"getMotorEncodersTimed", p->
id,
ret);
3098 delete [] encValues;
3104 int off=device.
lut[m].offset;
3105 int subIndex=device.
lut[m].deviceEntry;
3120 int off=device.
lut[m].offset;
3121 int subIndex=device.
lut[m].deviceEntry;
3139 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3150 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3152 spds[juser] = sValues[jdevice];
3157 printError(
"getMotorEncoderSpeeds", p->
id,
ret);
3168 int off=device.
lut[m].offset;
3169 int subIndex=device.
lut[m].deviceEntry;
3187 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3198 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3200 accs[juser] = aValues[jdevice];
3205 printError(
"getMotorEncoderAccelerations", p->
id,
ret);
3218 *num=controlledJoints;
3226 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3227 int subIndex=device.
lut[j].deviceEntry;
3242 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3243 int subIndex=device.
lut[j].deviceEntry;
3269 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3280 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3282 st[juser] = status[jdevice];
3287 printError(
"getAmpStatus", p->
id,
ret);
3299 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3300 int subIndex=device.
lut[j].deviceEntry;
3313 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3314 int subIndex=device.
lut[j].deviceEntry;
3329 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3330 int subIndex=device.
lut[j].deviceEntry;
3349 int off=device.
lut[m].offset;
3350 int subIndex=device.
lut[m].deviceEntry;
3369 int off=device.
lut[m].offset;
3370 int subIndex=device.
lut[m].deviceEntry;
3389 int off=device.
lut[m].offset;
3390 int subIndex=device.
lut[m].deviceEntry;
3405 int off = device.
lut[m].offset;
3406 int subIndex = device.
lut[m].deviceEntry;
3421 int off=device.
lut[m].offset;
3422 int subIndex=device.
lut[m].deviceEntry;
3441 int off=device.
lut[m].offset;
3442 int subIndex=device.
lut[m].deviceEntry;
3462 int off=device.
lut[m].offset;
3463 int subIndex=device.
lut[m].deviceEntry;
3478 int off=device.
lut[m].offset;
3479 int subIndex=device.
lut[m].deviceEntry;
3501 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3502 int subIndex=device.
lut[j].deviceEntry;
3517 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3518 int subIndex=device.
lut[j].deviceEntry;
3539 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3540 int subIndex=device.
lut[j].deviceEntry;
3555 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3556 int subIndex=device.
lut[j].deviceEntry;
3592 return IRemoteCalibrator::getCalibratorDevice()->calibrateSingleJoint(j);
3662 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3663 int subIndex=device.
lut[j].deviceEntry;
3675 int off = device.
lut[j].offset;
3676 int subIndex = device.
lut[j].deviceEntry;
3688 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3689 int subIndex=device.
lut[j].deviceEntry;
3718 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3719 int subIndex=device.
lut[j].deviceEntry;
3734 int off = device.
lut[j].offset;
3735 int subIndex = device.
lut[j].deviceEntry;
3752 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3763 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3765 refs[juser] = references[jdevice];
3770 printError(
"getRefTorques", p->
id,
ret);
3776 delete [] references;
3783 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3784 int subIndex=device.
lut[j].deviceEntry;
3801 for(
int l=0;l<controlledJoints;l++)
3803 int off=device.
lut[l].offset;
3804 int subIndex=device.
lut[l].deviceEntry;
3822 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3823 int subIndex=device.
lut[j].deviceEntry;
3840 rpcDataMutex.lock();
3846 for(
int j=0; j<n_joints; j++)
3848 subIndex = device.
lut[joints[j]].deviceEntry;
3854 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
3860 rpcData.
values[subIndex]);
3867 rpcDataMutex.unlock();
3873 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3874 int subIndex=device.
lut[j].deviceEntry;
3889 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3890 int subIndex=device.
lut[j].deviceEntry;
3905 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3906 int subIndex=device.
lut[j].deviceEntry;
3922 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3923 int subIndex=device.
lut[j].deviceEntry;
3939 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3940 int subIndex=device.
lut[j].deviceEntry;
3958 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
3969 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
3971 t[juser] = trqs[jdevice];
3976 printError(
"getTorques", p->
id,
ret);
3989 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
3990 int subIndex=device.
lut[j].deviceEntry;
4009 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4020 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4022 min[juser] = t_min[jdevice];
4023 max[juser] = t_max[jdevice];
4028 printError(
"getTorqueRanges", p->
id,
ret);
4042 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4043 int subIndex=device.
lut[j].deviceEntry;
4059 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4060 int subIndex=device.
lut[j].deviceEntry;
4076 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4077 int subIndex=device.
lut[j].deviceEntry;
4093 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4094 int subIndex=device.
lut[j].deviceEntry;
4111 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4122 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4124 modes[juser] = all_mode[jdevice];
4129 printError(
"getControlModes", p->
id,
ret);
4145 for(
int l=0; l<n_joint; l++)
4147 int off=device.
lut[joints[l]].offset;
4148 int subIndex=device.
lut[joints[l]].deviceEntry;
4167 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4168 int subIndex=device.
lut[j].deviceEntry;
4185 rpcDataMutex.lock();
4191 for(
int j=0; j<n_joints; j++)
4193 subIndex = device.
lut[joints[j]].deviceEntry;
4199 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4205 rpcData.
modes[subIndex]);
4212 rpcDataMutex.unlock();
4222 for(
int subDev_idx=0; subDev_idx < nDev; subDev_idx++)
4224 int subIndex=device.
lut[j_wrap].deviceEntry;
4230 int wrapped_joints=(p->
top - p->
base) + 1;
4231 int *joints =
new int[wrapped_joints];
4236 for(
int j_dev = 0; j_dev < wrapped_joints; j_dev++)
4238 joints[j_dev] = p->
base + j_dev;
4242 j_wrap+=wrapped_joints;
4257 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4258 int subIndex=device.
lut[j].deviceEntry;
4276 rpcDataMutex.lock();
4282 for(
int j=0; j<n_joints; j++)
4284 subIndex = device.
lut[joints[j]].deviceEntry;
4285 int offset = device.
lut[joints[j]].offset;
4292 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4298 rpcData.
values[subIndex]);
4305 rpcDataMutex.unlock();
4313 for(
int l=0;l<controlledJoints;l++)
4315 int off=device.
lut[l].offset;
4316 int subIndex=device.
lut[l].deviceEntry;
4341 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4342 int subIndex=device.
lut[j].deviceEntry;
4362 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4373 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4375 spds[juser] = references[jdevice];
4380 printError(
"getRefPositions", p->
id,
ret);
4386 delete [] references;
4396 rpcDataMutex.lock();
4402 for(
int j=0; j<n_joints; j++)
4404 subIndex = device.
lut[joints[j]].deviceEntry;
4409 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4415 rpcData.
values[subIndex]);
4426 for(
int j=0; j<n_joints; j++)
4428 subIndex = device.
lut[joints[j]].deviceEntry;
4435 for(
int j=0; j<n_joints; j++)
4440 rpcDataMutex.unlock();
4452 rpcDataMutex.lock();
4458 for(
int j=0; j<n_joints; j++)
4460 subIndex = device.
lut[joints[j]].deviceEntry;
4466 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4472 rpcData.
values[subIndex]);
4479 rpcDataMutex.unlock();
4488 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4489 int subIndex=device.
lut[j].deviceEntry;
4510 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4521 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4523 vels[juser] = references[jdevice];
4528 printError(
"getRefVelocities", p->
id,
ret);
4534 delete [] references;
4546 rpcDataMutex.lock();
4552 for(
int j=0; j<n_joints; j++)
4554 subIndex = device.
lut[joints[j]].deviceEntry;
4559 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4565 rpcData.
values[subIndex]);
4576 for(
int j=0; j<n_joints; j++)
4578 subIndex = device.
lut[joints[j]].deviceEntry;
4585 for(
int j=0; j<n_joints; j++)
4590 rpcDataMutex.unlock();
4596 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4597 int subIndex=device.
lut[j].deviceEntry;
4614 rpcDataMutex.lock();
4620 for(
int j=0; j<n_joints; j++)
4622 subIndex = device.
lut[joints[j]].deviceEntry;
4627 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4648 for(
int j=0; j<n_joints; j++)
4650 subIndex = device.
lut[joints[j]].deviceEntry;
4657 for(
int j=0; j<n_joints; j++)
4662 rpcDataMutex.unlock();
4671 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4682 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4684 modes[juser] = imodes[jdevice];
4689 printError(
"getInteractionModes", p->
id,
ret);
4701 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4702 int subIndex=device.
lut[j].deviceEntry;
4719 rpcDataMutex.lock();
4725 for(
int j=0; j<n_joints; j++)
4727 subIndex = device.
lut[joints[j]].deviceEntry;
4733 for(subIndex=0; subIndex<rpcData.
deviceNum; subIndex++)
4746 rpcDataMutex.unlock();
4754 for(
int j=0; j<controlledJoints; j++)
4756 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4757 int subIndex=device.
lut[j].deviceEntry;
4775 int off;
try{ off = device.
lut.at(j).offset; }
4776 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4777 int subIndex = device.
lut[j].deviceEntry;
4794 for (
int l = 0; l<controlledJoints; l++)
4796 int off = device.
lut[l].offset;
4797 int subIndex = device.
lut[l].deviceEntry;
4815 int off;
try{ off = device.
lut.at(j).offset; }
4816 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4817 int subIndex = device.
lut[j].deviceEntry;
4834 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4845 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4847 v[juser] = references[jdevice];
4852 printError(
"getRefDutyCycles", p->
id,
ret);
4858 delete [] references;
4865 int off;
try{ off = device.
lut.at(j).offset; }
4866 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4867 int subIndex = device.
lut[j].deviceEntry;
4884 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4895 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4897 v[juser] = dutyCicles[jdevice];
4902 printError(
"getDutyCycles", p->
id,
ret);
4908 delete [] dutyCicles;
4924 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
4944 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
4946 vals[juser] = currs[jdevice];
4951 printError(
"getCurrents", p->
id,
ret);
4961 int off;
try { off = device.
lut.at(j).offset; }
catch(...) {
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4962 int subIndex=device.
lut[j].deviceEntry;
4982 int off;
try{ off = device.
lut.at(j).offset; }
4983 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
4984 int subIndex = device.
lut[j].deviceEntry;
5003 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
5014 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
5016 min[juser] = c_min[jdevice];
5017 max[juser] = c_max[jdevice];
5022 printError(
"getCurrentRanges", p->
id,
ret);
5038 for (
int l = 0; l<controlledJoints; l++)
5040 int off = device.
lut[l].offset;
5041 int subIndex = device.
lut[l].deviceEntry;
5059 int off;
try{ off = device.
lut.at(j).offset; }
5060 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
5061 int subIndex = device.
lut[j].deviceEntry;
5078 rpcDataMutex.lock();
5084 for (
int j = 0; j<n_joint; j++)
5086 subIndex = device.
lut[joints[j]].deviceEntry;
5092 for (subIndex = 0; subIndex<rpcData.
deviceNum; subIndex++)
5098 rpcData.
values[subIndex]);
5105 rpcDataMutex.unlock();
5113 for(
unsigned int d=0; d<device.
subdevices.size(); d++)
5124 for(
int juser= p->
wbase, jdevice=p->
base; juser<=p->wtop; juser++, jdevice++)
5126 t[juser] = references[jdevice];
5131 printError(
"getRefCurrents", p->
id,
ret);
5137 delete [] references;
5144 int off;
try{ off = device.
lut.at(j).offset; }
5145 catch (...){
yCError(
CONTROLBOARDWRAPPER,
"Joint number %d out of bound [0-%d] for part %s", j, controlledJoints, partName.c_str());
return false; }
5146 int subIndex = device.
lut[j].deviceEntry;
const yarp::os::LogComponent & CONTROLBOARDWRAPPER()
constexpr yarp::conf::vocab32_t VOCAB_CM_IDLE
bool getRefDutyCycle(int j, double *v) override
Gets the last reference sent using the setRefDutyCycle function.
bool getImpedance(int j, double *stiff, double *damp) override
Get current impedance gains (stiffness,damping,offset) for a specific joint.
bool getControlMode(int j, int *mode) override
Get the current control mode.
bool getTargetPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool setControlModes(const int n_joints, const int *joints, int *modes) override
Set the current control mode for a subset of axes.
bool open(yarp::os::Searchable &prop) override
Open the device driver.
bool getTemperatures(double *vals) override
Get temperature of all the motors.
bool abortPark() override
bool setEncoders(const double *vals) override
Set the value of all encoders.
bool setGearboxRatio(int m, const double val) override
Set the gearbox ratio for a specific motor.
bool setControlMode(const int j, const int mode) override
Set the current control mode.
bool getPidOutput(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
bool enableAmp(int j) override
Enable the amplifier on a specific joint.
bool getCurrentRanges(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
bool getPWMLimit(int m, double *val) override
bool getTorques(double *t) override
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
bool getLimits(int j, double *min, double *max) override
Get the software limits for a particular axis.
bool getAxes(int *ax) override
Get the number of controlled axes.
bool detachAll() override
Detach the object (you must have first called attach).
bool getNominalCurrent(int m, double *val) override
bool setRefCurrent(int j, double t) override
Set the reference value of the current for a single motor.
bool getEncoderTimed(int j, double *v, double *t) override
Read the instantaneous acceleration of all axes.
bool getMotorEncoderAccelerations(double *accs) override
Read the istantaneous acceleration of all axes.
bool getCurrentRange(int j, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
bool getEncoderAccelerations(double *accs) override
Read the istantaneous acceleration of 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 disablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
bool verbose() const
Return the value of the verbose flag.
bool setRefCurrents(const double *t) override
Set the reference value of the currents for all motors.
bool getCurrents(double *vals) override
Read the electric current going to all motors.
bool getMotorEncoders(double *encs) override
Read the position of all axes.
bool getRefVelocity(const int joint, double *vel) override
Get the last reference speed set by velocityMove for single joint.
bool setPidReference(const yarp::dev::PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
bool getPowerSupplyVoltage(int m, double *val) override
bool setRefTorque(int j, double t) override
Set the reference value of the torque for a given joint.
bool setTemperatureLimit(int m, const double val) override
Set the temperature limit for a specific motor.
bool setRefDutyCycles(const double *v) override
Sets the reference dutycycle for all the motors.
bool getTemperatureLimit(int m, double *val) override
Retreives the current temperature limit for a specific motor.
bool relativeMove(int j, double delta) override
Set relative position.
bool getTemperature(int m, double *val) override
Get temperature of a motor.
bool getRefCurrents(double *t) override
Get the reference value of the currents for all motors.
bool setPids(const yarp::dev::PidControlTypeEnum &pidtype, const yarp::dev::Pid *ps) override
Set new pid value on multiple axes.
bool setRefTorques(const double *t) override
Set the reference value of the torque for all joints.
bool calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3) override
Start calibration, this method is very often platform specific.
bool getMotorEncoderSpeeds(double *spds) override
Read the instantaneous speed of all axes.
bool getPids(const yarp::dev::PidControlTypeEnum &pidtype, yarp::dev::Pid *pids) override
Get current pid value for a specific joint.
bool getRefVelocities(double *vels) override
Get the last reference speed set by velocityMove for all joints.
bool positionMove(int j, double ref) override
Set new reference point for a single axis.
bool getMotorEncoder(int m, double *v) override
Read the value of an encoder.
bool resetMotorEncoder(int m) override
Reset encoder, single joint.
bool getMaxCurrent(int j, double *v) override
Returns the maximum electric current allowed for a given motor.
bool setEncoder(int j, double val) override
Set the value of the encoder for a given joint.
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 getRefPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
bool abortCalibration() override
bool setRefDutyCycle(int j, double v) override
Sets the reference dutycycle to a single motor.
bool getRefPositions(double *refs) override
Get the last position reference for all axes.
bool getRefTorque(int j, double *t) override
Get the reference value of the torque for a given joint.
bool getDutyCycles(double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool getMotorTorqueParams(int j, yarp::dev::MotorTorqueParameters *params) override
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool setMotorEncoders(const double *vals) override
Set the value of all encoders.
bool getPidError(const yarp::dev::PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
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 setPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
bool setMaxCurrent(int j, double v) override
Set the maximum electric current going to a given motor.
bool getAmpStatus(int *st) override
Get the status of the amplifiers, coded in a 32 bits integer for each amplifier (at the moment contai...
bool getRefCurrent(int j, double *t) override
Get the reference value of the current for a single motor.
bool setPWMLimit(int m, const double val) override
bool getMotorEncoderAcceleration(int m, double *acc) override
Read the instantaneous acceleration of an axis.
yarp::os::Stamp getLastInputStamp() override
Return the time stamp relative to the last acquisition.
bool getControlModes(int *modes) override
Get the current control mode (multiple joints).
bool getTorqueRange(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
bool calibrateWholePart() override
calibrateWholePart: call the procedure for calibrating the whole device
bool velocityMove(int j, double v) override
Set new reference speed for a single axis.
bool quitCalibrate() override
quitCalibrate: interrupt the calibration procedure
bool getRefDutyCycles(double *v) override
Gets the last reference sent using the setRefDutyCycles function.
bool getEncodersTimed(double *encs, double *t) override
Read the instantaneous acceleration of all axes.
bool getDutyCycle(int j, double *v) override
Gets the current dutycycle of the output of the amplifier (i.e.
bool stop() override
Stop motion, multiple joints.
bool resetMotorEncoders() override
Reset 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 enablePid(const yarp::dev::PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
bool getTargetPositions(double *refs) override
Get the last position reference for all axes.
bool getEncoderSpeed(int j, double *sp) override
Read the istantaneous speed of an axis.
bool getMotorEncoderSpeed(int m, double *sp) override
Read the istantaneous speed of an axis.
bool setMotorEncoderCountsPerRevolution(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
bool getNumberOfMotors(int *num) override
Retrieves the number of controlled axes from the current physical interface.
bool setPeakCurrent(int m, const double val) override
bool setNominalCurrent(int m, const double val) override
bool setPidOffset(const yarp::dev::PidControlTypeEnum &pidtype, int j, double v) override
Set offset value for a given controller.
bool getMotorEncoderCountsPerRevolution(int m, double *cpr) override
gets number of counts per revolution for motor encoder m.
bool setPid(const yarp::dev::PidControlTypeEnum &pidtype, int j, const yarp::dev::Pid &p) override
Set new pid value for a joint axis.
yarp::dev::IRemoteCalibrator * getCalibratorDevice() override
getCalibratorDevice: return the pointer stored with the setCalibratorDevice
bool disableAmp(int j) override
Disable the amplifier on a specific joint.
bool getPidOutputs(const yarp::dev::PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
bool parkSingleJoint(int j, bool _wait=true) override
parkSingleJoint(): start the parking procedure for the single joint
bool getImpedanceOffset(int j, double *offset) override
Get current force Offset for a specific joint.
bool setPosition(int j, double ref) override
Set new position for a single axis.
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 getRemoteVariable(std::string key, yarp::os::Bottle &val) override
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 getNumberOfMotorEncoders(int *num) override
Get the number of available 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 calibrateSingleJoint(int j) override
calibrateSingleJoint: call the calibration procedure for the single joint
bool setRefSpeeds(const double *spds) override
Set reference speed on all joints.
bool getEncoders(double *encs) override
Read the position of all axes.
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 calibrationDone(int j) override
Check whether the calibration has been completed.
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 getEncoder(int j, double *v) override
Read the value of an encoder.
bool setPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
bool checkMotionDone(int j, bool *flag) override
Check if the current trajectory is terminated.
bool setImpedanceOffset(int j, double offset) override
Set current force Offset for a specific joint.
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
bool setRefAccelerations(const double *accs) override
Set reference acceleration on all joints.
bool homingWholePart() override
homingWholePart: call the homing procedure for a the whole part/device
bool getRefSpeed(int j, double *ref) override
Get reference speed 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 isCalibratorDevicePresent(bool *isCalib) override
isCalibratorDevicePresent: check if a calibrator device has been set
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 getPidErrors(const yarp::dev::PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
bool setMotorEncoder(int m, const double val) override
Set the value of the encoder for a given joint.
bool setInteractionMode(int j, yarp::dev::InteractionModeEnum mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
bool getPWM(int m, double *val) override
bool getTorqueRanges(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
bool getEncoderAcceleration(int j, double *acc) override
Read the instantaneous acceleration of an axis.
~ControlBoardWrapper() override
bool getRefSpeeds(double *spds) override
Get reference speed of all joints.
bool setPidErrorLimit(const yarp::dev::PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specifi joint.
bool close() override
Close the device driver by deallocating all resources and closing ports.
bool getPidErrorLimits(const yarp::dev::PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
bool resetEncoders() override
Reset encoders.
bool isPidEnabled(const yarp::dev::PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid.
bool setCalibrationParameters(int j, const yarp::dev::CalibrationParameters ¶ms) override
Start calibration, this method is very often platform specific.
bool getRefAccelerations(double *accs) override
Get reference acceleration of all joints.
bool resetEncoder(int j) override
Reset encoder, single joint.
bool getCurrent(int j, double *val) override
Read the electric current going to a given motor.
bool setMotorTorqueParams(int j, const yarp::dev::MotorTorqueParameters params) override
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
bool getMotorEncoderTimed(int m, double *v, double *t) override
Read the instantaneous position of a motor encoder.
bool setRefAcceleration(int j, double acc) override
Set reference acceleration for a 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 getEncoderSpeeds(double *spds) override
Read the instantaneous speed of all axes.
bool getJointType(int j, yarp::dev::JointTypeEnum &type) override
bool getPidReferences(const yarp::dev::PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
bool parkWholePart() override
parkWholePart: start the parking procedure for the whole part
bool getPeakCurrent(int m, double *val) override
bool getGearboxRatio(int m, double *val) override
Get the gearbox ratio for a specific motor.
bool quitPark() override
quitPark: interrupt the park procedure
bool getAxisName(int j, std::string &name) override
bool setVelLimits(int j, double min, double max) override
Set the software velocity limits for a particular axis, the behavior of the control card when these l...
void run() override
The thread main loop deals with writing on ports here.
bool attachAll(const yarp::dev::PolyDriverList &l) override
Attach to a list of objects.
bool getVelLimits(int j, double *min, double *max) override
Get the software velocity limits for a particular axis.
bool getRefTorques(double *refs) override
Get the reference value of the torque for all joints.
bool setPositions(const int n_joints, const int *joints, const double *dpos) override
Set new reference point for all axes.
bool getMotorEncodersTimed(double *encs, double *t) override
Read the instantaneous position of all motor encoders.
void resize(int _deviceNum, int _maxJointsNumForDevice, WrappedDevice *_device)
int * subdev_jointsVectorLen
SubDevice ** subdevices_p
void init(ControlBoardWrapper *x)
Initialization.
virtual bool initialize()
Initialize the internal data.
void init(ControlBoardWrapper *x)
Initialization.
void setVerbose(bool _verbose)
yarp::dev::IControlLimits * lim
yarp::dev::IImpedanceControl * iImpedance
bool configure(int wbase, int wtop, int base, int top, int axes, const std::string &id, ControlBoardWrapper *_parent)
yarp::dev::IMotorEncoders * iMotEnc
yarp::dev::IControlMode * iMode
yarp::dev::IEncodersTimed * iJntEnc
yarp::dev::IVelocityControl * vel
yarp::dev::IAmplifierControl * amp
yarp::dev::IAxisInfo * info
yarp::dev::IMotor * imotor
yarp::dev::IInteractionMode * iInteract
yarp::dev::IPositionControl * pos
yarp::dev::ITorqueControl * iTorque
yarp::dev::IPidControl * pid
yarp::dev::IRemoteVariables * iVar
yarp::dev::IPWMControl * iPWM
yarp::dev::IPositionDirect * posDir
yarp::dev::IControlCalibration * calib
yarp::dev::ICurrentControl * iCurr
std::vector< DevicesLutEntry > lut
SubDevice * getSubdevice(unsigned int i)
int maxNumOfJointsInDevices
SubDeviceVector subdevices
bool view(T *&x)
Get an interface to the device driver.
void attach(yarp::os::TypedReader< yarp::os::Bottle > &source)
Attach this object to a source of messages.
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 getCurrents(double *vals)=0
virtual bool disableAmp(int j)=0
Disable the amplifier on a specific joint.
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 getCurrent(int j, double *val)=0
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)
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 getCurrents(double *currs)=0
Get the instantaneous current measurement for all motors.
virtual bool setRefCurrent(int m, double curr)=0
Set the reference value of the current for a single motor.
virtual bool getRefCurrents(double *currs)=0
Get the reference value of the currents for all motors.
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 getCurrentRanges(double *min, double *max)=0
Get the full scale of the current measurements for all motors motor (e.g.
virtual bool getEncodersTimed(double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
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 getEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all axes.
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 getAxes(int *ax)=0
Get the number of controlled axes.
virtual bool getEncoders(double *encs)=0
Read the position of all axes.
virtual bool getEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all axes.
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 getMotorEncodersTimed(double *encs, double *time)=0
Read the instantaneous position of all motor encoders.
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 getMotorEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all motor encoders.
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 getMotorEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all motor encoders.
virtual bool getMotorEncoders(double *encs)=0
Read the position of all motor encoders.
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 getTemperatures(double *vals)=0
Get temperature of all the motors.
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 getRefDutyCycles(double *refs)=0
Gets the last reference sent using the setRefDutyCycles function.
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 getDutyCycles(double *vals)=0
Gets the current dutycycle of the output of the amplifier (i.e.
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 getPidReferences(const PidControlTypeEnum &pidtype, double *refs)=0
Get the current reference of all pid controllers.
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 getPidErrorLimits(const PidControlTypeEnum &pidtype, double *limits)=0
Get the error limit for all controllers.
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 getPidOutputs(const PidControlTypeEnum &pidtype, double *outs)=0
Get the output of the controllers (e.g.
virtual bool setPidReference(const PidControlTypeEnum &pidtype, int j, double ref)=0
Set the controller reference for a given axis.
virtual bool getPidErrors(const PidControlTypeEnum &pidtype, double *errs)=0
Get the error of all joints.
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 getPids(const PidControlTypeEnum &pidtype, Pid *pids)=0
Get current pid value for a specific joint.
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.
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 isCalibratorDevicePresent(bool *isCalib)
isCalibratorDevicePresent: check if a calibrator device has been set
virtual bool homingWholePart()=0
homingWholePart: call the homing procedure for a the whole part/device
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 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 getRefTorques(double *t)=0
Get 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 getTorques(double *t)=0
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
virtual bool getTorqueRange(int j, double *min, double *max)=0
Get the full scale of the torque sensor of a given joint.
virtual bool getTorqueRanges(double *min, double *max)=0
Get the full scale of the torque sensors of all joints.
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 container for a device driver.
bool close() override
Close the DeviceDriver.
bool isValid() const
Check if device is valid.
bool open(const std::string &txt)
Construct and configure a device by its common name.
yarp::sig::VectorOf< double > motorVelocity
yarp::sig::VectorOf< double > jointAcceleration
yarp::sig::VectorOf< int > controlMode
bool pwmDutycycle_isValid
yarp::sig::VectorOf< int > interactionMode
yarp::sig::VectorOf< double > current
bool jointVelocity_isValid
yarp::sig::VectorOf< double > motorAcceleration
bool motorVelocity_isValid
yarp::sig::VectorOf< double > motorPosition
yarp::sig::VectorOf< double > pwmDutycycle
bool jointAcceleration_isValid
yarp::sig::VectorOf< double > torque
bool motorAcceleration_isValid
bool interactionMode_isValid
yarp::sig::VectorOf< double > jointPosition
bool motorPosition_isValid
bool jointPosition_isValid
yarp::sig::VectorOf< double > jointVelocity
A simple collection of objects that can be described and transmitted in a portable way.
void fromString(const std::string &text)
Initializes bottle from a string.
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.
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Bottle tail() const
Get all but the first element of a bottle.
bool isNull() const override
Checks if the object is invalid.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An abstraction for a periodic thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
void attach(Port &port)
Attach this buffer to a particular port.
void write(bool forceStrict=false)
Try to write the last buffer returned by PortWriterBuffer::get.
T & get()
A synonym of PortWriterBuffer::prepare.
void attach(Port &port)
Set the Port to which objects will be written.
void setReader(PortReader &reader) override
Set an external reader for port data.
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
void interrupt() override
Interrupt any current reads or writes attached to the port.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
std::string toString() const override
Return a standard text representation of the content of the object.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
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.
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
bool topic(const std::string &name)
Set topic to publish to.
void write(bool forceStrict=false)
Write the current object being returned by Publisher::prepare.
A base class for nested structures that can be searched.
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
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...
double getTime() const
Get the time stamp.
A single value (typically within a Bottle).
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual Bottle * asList() const
Get list value.
std::string toString() const override
Return a standard text representation of the content of the object.
virtual bool isInt32() const
Checks if value is a 32-bit integer.
virtual std::string asString() const
Get string value.
std::vector< std::string > name
std::vector< yarp::conf::float64_t > position
std::vector< yarp::conf::float64_t > velocity
std::vector< yarp::conf::float64_t > effort
yarp::rosmsg::std_msgs::Header header
void resize(size_t size) override
Resize the vector.
iterator begin() noexcept
Returns an iterator to the beginning of the VectorOf.
T * data()
Return a pointer to the first element of the vector.
iterator end() noexcept
Returns an iterator to the end of the VectorOf.
#define yCInfo(component,...)
#define yCError(component,...)
#define yCTrace(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
An interface for the device drivers.
@ VOCAB_JOINTTYPE_REVOLUTE
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.
double convertDegreesToRadians(double degrees)
convert degrees to radiants for ROS messages