YARP
Yet Another Robot Platform
ControlBoardRemapper.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #include "ControlBoardRemapper.h"
9 
10 #include <yarp/os/Log.h>
11 #include <yarp/os/LogStream.h>
12 
13 #include <algorithm>
14 #include <iostream>
15 #include <map>
16 #include <mutex>
17 #include <cassert>
18 
19 using namespace yarp::os;
20 using namespace yarp::dev;
21 using namespace yarp::sig;
22 
24 {
25  return detachAll();
26 }
27 
29 {
30  Property prop;
31  prop.fromString(config.toString());
32 
33  _verb = (prop.check("verbose","if present, give detailed output"));
34  if (_verb)
35  {
36  yCInfo(CONTROLBOARDREMAPPER, "running with verbose output");
37  }
38 
39  if(!parseOptions(prop))
40  {
41  return false;
42  }
43 
44  return true;
45 }
46 
47 bool ControlBoardRemapper::parseOptions(Property& prop)
48 {
49  bool ok = true;
50 
51  usingAxesNamesForAttachAll = prop.check("axesNames", "list of networks merged by this wrapper");
52  usingNetworksForAttachAll = prop.check("networks", "list of networks merged by this wrapper");
53 
54 
55  if( usingAxesNamesForAttachAll &&
56  usingNetworksForAttachAll )
57  {
58  yCError(CONTROLBOARDREMAPPER) << "Both axesNames and networks option present, this is not supported.";
59  return false;
60  }
61 
62  if( !usingAxesNamesForAttachAll &&
63  !usingNetworksForAttachAll )
64  {
65  yCError(CONTROLBOARDREMAPPER) << "axesNames option not found";
66  return false;
67  }
68 
69  if( usingAxesNamesForAttachAll )
70  {
71  ok = parseAxesNames(prop);
72  }
73 
74  if( usingNetworksForAttachAll )
75  {
76  ok = parseNetworks(prop);
77  }
78 
79  return ok;
80 }
81 
82 bool ControlBoardRemapper::parseAxesNames(const Property& prop)
83 {
84  Bottle *propAxesNames=prop.find("axesNames").asList();
85  if(propAxesNames==nullptr)
86  {
87  yCError(CONTROLBOARDREMAPPER) << "Parsing parameters: \"axesNames\" should be followed by a list";
88  return false;
89  }
90 
91  axesNames.resize(propAxesNames->size());
92  for(size_t ax=0; ax < propAxesNames->size(); ax++)
93  {
94  axesNames[ax] = propAxesNames->get(ax).asString();
95  }
96 
97  this->setNrOfControlledAxes(axesNames.size());
98 
99  return true;
100 }
101 
102 bool ControlBoardRemapper::parseNetworks(const Property& prop)
103 {
104  Bottle *nets=prop.find("networks").asList();
105  if(nets==nullptr)
106  {
107  yCError(CONTROLBOARDREMAPPER) << "Parsing parameters: \"networks\" should be followed by a list";
108  return false;
109  }
110 
111  if (!prop.check("joints", "number of joints of the part"))
112  {
113  yCError(CONTROLBOARDREMAPPER) << "joints options not found when reading networks option";
114  return false;
115  }
116 
117  this->setNrOfControlledAxes((size_t)prop.find("joints").asInt32());
118 
119  int nsubdevices=nets->size();
120  remappedControlBoards.lut.resize(controlledJoints);
121  remappedControlBoards.subdevices.resize(nsubdevices);
122 
123  // configure the devices
124  for(size_t k=0;k<nets->size();k++)
125  {
126  Bottle parameters;
127  int wBase;
128  int wTop;
129  int base;
130  int top;
131 
132  parameters=prop.findGroup(nets->get(k).asString());
133 
134  if(parameters.size()==2)
135  {
136  Bottle *bot=parameters.get(1).asList();
137  Bottle tmpBot;
138  if(bot==nullptr)
139  {
140  // probably data are not passed in the correct way, try to read them as a string.
141  std::string bString(parameters.get(1).asString());
142  tmpBot.fromString(bString);
143 
144  if(tmpBot.size() != 4)
145  {
147  << "Check network parameters in part description"
148  << "--> I was expecting" << nets->get(k).asString() << "followed by a list of four integers in parenthesis"
149  << "Got:" << parameters.toString();
150  return false;
151  }
152  else
153  {
154  bot = &tmpBot;
155  }
156  }
157 
158  // If I came here, bot is correct
159  wBase=bot->get(0).asInt32();
160  wTop=bot->get(1).asInt32();
161  base=bot->get(2).asInt32();
162  top=bot->get(3).asInt32();
163  }
164  else if (parameters.size()==5)
165  {
166  // yCError(CONTROLBOARDREMAPPER) << "Parameter networks use deprecated syntax";
167  wBase=parameters.get(1).asInt32();
168  wTop=parameters.get(2).asInt32();
169  base=parameters.get(3).asInt32();
170  top=parameters.get(4).asInt32();
171  }
172  else
173  {
175  << "Check network parameters in part description"
176  << "--> I was expecting" << nets->get(k).asString() << "followed by a list of four integers in parenthesis"
177  << "Got:" << parameters.toString();
178  return false;
179  }
180 
181  RemappedSubControlBoard *tmpDevice=remappedControlBoards.getSubControlBoard((size_t)k);
182  tmpDevice->setVerbose(_verb);
183 
184  if( (wTop-wBase) != (top-base) )
185  {
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();
189  }
190 
191  tmpDevice->id = nets->get(k).asString();
192 
193  for(int j=wBase;j<=wTop;j++)
194  {
195  int off = j-wBase;
196  remappedControlBoards.lut[j].subControlBoardIndex=k;
197  remappedControlBoards.lut[j].axisIndexInSubControlBoard=base+off;
198  }
199  }
200 
201  return true;
202 }
203 
204 void ControlBoardRemapper::setNrOfControlledAxes(const size_t nrOfControlledAxes)
205 {
206  controlledJoints = nrOfControlledAxes;
207  buffers.controlBoardModes.resize(nrOfControlledAxes,0);
208  buffers.dummyBuffer.resize(nrOfControlledAxes,0.0);
209 }
210 
211 
212 bool ControlBoardRemapper::updateAxesName()
213 {
214  bool ret = true;
215  axesNames.resize(controlledJoints);
216 
217  for(int l=0; l < controlledJoints; l++)
218  {
219  std::string axNameYARP;
220  bool ok = this->getAxisName(l,axNameYARP);
221  if( ok )
222  {
223  axesNames[l] = axNameYARP;
224  }
225 
226  ret = ret && ok;
227  }
228 
229  return ret;
230 }
231 
233 {
234  // For both cases, now configure everything that need
235  // all the attribute to be correctly configured
236  bool ok = false;
237 
238  if( usingAxesNamesForAttachAll )
239  {
240  ok = attachAllUsingAxesNames(polylist);
241  }
242 
243  if( usingNetworksForAttachAll )
244  {
245  ok = attachAllUsingNetworks(polylist);
246  }
247 
248  //check if all devices are attached to the driver
249  bool ready=true;
250  for(unsigned int k=0; k<remappedControlBoards.getNrOfSubControlBoards(); k++)
251  {
252  if (!remappedControlBoards.subdevices[k].isAttached())
253  {
254  ready=false;
255  }
256  }
257 
258  if (!ready)
259  {
260  yCError(CONTROLBOARDREMAPPER, "AttachAll failed, some subdevice was not found or its attach failed");
261  return false;
262  }
263 
264  if( ok )
265  {
266  configureBuffers();
267  }
268 
269  return ok;
270 }
271 
272 // First we store a map between each axes name
273 // in the passed PolyDriverList and the device in which they belong and their index
275 {
276  std::string subDeviceKey;
279 };
280 
281 
282 bool ControlBoardRemapper::attachAllUsingAxesNames(const PolyDriverList& polylist)
283 {
284  std::map<std::string, axisLocation> axesLocationMap;
285 
286  for(int p=0;p<polylist.size();p++)
287  {
288  // If there is a device with a specific device key, use it
289  // as a calibrator, otherwise rely on the subcontrolboards
290  // as usual
291  std::string deviceKey=polylist[p]->key;
292  if(deviceKey == "Calibrator" || deviceKey == "calibrator")
293  {
294  // Set the IRemoteCalibrator interface, the wrapper must point to the calibrator rdevice
295  yarp::dev::IRemoteCalibrator *calibrator;
296  polylist[p]->poly->view(calibrator);
297 
298  IRemoteCalibrator::setCalibratorDevice(calibrator);
299  continue;
300  }
301 
302  // find if one of the desired axis is in this device
303  yarp::dev::IAxisInfo *iaxinfos = nullptr;
304  yarp::dev::IEncoders *iencs = nullptr;
305  polylist[p]->poly->view(iaxinfos);
306  polylist[p]->poly->view(iencs);
307 
308  if( !iencs ||
309  !iaxinfos )
310  {
311  yCError(CONTROLBOARDREMAPPER) << "subdevice" << deviceKey << "does not implemented the required IAxisInfo or IEncoders interfaces";
312  return false;
313  }
314 
315  int nrOfSubdeviceAxes;
316  bool ok = iencs->getAxes(&nrOfSubdeviceAxes);
317 
318  if( !ok )
319  {
320  yCError(CONTROLBOARDREMAPPER) << "subdevice" << deviceKey << "does not implemented the required getAxes method";
321  return false;
322  }
323 
324  for(int axInSubDevice =0; axInSubDevice < nrOfSubdeviceAxes; axInSubDevice++)
325  {
326  std::string axNameYARP;
327  ok = iaxinfos->getAxisName(axInSubDevice,axNameYARP);
328 
329  std::string axName = axNameYARP;
330 
331  if( !ok )
332  {
333  yCError(CONTROLBOARDREMAPPER) << "subdevice" << deviceKey << "does not implemented the required getAxisName method";
334  return false;
335  }
336 
337  auto it = axesLocationMap.find(axName);
338  if( it != axesLocationMap.end() )
339  {
341  << "multiple axes have the same name" << axName
342  << "on on device " << polylist[p]->key << "with index" << axInSubDevice
343  <<"and another on device" << it->second.subDeviceKey << "with index" << it->second.indexInSubDevice;
344  return false;
345  }
346 
347  axisLocation newLocation;
348  newLocation.subDeviceKey = polylist[p]->key;
349  newLocation.indexInSubDevice = axInSubDevice;
350  newLocation.indexOfSubDeviceInPolyDriverList = p;
351  axesLocationMap[axName] = newLocation;
352  }
353  }
354 
355  // We store the key of all the devices that we actually use in the remapped control device
356  std::vector<std::string> subControlBoardsKeys;
357  std::map<std::string, size_t> subControlBoardKey2IndexInPolyDriverList;
358  std::map<std::string, size_t> subControlBoardKey2IndexInRemappedControlBoards;
359 
360 
361  // Once we build the axis map, we build the mapping between the remapped axes and
362  // the couple subControlBoard, axis in subControlBoard
363  for(const auto& axesName : axesNames)
364  {
365  auto it = axesLocationMap.find(axesName);
366  if( it == axesLocationMap.end() )
367  {
369  << "axis " << axesName
370  << "specified in axesNames was not found in the axes of the controlboards passed to attachAll, attachAll failed.";
371  return false;
372  }
373 
374  axisLocation loc = it->second;
375  std::string key = loc.subDeviceKey;
376 
377  if(std::find(subControlBoardsKeys.begin(), subControlBoardsKeys.end(), key) == subControlBoardsKeys.end())
378  {
379  /* subControlBoardsKeys does not contain key */
380  subControlBoardKey2IndexInRemappedControlBoards[key] = subControlBoardsKeys.size();
381  subControlBoardsKeys.push_back(key);
382  subControlBoardKey2IndexInPolyDriverList[key] = loc.indexOfSubDeviceInPolyDriverList;
383  }
384  }
385 
386  assert(controlledJoints == (int) axesNames.size());
387 
388  // We have now the number of controlboards to attach to
389  size_t nrOfSubControlBoards = subControlBoardsKeys.size();
390  remappedControlBoards.lut.resize(controlledJoints);
391  remappedControlBoards.subdevices.resize(nrOfSubControlBoards);
392 
393  // Open the controlboards
394  for(size_t ctrlBrd=0; ctrlBrd < nrOfSubControlBoards; ctrlBrd++)
395  {
396  size_t p = subControlBoardKey2IndexInPolyDriverList[subControlBoardsKeys[ctrlBrd]];
397  RemappedSubControlBoard *tmpDevice = remappedControlBoards.getSubControlBoard(ctrlBrd);
398  tmpDevice->setVerbose(_verb);
399  tmpDevice->id = subControlBoardsKeys[ctrlBrd];
400  bool ok = tmpDevice->attach(polylist[p]->poly,subControlBoardsKeys[ctrlBrd]);
401 
402  if( !ok )
403  {
404  return false;
405  }
406  }
407 
408 
409  for(size_t l=0; l < axesNames.size(); l++)
410  {
411  axisLocation loc = axesLocationMap[axesNames[l]];
412  remappedControlBoards.lut[l].subControlBoardIndex = subControlBoardKey2IndexInRemappedControlBoards[loc.subDeviceKey];
413  remappedControlBoards.lut[l].axisIndexInSubControlBoard = (size_t)loc.indexInSubDevice;
414  }
415 
416  return true;
417 }
418 
419 
420 bool ControlBoardRemapper::attachAllUsingNetworks(const PolyDriverList &polylist)
421 {
422  for(int p=0;p<polylist.size();p++)
423  {
424  // look if we have to attach to a calibrator
425  std::string subDeviceKey = polylist[p]->key;
426  if(subDeviceKey == "Calibrator" || subDeviceKey == "calibrator")
427  {
428  // Set the IRemoteCalibrator interface, the wrapper must point to the calibrator rdevice
429  yarp::dev::IRemoteCalibrator *calibrator;
430  polylist[p]->poly->view(calibrator);
431 
432  IRemoteCalibrator::setCalibratorDevice(calibrator);
433  continue;
434  }
435 
436  // find appropriate entry in list of subdevices and attach
437  unsigned int k=0;
438  for(k=0; k<remappedControlBoards.getNrOfSubControlBoards(); k++)
439  {
440  if (remappedControlBoards.subdevices[k].id==subDeviceKey)
441  {
442  if (!remappedControlBoards.subdevices[k].attach(polylist[p]->poly, subDeviceKey))
443  {
444  yCError(CONTROLBOARDREMAPPER, "attach to subdevice %s failed", polylist[p]->key.c_str());
445  return false;
446  }
447  }
448  }
449  }
450 
451  bool ok = updateAxesName();
452 
453  if( !ok )
454  {
455  yCWarning(CONTROLBOARDREMAPPER) << "unable to update axesNames";
456  }
457 
458  return true;
459 }
460 
461 
463 {
464  //check if we already instantiated a subdevice previously
465  int devices=remappedControlBoards.getNrOfSubControlBoards();
466  for (int k = 0; k < devices; k++) {
467  remappedControlBoards.getSubControlBoard(k)->detach();
468  }
469 
470  IRemoteCalibrator::releaseCalibratorDevice();
471  return true;
472 }
473 
474 void ControlBoardRemapper::configureBuffers()
475 {
476  allJointsBuffers.configure(remappedControlBoards);
477  selectedJointsBuffers.configure(remappedControlBoards);
478 }
479 
480 
481 bool ControlBoardRemapper::setControlModeAllAxes(const int cm)
482 {
483  std::lock_guard<std::mutex> lock(buffers.mutex);
484 
485  for(int j=0; j < controlledJoints; j++)
486  {
487  buffers.controlBoardModes[j] = cm;
488  }
489 
490  return this->setControlModes(buffers.controlBoardModes.data());
491 }
492 
496 
497 //
498 // IPid Interface
499 //
500 bool ControlBoardRemapper::setPid(const PidControlTypeEnum& pidtype, int j, const Pid &p)
501 {
502  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
503  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
504 
505  RemappedSubControlBoard *s=remappedControlBoards.getSubControlBoard(subIndex);
506  if (!s)
507  {
508  return false;
509  }
510 
511  if (s->pid)
512  {
513  return s->pid->setPid(pidtype, off, p);
514  }
515 
516  return false;
517 }
518 
519 bool ControlBoardRemapper::setPids(const PidControlTypeEnum& pidtype, const Pid *ps)
520 {
521  bool ret=true;
522 
523  for(int l=0;l<controlledJoints;l++)
524  {
525  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
526 
527  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
528 
529  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
530  if (!p)
531  {
532  return false;
533  }
534 
535  if (p->pid)
536  {
537  bool ok = p->pid->setPid(pidtype, off, ps[l]);
538  ret=ret&&ok;
539  }
540  else
541  {
542  ret=false;
543  }
544  }
545  return ret;
546 }
547 
548 bool ControlBoardRemapper::setPidReference(const PidControlTypeEnum& pidtype, int j, double ref)
549 {
550  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
551  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
552 
553  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
554 
555  if (!p)
556  {
557  return false;
558  }
559 
560  if (p->pid)
561  {
562  return p->pid->setPidReference(pidtype, off, ref);
563  }
564 
565  return false;
566 }
567 
568 bool ControlBoardRemapper::setPidReferences(const PidControlTypeEnum& pidtype, const double *refs)
569 {
570  bool ret=true;
571 
572  for(int l=0;l<controlledJoints;l++)
573  {
574  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
575 
576  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
577 
578  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
579  if (!p)
580  {
581  return false;
582  }
583 
584  if (p->pid)
585  {
586  bool ok = p->pid->setPidReference(pidtype, off, refs[l]);
587  ret=ret&&ok;
588  }
589  else
590  {
591  ret=false;
592  }
593  }
594  return ret;
595 }
596 
597 bool ControlBoardRemapper::setPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double limit)
598 {
599  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
600  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
601 
602  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
603  if (!p)
604  {
605  return false;
606  }
607 
608  if (p->pid)
609  {
610  return p->pid->setPidErrorLimit(pidtype, off, limit);
611  }
612 
613  return false;
614 }
615 
616 bool ControlBoardRemapper::setPidErrorLimits(const PidControlTypeEnum& pidtype, const double *limits)
617 {
618  bool ret=true;
619 
620  for(int l=0;l<controlledJoints;l++)
621  {
622  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
623 
624  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
625 
626  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
627  if (!p)
628  {
629  return false;
630  }
631 
632  if (p->pid)
633  {
634  bool ok = p->pid->setPidErrorLimit(pidtype, off, limits[l]);
635  ret=ret&&ok;
636  }
637  else
638  {
639  ret=false;
640  }
641  }
642  return ret;
643 }
644 
645 bool ControlBoardRemapper::getPidError(const PidControlTypeEnum& pidtype, int j, double *err)
646 {
647  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
648  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
649 
650  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
651 
652  if (!p)
653  {
654  return false;
655  }
656 
657  if (p->pid)
658  {
659  return p->pid->getPidError(pidtype, off, err);
660  }
661 
662  return false;
663 }
664 
665 bool ControlBoardRemapper::getPidErrors(const PidControlTypeEnum& pidtype, double *errs)
666 {
667  bool ret=true;
668 
669  for(int l=0;l<controlledJoints;l++)
670  {
671  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
672  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
673 
674  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
675  if (!p)
676  {
677  return false;
678  }
679 
680  if (p->pid)
681  {
682  bool ok = p->pid->getPidError(pidtype, off, errs+l);
683  ret=ret&&ok;
684  }
685  else
686  {
687  ret=false;
688  }
689  }
690  return ret;
691 }
692 
693 bool ControlBoardRemapper::getPidOutput(const PidControlTypeEnum& pidtype, int j, double *out)
694 {
695  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
696  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
697 
698  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
699  if (!p)
700  {
701  return false;
702  }
703 
704  if (p->pid)
705  {
706  return p->pid->getPidOutput(pidtype, off, out);
707  }
708 
709  return false;
710 }
711 
712 bool ControlBoardRemapper::getPidOutputs(const PidControlTypeEnum& pidtype, double *outs)
713 {
714  bool ret=true;
715 
716  for(int l=0;l<controlledJoints;l++)
717  {
718  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
719 
720  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
721 
722  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
723  if (!p)
724  {
725  return false;
726  }
727 
728  if (p->pid)
729  {
730  ret=ret&&p->pid->getPidOutput(pidtype, off, outs+l);
731  }
732  else
733  {
734  ret=false;
735  }
736  }
737  return ret;
738 }
739 
740 bool ControlBoardRemapper::setPidOffset(const PidControlTypeEnum& pidtype, int j, double v)
741 {
742  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
743  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
744 
745  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
746  if (!p)
747  {
748  return false;
749  }
750 
751  if (p->pid)
752  {
753  return p->pid->setPidOffset(pidtype, off, v);
754  }
755 
756  return false;
757 }
758 
759 bool ControlBoardRemapper::getPid(const PidControlTypeEnum& pidtype, int j, Pid *p)
760 {
761  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
762  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
763 
764  RemappedSubControlBoard *s=remappedControlBoards.getSubControlBoard(subIndex);
765  if (!s)
766  {
767  return false;
768  }
769 
770  if (s->pid)
771  {
772  return s->pid->getPid(pidtype, off, p);
773  }
774 
775  return false;
776 }
777 
779 {
780  bool ret=true;
781 
782  for(int l=0;l<controlledJoints;l++)
783  {
784  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
785  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
786 
787  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
788  if (!p)
789  {
790  return false;
791  }
792 
793  if (p->pid)
794  {
795  bool ok = p->pid->getPid(pidtype, off, pids+l);
796  ret = ok && ret;
797  }
798  else
799  {
800  ret=false;
801  }
802  }
803 
804  return ret;
805 }
806 
807 bool ControlBoardRemapper::getPidReference(const PidControlTypeEnum& pidtype, int j, double *ref)
808 {
809  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
810  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
811 
812  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
813  if (!p)
814  {
815  return false;
816  }
817 
818  if (p->pid)
819  {
820  return p->pid->getPidReference(pidtype, off, ref);
821  }
822 
823  return false;
824 }
825 
827 {
828  bool ret=true;
829 
830  for(int l=0;l<controlledJoints;l++)
831  {
832  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
833 
834  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
835 
836  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
837  if (!p)
838  {
839  return false;
840  }
841 
842  if (p->pid)
843  {
844  bool ok = p->pid->getPidReference(pidtype, off, refs+l);
845  ret=ret && ok;
846  }
847  else
848  {
849  ret=false;
850  }
851  }
852  return ret;
853 }
854 
855 bool ControlBoardRemapper::getPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double *limit)
856 {
857  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
858  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
859 
860  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
861 
862  if (!p)
863  {
864  return false;
865  }
866 
867  if (p->pid)
868  {
869  return p->pid->getPidErrorLimit(pidtype, off, limit);
870  }
871  return false;
872 }
873 
875 {
876  bool ret=true;
877 
878  for(int l=0;l<controlledJoints;l++)
879  {
880  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
881 
882  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
883 
884  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
885 
886  if (!p)
887  {
888  return false;
889  }
890 
891  if (p->pid)
892  {
893  bool ok = p->pid->getPidErrorLimit(pidtype, off, limits+l);
894  ret=ret&&ok;
895  }
896  else
897  {
898  ret=false;
899  }
900  }
901  return ret;
902 }
903 
905 {
906  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
907  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
908 
909  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
910 
911  if (!p)
912  {
913  return false;
914  }
915 
916  if (p->pid)
917  {
918  return p->pid->resetPid(pidtype, off);
919  }
920 
921  return false;
922 }
923 
925 {
926  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
927  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
928 
929  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
930 
931  if (!p)
932  {
933  return false;
934  }
935 
936  return p->pid->disablePid(pidtype, off);
937 }
938 
940 {
941  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
942  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
943 
944  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
945 
946  if (!p)
947  {
948  return false;
949  }
950 
951  if (p->pid)
952  {
953  return p->pid->enablePid(pidtype, off);
954  }
955 
956  return false;
957 }
958 
959 bool ControlBoardRemapper::isPidEnabled(const PidControlTypeEnum& pidtype, int j, bool* enabled)
960 {
961  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
962  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
963 
964  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
965 
966  if (!p)
967  {
968  return false;
969  }
970 
971  if (p->pid)
972  {
973  return p->pid->isPidEnabled(pidtype, off, enabled);
974  }
975 
976  return false;
977 }
978 
979 /* IPositionControl */
981 {
982  *ax=controlledJoints;
983  return true;
984 }
985 
986 bool ControlBoardRemapper::positionMove(int j, double ref)
987 {
988  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
989  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
990 
991  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
992 
993  if (!p)
994  {
995  return false;
996  }
997 
998  if (p->pos)
999  {
1000  return p->pos->positionMove(off, ref);
1001  }
1002 
1003  return false;
1004 }
1005 
1006 bool ControlBoardRemapper::positionMove(const double *refs)
1007 {
1008  bool ret=true;
1009  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1010 
1011  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(refs,remappedControlBoards);
1012 
1013  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1014  {
1015  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1016 
1017  bool ok = p->pos->positionMove(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1018  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1019  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1020  ret = ret && ok;
1021  }
1022 
1023  return ret;
1024 }
1025 
1026 bool ControlBoardRemapper::positionMove(const int n_joints, const int *joints, const double *refs)
1027 {
1028  bool ret=true;
1029  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1030 
1031  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(refs,n_joints,joints,remappedControlBoards);
1032 
1033  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1034  {
1035  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1036 
1037  bool ok = p->pos->positionMove(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1038  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1039  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1040  ret = ret && ok;
1041  }
1042 
1043  return ret;
1044 }
1045 
1046 bool ControlBoardRemapper::getTargetPosition(const int j, double* ref)
1047 {
1048  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1049  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1050 
1051  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1052 
1053  if (!p)
1054  {
1055  return false;
1056  }
1057 
1058  if (p->pos)
1059  {
1060  bool ret = p->pos->getTargetPosition(off, ref);
1061  return ret;
1062  }
1063 
1064  return false;
1065 }
1066 
1068 {
1069  bool ret=true;
1070  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1071 
1072  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1073  {
1074  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1075 
1076  bool ok = true;
1077 
1078  if( p->pos )
1079  {
1080  ok = p->pos->getTargetPositions(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1081  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1082  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1083  }
1084  else
1085  {
1086  ok = false;
1087  }
1088 
1089  ret = ret && ok;
1090  }
1091 
1092  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(spds,remappedControlBoards);
1093 
1094  return ret;
1095 }
1096 
1097 
1098 bool ControlBoardRemapper::getTargetPositions(const int n_joints, const int *joints, double *targets)
1099 {
1100  bool ret=true;
1101  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1102 
1103  // Resize the input buffers
1104  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
1105 
1106  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1107  {
1108  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1109 
1110  bool ok = true;
1111 
1112  if( p->pos )
1113  {
1114  ok = p->pos->getTargetPositions(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1115  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1116  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1117  }
1118  else
1119  {
1120  ok = false;
1121  }
1122 
1123  ret = ret && ok;
1124  }
1125 
1126  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(targets,n_joints,joints,remappedControlBoards);
1127 
1128  return ret;
1129 }
1130 
1131 bool ControlBoardRemapper::relativeMove(int j, double delta)
1132 {
1133  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1134  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1135 
1136  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1137 
1138  if (!p)
1139  {
1140  return false;
1141  }
1142 
1143  if (p->pos)
1144  {
1145  return p->pos->relativeMove(off, delta);
1146  }
1147 
1148  return false;
1149 }
1150 
1151 bool ControlBoardRemapper::relativeMove(const double *deltas)
1152 {
1153  bool ret=true;
1154  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1155 
1156  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(deltas,remappedControlBoards);
1157 
1158  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1159  {
1160  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1161 
1162  bool ok = p->pos->relativeMove(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1163  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1164  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1165  ret = ret && ok;
1166  }
1167 
1168  return ret;
1169 }
1170 
1171 bool ControlBoardRemapper::relativeMove(const int n_joints, const int *joints, const double *deltas)
1172 {
1173  bool ret=true;
1174  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1175 
1176  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(deltas,n_joints,joints,remappedControlBoards);
1177 
1178  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1179  {
1180  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1181 
1182  bool ok = p->pos->relativeMove(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1183  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1184  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1185  ret = ret && ok;
1186  }
1187 
1188  return ret;
1189 }
1190 
1192 {
1193  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1194  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1195 
1196  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1197 
1198  if (!p)
1199  {
1200  return false;
1201  }
1202 
1203  if (p->pos)
1204  {
1205  return p->pos->checkMotionDone(off, flag);
1206  }
1207 
1208  return false;
1209 }
1210 
1212 {
1213  bool ret=true;
1214  *flag=true;
1215 
1216  for(int l=0;l<controlledJoints;l++)
1217  {
1218  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1219  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1220 
1221  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1222 
1223  if (!p)
1224  {
1225  return false;
1226  }
1227 
1228  if (p->pos)
1229  {
1230  bool singleJointMotionDone =false;
1231  bool ok = p->pos->checkMotionDone(off, &singleJointMotionDone);
1232  ret = ret && ok;
1233  *flag = *flag && singleJointMotionDone;
1234  }
1235  else
1236  {
1237  ret = false;
1238  }
1239  }
1240  return ret;
1241 }
1242 
1243 bool ControlBoardRemapper::checkMotionDone(const int n_joints, const int *joints, bool *flag)
1244 {
1245  bool ret=true;
1246  *flag=true;
1247 
1248  for(int j=0;j<n_joints;j++)
1249  {
1250  int l = joints[j];
1251 
1252  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1253  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1254 
1255  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1256 
1257  if (!p)
1258  {
1259  return false;
1260  }
1261 
1262  if (p->pos)
1263  {
1264  bool singleJointMotionDone =false;
1265  bool ok = p->pos->checkMotionDone(off, &singleJointMotionDone);
1266  ret = ret && ok;
1267  *flag = *flag && singleJointMotionDone;
1268  }
1269  else
1270  {
1271  ret = false;
1272  }
1273  }
1274 
1275  return ret;
1276 }
1277 
1279 {
1280  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1281  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1282 
1283  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1284 
1285  if (!p)
1286  {
1287  return false;
1288  }
1289 
1290  if (p->pos)
1291  {
1292  return p->pos->setRefSpeed(off, sp);
1293  }
1294 
1295  return false;
1296 }
1297 
1298 bool ControlBoardRemapper::setRefSpeeds(const double *spds)
1299 {
1300  bool ret=true;
1301  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1302 
1303  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(spds,remappedControlBoards);
1304 
1305  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1306  {
1307  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1308 
1309  bool ok = p->pos->setRefSpeeds(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1310  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1311  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1312  ret = ret && ok;
1313  }
1314 
1315  return ret;
1316 }
1317 
1318 bool ControlBoardRemapper::setRefSpeeds(const int n_joints, const int *joints, const double *spds)
1319 {
1320  bool ret=true;
1321  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1322 
1323  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(spds,n_joints,joints,remappedControlBoards);
1324 
1325  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1326  {
1327  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1328 
1329  bool ok = p->pos->setRefSpeeds(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1330  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1331  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1332  ret = ret && ok;
1333  }
1334 
1335  return ret;
1336 }
1337 
1339 {
1340  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1341  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1342 
1343  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1344 
1345  if (!p)
1346  {
1347  return false;
1348  }
1349 
1350  if (p->pos)
1351  {
1352  return p->pos->setRefAcceleration(off, acc);
1353  }
1354 
1355  return false;
1356 }
1357 
1359 {
1360  bool ret=true;
1361  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1362 
1363  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(accs,remappedControlBoards);
1364 
1365  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1366  {
1367  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1368 
1369  bool ok = p->pos->setRefAccelerations(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1370  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1371  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1372  ret = ret && ok;
1373  }
1374 
1375  return ret;
1376 }
1377 
1378 bool ControlBoardRemapper::setRefAccelerations(const int n_joints, const int *joints, const double *accs)
1379 {
1380  bool ret=true;
1381  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1382 
1383  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(accs,n_joints,joints,remappedControlBoards);
1384 
1385  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1386  {
1387  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1388 
1389  bool ok = p->pos->setRefAccelerations(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1390  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1391  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1392  ret = ret && ok;
1393  }
1394 
1395  return ret;
1396 }
1397 
1398 bool ControlBoardRemapper::getRefSpeed(int j, double *ref)
1399 {
1400  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1401  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1402 
1403  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1404 
1405  if (!p)
1406  {
1407  return false;
1408  }
1409 
1410  if (p->pos)
1411  {
1412  return p->pos->getRefSpeed(off, ref);
1413  }
1414 
1415  return false;
1416 }
1417 
1419 {
1420  bool ret=true;
1421  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1422 
1423  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1424  {
1425  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1426 
1427  bool ok = true;
1428 
1429  if( p->pos )
1430  {
1431  ok = p->pos->getRefSpeeds(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1432  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1433  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1434  }
1435  else
1436  {
1437  ok = false;
1438  }
1439 
1440  ret = ret && ok;
1441  }
1442 
1443  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(spds,remappedControlBoards);
1444 
1445  return ret;
1446 }
1447 
1448 
1449 bool ControlBoardRemapper::getRefSpeeds(const int n_joints, const int *joints, double *spds)
1450 {
1451  bool ret=true;
1452  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1453 
1454  // Resize the input buffers
1455  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
1456 
1457  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1458  {
1459  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1460 
1461  bool ok = true;
1462 
1463  if( p->pos )
1464  {
1465  ok = p->pos->getRefSpeeds(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1466  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1467  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1468  }
1469  else
1470  {
1471  ok = false;
1472  }
1473 
1474  ret = ret && ok;
1475  }
1476 
1477  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(spds,n_joints,joints,remappedControlBoards);
1478 
1479  return ret;
1480 }
1481 
1483 {
1484  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1485  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1486 
1487  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1488 
1489  if (!p)
1490  {
1491  return false;
1492  }
1493 
1494  if (p->pos)
1495  {
1496  return p->pos->getRefAcceleration(off, acc);
1497  }
1498 
1499  return false;
1500 }
1501 
1503 {
1504  bool ret=true;
1505  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1506 
1507  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1508  {
1509  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1510 
1511  bool ok = true;
1512 
1513  if( p->pos )
1514  {
1515  ok = p->pos->getRefAccelerations(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1516  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1517  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1518  }
1519  else
1520  {
1521  ok = false;
1522  }
1523 
1524  ret = ret && ok;
1525  }
1526 
1527  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(accs,remappedControlBoards);
1528 
1529  return ret;
1530 }
1531 
1532 bool ControlBoardRemapper::getRefAccelerations(const int n_joints, const int *joints, double *accs)
1533 {
1534  bool ret=true;
1535  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1536 
1537  // Resize the input buffers
1538  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
1539 
1540  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1541  {
1542  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1543 
1544  bool ok = true;
1545 
1546  if( p->pos )
1547  {
1548  ok = p->pos->getRefAccelerations(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1549  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1550  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1551  }
1552  else
1553  {
1554  ok = false;
1555  }
1556 
1557  ret = ret && ok;
1558  }
1559 
1560  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(accs,n_joints,joints,remappedControlBoards);
1561 
1562  return ret;
1563 }
1564 
1566 {
1567  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1568  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1569 
1570  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1571 
1572  if (!p)
1573  {
1574  return false;
1575  }
1576 
1577  if (p->pos)
1578  {
1579  return p->pos->stop(off);
1580  }
1581 
1582  return false;
1583 }
1584 
1586 {
1587  bool ret=true;
1588  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1589 
1590  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1591  {
1592  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1593 
1594  bool ok = true;
1595 
1596  ok = p->pos ? p->pos->stop(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1597  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data()) : false;
1598 
1599  ret = ret && ok;
1600  }
1601 
1602  return ret;
1603 }
1604 
1605 bool ControlBoardRemapper::stop(const int n_joints, const int *joints)
1606 {
1607  bool ret=true;
1608  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
1609  std::lock_guard<std::mutex> lock2(buffers.mutex);
1610 
1611 
1612  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(buffers.dummyBuffer.data(),n_joints,joints,remappedControlBoards);
1613 
1614  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1615  {
1616  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1617 
1618  bool ok = p->pos->stop(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1619  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data());
1620  ret = ret && ok;
1621  }
1622 
1623  return ret;
1624 }
1625 
1626 /* IJointFaultControl */
1627 bool ControlBoardRemapper::getLastJointFault(int j, int& fault, std::string& message)
1628 {
1629  int off = (int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1630  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
1631 
1632  RemappedSubControlBoard* p = remappedControlBoards.getSubControlBoard(subIndex);
1633 
1634  if (!p)
1635  {
1636  return false;
1637  }
1638 
1639  if (p->iFault)
1640  {
1641  return p->iFault->getLastJointFault(off, fault, message);
1642  }
1643 
1644  return false;
1645 }
1646 
1647 /* IVelocityControl */
1648 
1650 {
1651  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1652  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1653 
1654  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1655 
1656  if (!p)
1657  {
1658  return false;
1659  }
1660 
1661  if (p->vel)
1662  {
1663  return p->vel->velocityMove(off, v);
1664  }
1665 
1666  return false;
1667 }
1668 
1670 {
1671  bool ret=true;
1672  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
1673 
1674  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(v,remappedControlBoards);
1675 
1676  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
1677  {
1678  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
1679 
1680  bool ok = p->vel->velocityMove(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
1681  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
1682  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
1683  ret = ret && ok;
1684  }
1685 
1686  return ret;
1687 }
1688 
1689 /* IEncoders */
1691 {
1692  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1693  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1694 
1695  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1696  if (!p)
1697  {
1698  return false;
1699  }
1700 
1701  if (p->iJntEnc)
1702  {
1703  return p->iJntEnc->resetEncoder(off);
1704  }
1705 
1706  return false;
1707 }
1708 
1710 {
1711  bool ret=true;
1712 
1713  for(int l=0;l<controlledJoints;l++)
1714  {
1715  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1716  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1717 
1718  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1719  if (!p)
1720  {
1721  return false;
1722  }
1723 
1724  if (p->iJntEnc)
1725  {
1726  bool ok = p->iJntEnc->resetEncoder(off);
1727  ret = ret && ok;
1728  }
1729  else
1730  {
1731  ret=false;
1732  }
1733  }
1734  return ret;
1735 }
1736 
1737 bool ControlBoardRemapper::setEncoder(int j, double val)
1738 {
1739  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1740  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1741 
1742  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1743 
1744  if (!p)
1745  {
1746  return false;
1747  }
1748 
1749  if (p->iJntEnc)
1750  {
1751  return p->iJntEnc->setEncoder(off,val);
1752  }
1753 
1754  return false;
1755 }
1756 
1757 bool ControlBoardRemapper::setEncoders(const double *vals)
1758 {
1759  bool ret=true;
1760 
1761  for(int l=0;l<controlledJoints;l++)
1762  {
1763  int off = (int) remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1764  size_t subIndex = remappedControlBoards.lut[l].subControlBoardIndex;
1765 
1766  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
1767 
1768  if (!p)
1769  {
1770  return false;
1771  }
1772 
1773  if (p->iJntEnc)
1774  {
1775  bool ok = p->iJntEnc->setEncoder(off, vals[l]);
1776  ret = ret && ok;
1777  }
1778  else
1779  {
1780  ret = false;
1781  }
1782  }
1783  return ret;
1784 }
1785 
1786 bool ControlBoardRemapper::getEncoder(int j, double *v)
1787 {
1788  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1789  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1790 
1791  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1792 
1793  if (!p)
1794  {
1795  return false;
1796  }
1797 
1798  if (p->iJntEnc)
1799  {
1800  return p->iJntEnc->getEncoder(off, v);
1801  }
1802 
1803  return false;
1804 }
1805 
1807 {
1808  bool ret=true;
1809 
1810  for(int l=0;l<controlledJoints;l++)
1811  {
1812  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1813  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1814 
1815  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1816 
1817  if (!p)
1818  {
1819  return false;
1820  }
1821 
1822  if (p->iJntEnc)
1823  {
1824  bool ok = p->iJntEnc->getEncoder(off, encs+l);
1825  ret = ret && ok;
1826  }
1827  else
1828  {
1829  ret = false;
1830  }
1831  }
1832  return ret;
1833 }
1834 
1835 bool ControlBoardRemapper::getEncodersTimed(double *encs, double *t)
1836 {
1837  bool ret=true;
1838 
1839  for(int l=0;l<controlledJoints;l++)
1840  {
1841  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1842  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1843 
1844  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1845 
1846  if (!p)
1847  {
1848  return false;
1849  }
1850 
1851  if (p->iJntEnc)
1852  {
1853  bool ok = p->iJntEnc->getEncoderTimed(off, encs+l, t+l);
1854  ret = ret && ok;
1855  }
1856  else
1857  {
1858  ret = false;
1859  }
1860  }
1861  return ret;
1862 }
1863 
1864 bool ControlBoardRemapper::getEncoderTimed(int j, double *v, double *t)
1865 {
1866  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1867  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1868 
1869  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1870 
1871  if (!p)
1872  {
1873  return false;
1874  }
1875 
1876  if (p->iJntEnc)
1877  {
1878  return p->iJntEnc->getEncoderTimed(off, v, t);
1879  }
1880 
1881  return false;
1882 }
1883 
1885 {
1886  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1887  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1888 
1889  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1890 
1891  if (!p)
1892  {
1893  return false;
1894  }
1895 
1896  if (p->iJntEnc)
1897  {
1898  return p->iJntEnc->getEncoderSpeed(off, sp);
1899  }
1900 
1901  return false;
1902 }
1903 
1905 {
1906  bool ret=true;
1907 
1908  for(int l=0;l<controlledJoints;l++)
1909  {
1910  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1911  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1912 
1913  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1914 
1915  if (!p)
1916  {
1917  return false;
1918  }
1919 
1920  if (p->iJntEnc)
1921  {
1922  bool ok = p->iJntEnc->getEncoderSpeed(off, spds+l);
1923  ret = ret && ok;
1924  }
1925  else
1926  {
1927  ret = false;
1928  }
1929  }
1930  return ret;
1931 }
1932 
1934 {
1935  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
1936  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
1937 
1938  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1939 
1940  if (!p)
1941  {
1942  return false;
1943  }
1944 
1945  if (p->iJntEnc)
1946  {
1947  return p->iJntEnc->getEncoderAcceleration(off,acc);
1948  }
1949 
1950  return false;
1951 }
1952 
1954 {
1955  bool ret=true;
1956 
1957  for(int l=0;l<controlledJoints;l++)
1958  {
1959  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
1960  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
1961 
1962  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1963 
1964  if (!p)
1965  {
1966  return false;
1967  }
1968 
1969  if (p->iJntEnc)
1970  {
1971  bool ok = p->iJntEnc->getEncoderAcceleration(off, accs+l);
1972  ret = ret && ok;
1973  }
1974  else
1975  {
1976  ret = false;
1977  }
1978  }
1979  return ret;
1980 }
1981 
1982 /* IMotor */
1984 {
1985  *num=controlledJoints;
1986  return true;
1987 }
1988 
1990 {
1991  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
1992  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
1993 
1994  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
1995 
1996  if (!p)
1997  {
1998  return false;
1999  }
2000 
2001  if (p->imotor)
2002  {
2003  return p->imotor->getTemperature(off, val);
2004  }
2005 
2006  return false;
2007 }
2008 
2010 {
2011  bool ret=true;
2012  for(int l=0;l<controlledJoints;l++)
2013  {
2014  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2015  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2016 
2017  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2018  if (!p)
2019  {
2020  return false;
2021  }
2022 
2023  if (p->imotor)
2024  {
2025  ret=ret&&p->imotor->getTemperature(off, vals+l);
2026  }
2027  else
2028  {
2029  ret=false;
2030  }
2031  }
2032  return ret;
2033 }
2034 
2036 {
2037  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2038  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2039 
2040  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2041 
2042  if (!p)
2043  {
2044  return false;
2045  }
2046 
2047  if (p->imotor)
2048  {
2049  return p->imotor->getTemperatureLimit(off, val);
2050  }
2051 
2052  return false;
2053 }
2054 
2055 bool ControlBoardRemapper::setTemperatureLimit (int m, const double val)
2056 {
2057  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2058  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2059 
2060  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2061 
2062  if (!p)
2063  {
2064  return false;
2065  }
2066 
2067  if (p->imotor)
2068  {
2069  return p->imotor->setTemperatureLimit(off,val);
2070  }
2071 
2072  return false;
2073 }
2074 
2076 {
2077  int off = (int)remappedControlBoards.lut[m].subControlBoardIndex;
2078  size_t subIndex = remappedControlBoards.lut[m].subControlBoardIndex;
2079 
2080  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2081 
2082  if (!p)
2083  {
2084  return false;
2085  }
2086 
2087  if (p->imotor)
2088  {
2089  return p->imotor->getGearboxRatio(off, val);
2090  }
2091 
2092  return false;
2093 }
2094 
2095 bool ControlBoardRemapper::setGearboxRatio(int m, const double val)
2096 {
2097  int off = (int)remappedControlBoards.lut[m].subControlBoardIndex;
2098  size_t subIndex = remappedControlBoards.lut[m].subControlBoardIndex;
2099 
2100  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2101 
2102  if (!p)
2103  {
2104  return false;
2105  }
2106 
2107  if (p->imotor)
2108  {
2109  return p->imotor->setGearboxRatio(off, val);
2110  }
2111 
2112  return false;
2113 }
2114 
2115 /* IRemoteVariables */
2117 {
2118  yCWarning(CONTROLBOARDREMAPPER, "getRemoteVariable is not properly implemented, use at your own risk.");
2119 
2120  bool b = true;
2121 
2122  for (unsigned int i = 0; i < remappedControlBoards.getNrOfSubControlBoards(); i++)
2123  {
2124  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(i);
2125 
2126  if (!p)
2127  {
2128  return false;
2129  }
2130 
2131  if (!p->iVar)
2132  {
2133  return false;
2134  }
2135 
2136  yarp::os::Bottle tmpval;
2137  bool ok = p->iVar->getRemoteVariable(key, tmpval);
2138 
2139  if (ok)
2140  {
2141  val.append(tmpval);
2142  }
2143 
2144  b = b && ok;
2145  }
2146 
2147  return b;
2148 }
2149 
2151 {
2152  yCWarning(CONTROLBOARDREMAPPER, "setRemoteVariable is not properly implemented, use at your own risk.");
2153 
2154  size_t bottle_size = val.size();
2155  size_t device_size = remappedControlBoards.getNrOfSubControlBoards();
2156  if (bottle_size != device_size)
2157  {
2158  yCError(CONTROLBOARDREMAPPER, "ControlBoardRemapper::setRemoteVariable bottle_size != device_size failure");
2159  return false;
2160  }
2161 
2162  bool b = true;
2163  for (unsigned int i = 0; i < device_size; i++)
2164  {
2165  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(i);
2166  if (!p) { yCError(CONTROLBOARDREMAPPER, "ControlBoardRemapper::setRemoteVariable !p failure"); return false; }
2167  if (!p->iVar) { yCError(CONTROLBOARDREMAPPER, "ControlBoardRemapper::setRemoteVariable !p->iVar failure"); return false; }
2168  Bottle* partial_val = val.get(i).asList();
2169  if (partial_val)
2170  {
2171  b &= p->iVar->setRemoteVariable(key, *partial_val);
2172  }
2173  else
2174  {
2175  yCError(CONTROLBOARDREMAPPER, "ControlBoardRemapper::setRemoteVariable general failure");
2176  return false;
2177  }
2178  }
2179 
2180  return b;
2181 }
2182 
2184 {
2185  yCWarning(CONTROLBOARDREMAPPER, "getRemoteVariablesList is not properly implemented, use at your own risk.");
2186 
2187  size_t subIndex = remappedControlBoards.lut[0].subControlBoardIndex;
2188  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2189 
2190  if (!p)
2191  {
2192  return false;
2193  }
2194 
2195  if (p->iVar)
2196  {
2197  return p->iVar->getRemoteVariablesList(listOfKeys);
2198  }
2199 
2200  return false;
2201 }
2202 
2203 /* IMotorEncoders */
2204 
2206 {
2207  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2208  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2209 
2210  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2211 
2212  if (!p)
2213  {
2214  return false;
2215  }
2216 
2217  if (p->iMotEnc)
2218  {
2219  return p->iMotEnc->resetMotorEncoder(off);
2220  }
2221 
2222  return false;
2223 }
2224 
2226 {
2227  bool ret=true;
2228 
2229  for(int l=0;l<controlledJoints;l++)
2230  {
2231  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2232  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2233 
2234  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2235  if (!p)
2236  {
2237  return false;
2238  }
2239 
2240  if (p->iMotEnc)
2241  {
2242  bool ok = p->iMotEnc->resetMotorEncoder(off);
2243  ret= ret && ok;
2244  }
2245  else
2246  {
2247  ret=false;
2248  }
2249  }
2250 
2251  return ret;
2252 }
2253 
2254 bool ControlBoardRemapper::setMotorEncoder(int m, const double val)
2255 {
2256  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2257  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2258 
2259  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2260 
2261  if (!p)
2262  {
2263  return false;
2264  }
2265 
2266  if (p->iMotEnc)
2267  {
2268  return p->iMotEnc->setMotorEncoder(off,val);
2269  }
2270 
2271  return false;
2272 }
2273 
2275 {
2276  bool ret=true;
2277 
2278  for(int l=0;l<controlledJoints;l++)
2279  {
2280  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2281  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2282 
2283  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2284 
2285  if (!p)
2286  {
2287  return false;
2288  }
2289 
2290  if (p->iMotEnc)
2291  {
2292  bool ok = p->iMotEnc->setMotorEncoder(off, vals[l]);
2293  ret = ret && ok;
2294  }
2295  else
2296  {
2297  ret=false;
2298  }
2299  }
2300 
2301  return ret;
2302 }
2303 
2305 {
2306  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2307  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2308 
2309  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2310 
2311  if (!p)
2312  {
2313  return false;
2314  }
2315 
2316  if (p->iMotEnc)
2317  {
2318  return p->iMotEnc->setMotorEncoderCountsPerRevolution(off,cpr);
2319  }
2320 
2321  return false;
2322 }
2323 
2325 {
2326  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2327  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2328 
2329  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2330 
2331  if (!p)
2332  {
2333  return false;
2334  }
2335 
2336  if (p->iMotEnc)
2337  {
2338  return p->iMotEnc->getMotorEncoderCountsPerRevolution(off, cpr);
2339  }
2340 
2341  return false;
2342 }
2343 
2345 {
2346  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2347  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2348 
2349  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2350 
2351  if (!p)
2352  {
2353  return false;
2354  }
2355 
2356  if (p->iMotEnc)
2357  {
2358  return p->iMotEnc->getMotorEncoder(off, v);
2359  }
2360 
2361  return false;
2362 }
2363 
2365 {
2366  bool ret=true;
2367 
2368  for(int l=0;l<controlledJoints;l++)
2369  {
2370  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2371  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2372 
2373  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2374  if (!p) {
2375  return false;
2376  }
2377 
2378  if (p->iMotEnc)
2379  {
2380  ret=ret&&p->iMotEnc->getMotorEncoder(off, encs+l);
2381  } else {
2382  ret = false;
2383  }
2384  }
2385  return ret;
2386 }
2387 
2389 {
2390  bool ret=true;
2391 
2392  for(int l=0;l<controlledJoints;l++)
2393  {
2394  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2395  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2396 
2397  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2398 
2399  if (!p)
2400  {
2401  return false;
2402  }
2403 
2404  if (p->iMotEnc)
2405  {
2406  bool ok = p->iMotEnc->getMotorEncoderTimed(off, encs, t);
2407  ret = ret && ok;
2408  }
2409  else
2410  {
2411  ret = false;
2412  }
2413  }
2414  return ret;
2415 }
2416 
2417 bool ControlBoardRemapper::getMotorEncoderTimed(int m, double *v, double *t)
2418 {
2419  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2420  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2421 
2422  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2423 
2424  if (!p)
2425  {
2426  return false;
2427  }
2428 
2429  if (p->iMotEnc)
2430  {
2431  return p->iMotEnc->getMotorEncoderTimed(off, v, t);
2432  }
2433 
2434  return false;
2435 }
2436 
2438 {
2439  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2440  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2441 
2442  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2443 
2444  if (!p)
2445  {
2446  return false;
2447  }
2448 
2449  if (p->iMotEnc)
2450  {
2451  return p->iMotEnc->getMotorEncoderSpeed(off, sp);
2452  }
2453 
2454  return false;
2455 }
2456 
2458 {
2459  bool ret=true;
2460 
2461  for(int l=0;l<controlledJoints;l++)
2462  {
2463  int off = (int) remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2464  size_t subIndex = remappedControlBoards.lut[l].subControlBoardIndex;
2465 
2466  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2467 
2468  if (!p)
2469  {
2470  return false;
2471  }
2472 
2473  if (p->iMotEnc)
2474  {
2475  bool ok = p->iMotEnc->getMotorEncoderSpeed(off, spds + l);
2476  ret = ret && ok;
2477  }
2478  else
2479  {
2480  ret = false;
2481  }
2482  }
2483  return ret;
2484 }
2485 
2487 {
2488  int off = (int) remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2489  size_t subIndex = remappedControlBoards.lut[m].subControlBoardIndex;
2490 
2491  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2492 
2493  if (!p)
2494  {
2495  return false;
2496  }
2497 
2498  if (p->iMotEnc)
2499  {
2500  return p->iMotEnc->getMotorEncoderAcceleration(off,acc);
2501  }
2502  *acc=0.0;
2503  return false;
2504 }
2505 
2507 {
2508  bool ret=true;
2509 
2510  for(int l=0;l<controlledJoints;l++)
2511  {
2512  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2513  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2514 
2515  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2516 
2517  if (!p)
2518  {
2519  return false;
2520  }
2521 
2522  if (p->iMotEnc)
2523  {
2524  bool ok = p->iMotEnc->getMotorEncoderAcceleration(off, accs+l);
2525  ret=ret && ok;
2526  }
2527  else
2528  {
2529  ret=false;
2530  }
2531  }
2532 
2533  return ret;
2534 }
2535 
2536 
2538 {
2539  *num=controlledJoints;
2540  return true;
2541 }
2542 
2543 /* IAmplifierControl */
2545 {
2546  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2547  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2548 
2549  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2550 
2551  if (!p)
2552  {
2553  return false;
2554  }
2555 
2556  if (p->amp)
2557  {
2558  return p->amp->enableAmp(off);
2559  }
2560 
2561  return false;
2562 }
2563 
2565 {
2566  return this->setControlMode(j, VOCAB_CM_IDLE);
2567 }
2568 
2570 {
2571  bool ret=true;
2572 
2573  for(int l=0;l<controlledJoints;l++)
2574  {
2575  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
2576  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
2577 
2578  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2579 
2580  if (!p)
2581  {
2582  return false;
2583  }
2584 
2585  if (p->amp)
2586  {
2587  bool ok = p->amp->getAmpStatus(off, st+l);
2588  ret = ret && ok;
2589  }
2590  else
2591  {
2592  ret=false;
2593  }
2594  }
2595 
2596  return ret;
2597 }
2598 
2600 {
2601  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2602  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2603 
2604  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2605 
2606  if (!p)
2607  {
2608  return false;
2609  }
2610 
2611  if (p->amp)
2612  {
2613  return p->amp->getAmpStatus(off,v);
2614  }
2615 
2616  return false;
2617 }
2618 
2620 {
2621  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2622  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2623 
2624  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2625 
2626  if (!p)
2627  {
2628  return false;
2629  }
2630 
2631  if (p->amp)
2632  {
2633  return p->amp->setMaxCurrent(off,v);
2634  }
2635 
2636  return false;
2637 }
2638 
2640 {
2641  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2642  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2643 
2644  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2645 
2646  if (!p)
2647  {
2648  return false;
2649  }
2650 
2651  if (p->amp)
2652  {
2653  return p->amp->getMaxCurrent(off,v);
2654  }
2655 
2656  return false;
2657 }
2658 
2660 {
2661  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2662  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2663 
2664  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2665 
2666  if(!p)
2667  {
2668  return false;
2669  }
2670 
2671  if(!p->amp)
2672  {
2673  return false;
2674  }
2675 
2676  return p->amp->getNominalCurrent(off, val);
2677 }
2678 
2680 {
2681  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2682  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2683 
2684  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2685 
2686  if(!p)
2687  {
2688  return false;
2689  }
2690 
2691  if(!p->amp)
2692  {
2693  return false;
2694  }
2695 
2696  return p->amp->getPeakCurrent(off, val);
2697 }
2698 
2699 bool ControlBoardRemapper::setPeakCurrent(int m, const double val)
2700 {
2701  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2702  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2703 
2704  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2705 
2706  if (!p)
2707  {
2708  return false;
2709  }
2710 
2711  if (!p->amp)
2712  {
2713  return false;
2714  }
2715 
2716  return p->amp->setPeakCurrent(off, val);
2717 }
2718 
2719 bool ControlBoardRemapper::setNominalCurrent(int m, const double val)
2720 {
2721  int off = (int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2722  size_t subIndex = remappedControlBoards.lut[m].subControlBoardIndex;
2723 
2724  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
2725 
2726  if (!p)
2727  {
2728  return false;
2729  }
2730 
2731  if (!p->amp)
2732  {
2733  return false;
2734  }
2735 
2736  return p->amp->setNominalCurrent(off, val);
2737 }
2738 
2739 bool ControlBoardRemapper::getPWM(int m, double* val)
2740 {
2741  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2742  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2743 
2744  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2745 
2746  if(!p)
2747  {
2748  return false;
2749  }
2750 
2751  if(!p->amp)
2752  {
2753  return false;
2754  }
2755 
2756  return p->amp->getPWM(off, val);
2757 }
2758 bool ControlBoardRemapper::getPWMLimit(int m, double* val)
2759 {
2760  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2761  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2762 
2763  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2764 
2765  if(!p)
2766  {
2767  return false;
2768  }
2769 
2770  if(!p->amp)
2771  {
2772  return false;
2773  }
2774 
2775  return p->amp->getPWMLimit(off, val);
2776 }
2777 
2778 bool ControlBoardRemapper::setPWMLimit(int m, const double val)
2779 {
2780  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2781  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2782 
2783  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2784 
2785  if (!p)
2786  {
2787  return false;
2788  }
2789 
2790  if (!p->amp)
2791  {
2792  return false;
2793  }
2794 
2795  return p->amp->setPWMLimit(off, val);
2796 }
2797 
2799 {
2800  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
2801  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
2802 
2803  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2804 
2805  if(!p)
2806  {
2807  return false;
2808  }
2809 
2810  if(!p->amp)
2811  {
2812  return false;
2813  }
2814 
2815  return p->amp->getPowerSupplyVoltage(off, val);
2816 }
2817 
2818 
2819 /* IControlLimits */
2820 
2821 bool ControlBoardRemapper::setLimits(int j, double min, double max)
2822 {
2823  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2824  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2825 
2826  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2827 
2828  if (!p)
2829  {
2830  return false;
2831  }
2832 
2833  if (p->lim)
2834  {
2835  return p->lim->setLimits(off,min, max);
2836  }
2837 
2838  return false;
2839 }
2840 
2841 bool ControlBoardRemapper::getLimits(int j, double *min, double *max)
2842 {
2843  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2844  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2845 
2846  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2847 
2848  if (!p)
2849  {
2850  return false;
2851  }
2852 
2853  if (p->lim)
2854  {
2855  return p->lim->getLimits(off,min, max);
2856  }
2857 
2858  return false;
2859 }
2860 
2861 bool ControlBoardRemapper::setVelLimits(int j, double min, double max)
2862 {
2863  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2864  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2865 
2866  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2867 
2868  if (!p)
2869  {
2870  return false;
2871  }
2872 
2873  if (!p->lim)
2874  {
2875  return false;
2876  }
2877 
2878  return p->lim->setVelLimits(off,min, max);
2879 }
2880 
2881 bool ControlBoardRemapper::getVelLimits(int j, double *min, double *max)
2882 {
2883  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2884  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
2885 
2886  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
2887 
2888  if (!p)
2889  {
2890  return false;
2891  }
2892 
2893  if(!p->lim)
2894  {
2895  return false;
2896  }
2897 
2898  return p->lim->getVelLimits(off,min, max);
2899 }
2900 
2901 /* IRemoteCalibrator */
2903 {
2905 }
2906 
2908 {
2910 }
2911 
2913 {
2914  if(!getCalibratorDevice())
2915  {
2916  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2917  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
2918 
2919  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(subIndex);
2920  if (!s)
2921  {
2922  return false;
2923  }
2924 
2925  if (s->remcalib)
2926  {
2927  return s->remcalib->calibrateSingleJoint(off);
2928  }
2929 
2930  return false;
2931  }
2932  else
2933  {
2934  return IRemoteCalibrator::getCalibratorDevice()->calibrateSingleJoint(j);
2935  }
2936 }
2937 
2939 {
2940  if(!getCalibratorDevice())
2941  {
2942  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
2943  {
2944  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(ctrlBrd);
2945  if (!s)
2946  {
2947  return false;
2948  }
2949 
2950  if (s->remcalib)
2951  {
2952  return s->remcalib->calibrateWholePart();
2953  }
2954  }
2955 
2956  return false;
2957  }
2958  else
2959  {
2960  return IRemoteCalibrator::getCalibratorDevice()->calibrateWholePart();
2961  }
2962 }
2963 
2965 {
2966  if(!getCalibratorDevice())
2967  {
2968  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
2969  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
2970 
2971  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(subIndex);
2972  if (!s)
2973  {
2974  return false;
2975  }
2976 
2977  if (s->remcalib)
2978  {
2979  return s->remcalib->homingSingleJoint(off);
2980  }
2981 
2982  return false;
2983  }
2984  else
2985  {
2986  return IRemoteCalibrator::getCalibratorDevice()->homingSingleJoint(j);
2987  }
2988 }
2989 
2991 {
2992  if(!getCalibratorDevice())
2993  {
2994  bool ret = true;
2995  for(int l=0;l<controlledJoints;l++)
2996  {
2997  bool ok = this->homingSingleJoint(l);
2998  ret = ret && ok;
2999  }
3000 
3001  return ret;
3002  }
3003  else
3004  {
3005  return IRemoteCalibrator::getCalibratorDevice()->homingWholePart();
3006  }
3007 }
3008 
3010 {
3011  if(!getCalibratorDevice())
3012  {
3013  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3014  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
3015 
3016  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(subIndex);
3017  if (!s)
3018  {
3019  return false;
3020  }
3021 
3022  if (s->remcalib)
3023  {
3024  return s->remcalib->parkSingleJoint(off,_wait);
3025  }
3026 
3027  return false;
3028  }
3029  else
3030  {
3031  return getCalibratorDevice()->parkSingleJoint(j, _wait);
3032  }
3033 }
3034 
3036 {
3037  if(!getCalibratorDevice())
3038  {
3039  bool ret = true;
3040 
3041  for(int l=0; l<controlledJoints; l++)
3042  {
3043  bool _wait = false;
3044  bool ok = this->parkSingleJoint(l,_wait);
3045  ret = ret && ok;
3046  }
3047 
3048  return ret;
3049  }
3050  else
3051  {
3052  return getCalibratorDevice()->parkWholePart();
3053  }
3054 }
3055 
3057 {
3058  if(!getCalibratorDevice())
3059  {
3060  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3061  {
3062  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(ctrlBrd);
3063  if (!s)
3064  {
3065  return false;
3066  }
3067 
3068  if (s->remcalib)
3069  {
3070  return s->remcalib->quitCalibrate();
3071  }
3072  }
3073 
3074  return false;
3075  }
3076  else
3077  {
3078  return IRemoteCalibrator::getCalibratorDevice()->quitCalibrate();
3079  }
3080 }
3081 
3083 {
3084  if(!getCalibratorDevice())
3085  {
3086  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3087  {
3088  RemappedSubControlBoard *s = remappedControlBoards.getSubControlBoard(ctrlBrd);
3089  if (!s)
3090  {
3091  return false;
3092  }
3093 
3094  if (s->remcalib)
3095  {
3096  return s->remcalib->quitPark();
3097  }
3098  }
3099 
3100  return false;
3101  }
3102  else
3103  {
3104  return IRemoteCalibrator::getCalibratorDevice()->quitPark();
3105  }
3106 }
3107 
3108 
3109 /* IControlCalibration */
3110 bool ControlBoardRemapper::calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3)
3111 {
3112  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3113  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3114 
3115  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
3116 
3117  if (p && p->calib)
3118  {
3119  return p->calib->calibrateAxisWithParams(off, ui,v1,v2,v3);
3120  }
3121  return false;
3122 }
3123 
3125 {
3126  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3127  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
3128 
3129  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
3130 
3131  if (p && p->calib)
3132  {
3133  return p->calib->setCalibrationParameters(off, params);
3134  }
3135 
3136  return false;
3137 }
3138 
3140 {
3141  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3142  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3143 
3144  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3145 
3146  if (!p)
3147  {
3148  return false;
3149  }
3150 
3151  if (p->calib)
3152  {
3153  return p->calib->calibrationDone(off);
3154  }
3155 
3156  return false;
3157 }
3158 
3160 {
3161  yCError(CONTROLBOARDREMAPPER, "Calling abortPark -- not implemented");
3162  return false;
3163 }
3164 
3166 {
3167  yCError(CONTROLBOARDREMAPPER, "Calling abortCalibration -- not implemented");
3168  return false;
3169 }
3170 
3171 /* IAxisInfo */
3172 
3173 bool ControlBoardRemapper::getAxisName(int j, std::string& name)
3174 {
3175  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3176  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3177 
3178  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3179 
3180  if (!p)
3181  {
3182  return false;
3183  }
3184 
3185  if (p->info)
3186  {
3187  return p->info->getAxisName(off, name);
3188  }
3189 
3190  return false;
3191 }
3192 
3194 {
3195  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3196  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
3197 
3198  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
3199 
3200  if (!p)
3201  {
3202  return false;
3203  }
3204 
3205  if (p->info)
3206  {
3207  return p->info->getJointType(off, type);
3208  }
3209 
3210  return false;
3211 }
3212 
3214 {
3215  bool ret=true;
3216 
3217  for(int l=0;l<controlledJoints;l++)
3218  {
3219  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
3220  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
3221 
3222  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3223 
3224  if (!p)
3225  {
3226  return false;
3227  }
3228 
3229  if (p->iTorque)
3230  {
3231  bool ok = p->iTorque->getRefTorque(off, refs+l);
3232  ret = ret && ok;
3233  }
3234  else
3235  {
3236  ret = false;
3237  }
3238  }
3239  return ret;
3240 }
3241 
3243 {
3244  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3245  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3246 
3247  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3248 
3249  if (!p)
3250  {
3251  return false;
3252  }
3253 
3254  if (p->iTorque)
3255  {
3256  return p->iTorque->getRefTorque(off, t);
3257  }
3258  return false;
3259 }
3260 
3262 {
3263  bool ret=true;
3264  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3265 
3266  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(t,remappedControlBoards);
3267 
3268  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3269  {
3270  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3271 
3272  bool ok;
3273 
3274  if( p->iTorque )
3275  {
3276  ok = p->iTorque->setRefTorques(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3277  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3278  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3279  }
3280  else
3281  {
3282  ok = false;
3283  }
3284 
3285  ret = ret && ok;
3286  }
3287 
3288  return ret;
3289 }
3290 
3292 {
3293  int off = (int) remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3294  size_t subIndex = remappedControlBoards.lut[j].subControlBoardIndex;
3295 
3296  RemappedSubControlBoard *p = remappedControlBoards.getSubControlBoard(subIndex);
3297  if (!p)
3298  {
3299  return false;
3300  }
3301 
3302  if (p->iTorque)
3303  {
3304  return p->iTorque->setRefTorque(off, t);
3305  }
3306  return false;
3307 }
3308 
3309 bool ControlBoardRemapper::setRefTorques(const int n_joints, const int *joints, const double *t)
3310 {
3311  bool ret=true;
3312  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3313 
3314  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(t,n_joints,joints,remappedControlBoards);
3315 
3316  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3317  {
3318  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3319 
3320  bool ok = p->iTorque->setRefTorques(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3321  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3322  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3323  ret = ret && ok;
3324  }
3325 
3326  return ret;
3327 }
3328 
3330 {
3331  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3332  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3333 
3334  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3335 
3336  if (!p)
3337  {
3338  return false;
3339  }
3340 
3341  if (p->iTorque)
3342  {
3343  return p->iTorque->getMotorTorqueParams(off, params);
3344  }
3345 
3346  return false;
3347 }
3348 
3350 {
3351  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3352  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3353 
3354  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3355 
3356  if (!p)
3357  {
3358  return false;
3359  }
3360 
3361  if (p->iTorque)
3362  {
3363  return p->iTorque->setMotorTorqueParams(off, params);
3364  }
3365 
3366  return false;
3367 }
3368 
3369 bool ControlBoardRemapper::setImpedance(int j, double stiff, double damp)
3370 {
3371  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3372  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3373 
3374  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3375 
3376  if (!p)
3377  {
3378  return false;
3379  }
3380 
3381  if (p->iImpedance)
3382  {
3383  return p->iImpedance->setImpedance(off, stiff, damp);
3384  }
3385 
3386  return false;
3387 }
3388 
3390 {
3391  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3392  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3393 
3394  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3395 
3396  if (!p)
3397  {
3398  return false;
3399  }
3400 
3401  if (p->iImpedance)
3402  {
3403  return p->iImpedance->setImpedanceOffset(off, offset);
3404  }
3405 
3406  return false;
3407 }
3408 
3410 {
3411  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3412  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3413 
3414  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3415 
3416  if (!p)
3417  {
3418  return false;
3419  }
3420 
3421  if (p->iTorque)
3422  {
3423  return p->iTorque->getTorque(off, t);
3424  }
3425 
3426  return false;
3427 }
3428 
3430 {
3431  bool ret=true;
3432 
3433  for(int l=0;l<controlledJoints;l++)
3434  {
3435  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
3436  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
3437 
3438  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3439 
3440  if (!p)
3441  {
3442  return false;
3443  }
3444 
3445  if (p->iTorque)
3446  {
3447  bool ok = p->iTorque->getTorque(off, t+l);
3448  ret = ret && ok;
3449  }
3450  else
3451  {
3452  ret=false;
3453  }
3454  }
3455 
3456  return ret;
3457  }
3458 
3459 bool ControlBoardRemapper::getTorqueRange(int j, double *min, double *max)
3460 {
3461  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3462  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3463 
3464  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3465 
3466  if (!p)
3467  {
3468  return false;
3469  }
3470 
3471  if (p->iTorque)
3472  {
3473  return p->iTorque->getTorqueRange(off, min, max);
3474  }
3475 
3476  return false;
3477 }
3478 
3479 bool ControlBoardRemapper::getTorqueRanges(double *min, double *max)
3480 {
3481  bool ret=true;
3482 
3483  for(int l=0;l<controlledJoints;l++)
3484  {
3485  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
3486  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
3487 
3488  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3489 
3490  if (!p)
3491  {
3492  return false;
3493  }
3494 
3495  if (p->iTorque)
3496  {
3497  bool ok = p->iTorque->getTorqueRange(off, min+l, max+l);
3498  ret = ret && ok;
3499  }
3500  else
3501  {
3502  ret=false;
3503  }
3504  }
3505  return ret;
3506  }
3507 
3508 bool ControlBoardRemapper::getImpedance(int j, double* stiff, double* damp)
3509 {
3510  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3511  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3512 
3513  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3514 
3515  if (!p)
3516  {
3517  return false;
3518  }
3519 
3520  if (p->iImpedance)
3521  {
3522  return p->iImpedance->getImpedance(off, stiff, damp);
3523  }
3524 
3525  return false;
3526 }
3527 
3528 bool ControlBoardRemapper::getImpedanceOffset(int j, double* offset)
3529 {
3530  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3531  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3532 
3533  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3534 
3535  if (!p)
3536  {
3537  return false;
3538  }
3539 
3540  if (p->iImpedance)
3541  {
3542  return p->iImpedance->getImpedanceOffset(off, offset);
3543  }
3544 
3545  return false;
3546 }
3547 
3548 bool ControlBoardRemapper::getCurrentImpedanceLimit(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp)
3549 {
3550  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3551  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3552 
3553  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3554 
3555  if (!p)
3556  {
3557  return false;
3558  }
3559 
3560  if (p->iImpedance)
3561  {
3562  return p->iImpedance->getCurrentImpedanceLimit(off, min_stiff, max_stiff, min_damp, max_damp);
3563  }
3564 
3565  return false;
3566 }
3567 
3569 {
3570  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3571  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3572 
3573  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3574  if (!p) {
3575  return false;
3576  }
3577 
3578  return p->iMode->getControlMode(off, mode);
3579 
3580 }
3581 
3583 {
3584  bool ret=true;
3585  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3586 
3587  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3588  {
3589  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3590 
3591  bool ok;
3592 
3593  if( p->iMode )
3594  {
3595  ok = p->iMode->getControlModes(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3596  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3597  allJointsBuffers.m_bufferForSubControlBoardControlModes[ctrlBrd].data());
3598  }
3599  else
3600  {
3601  ok = false;
3602  }
3603 
3604  ret = ret && ok;
3605  }
3606 
3607  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(modes,remappedControlBoards);
3608 
3609  return ret;
3610 }
3611 
3612 // IControlMode interface
3613 bool ControlBoardRemapper::getControlModes(const int n_joints, const int *joints, int *modes)
3614 {
3615  bool ret=true;
3616  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3617 
3618  // Resize the input buffers
3619  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
3620 
3621  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3622  {
3623  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3624 
3625  bool ok;
3626 
3627  if( p->iMode )
3628  {
3629  ok = p->iMode->getControlModes(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3630  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3631  selectedJointsBuffers.m_bufferForSubControlBoardControlModes[ctrlBrd].data());
3632  }
3633  else
3634  {
3635  ok = false;
3636  }
3637 
3638  ret = ret && ok;
3639  }
3640 
3641  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(modes,n_joints,joints,remappedControlBoards);
3642 
3643  return ret;
3644 }
3645 
3646 bool ControlBoardRemapper::setControlMode(const int j, const int mode)
3647 {
3648  bool ret = true;
3649 
3650  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3651  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3652 
3653  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3654 
3655  if (!p)
3656  {
3657  return false;
3658  }
3659 
3660  ret = p->iMode->setControlMode(off, mode);
3661 
3662  return ret;
3663 }
3664 
3665 bool ControlBoardRemapper::setControlModes(const int n_joints, const int *joints, int *modes)
3666 {
3667  bool ret=true;
3668  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3669 
3670  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(modes,n_joints,joints,remappedControlBoards);
3671 
3672  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3673  {
3674  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3675 
3676  bool ok = p->iMode->setControlModes(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3677  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3678  selectedJointsBuffers.m_bufferForSubControlBoardControlModes[ctrlBrd].data());
3679  ret = ret && ok;
3680  }
3681 
3682  return ret;
3683 }
3684 
3686 {
3687  bool ret=true;
3688  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3689 
3690  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(modes,remappedControlBoards);
3691 
3692  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3693  {
3694  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3695 
3696  bool ok = p->iMode->setControlModes(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3697  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3698  allJointsBuffers.m_bufferForSubControlBoardControlModes[ctrlBrd].data());
3699  ret = ret && ok;
3700  }
3701 
3702  return ret;
3703 }
3704 
3705 bool ControlBoardRemapper::setPosition(int j, double ref)
3706 {
3707  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3708  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3709 
3710  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3711 
3712  if (!p)
3713  {
3714  return false;
3715  }
3716 
3717  if (p->posDir)
3718  {
3719  return p->posDir->setPosition(off, ref);
3720  }
3721 
3722  return false;
3723 }
3724 
3725 bool ControlBoardRemapper::setPositions(const int n_joints, const int *joints, const double *dpos)
3726 {
3727  bool ret=true;
3728  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3729 
3730  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(dpos,n_joints,joints,remappedControlBoards);
3731 
3732  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3733  {
3734  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3735 
3736  bool ok = p->posDir->setPositions(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3737  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3738  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3739  ret = ret && ok;
3740  }
3741 
3742  return ret;
3743 }
3744 
3745 bool ControlBoardRemapper::setPositions(const double *refs)
3746 {
3747  bool ret=true;
3748  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3749 
3750  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(refs,remappedControlBoards);
3751 
3752  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3753  {
3754  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3755 
3756  bool ok = p->posDir->setPositions(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3757  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3758  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3759  ret = ret && ok;
3760  }
3761 
3762  return ret;
3763 }
3764 
3766 {
3767  double averageTimestamp = 0.0;
3768  int collectedTimestamps = 0;
3769 
3770  for(int l=0;l<controlledJoints;l++)
3771  {
3772  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
3773 
3774  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3775 
3776  if (!p)
3777  {
3778  return Stamp();
3779  }
3780 
3781  if(p->iTimed)
3782  {
3783  averageTimestamp = averageTimestamp + p->iTimed->getLastInputStamp().getTime();
3784  collectedTimestamps++;
3785  }
3786  }
3787 
3788 
3789  std::lock_guard<std::mutex> lock(buffers.mutex);
3790 
3791  if( collectedTimestamps > 0 )
3792  {
3793  buffers.stamp.update(averageTimestamp/collectedTimestamps);
3794  }
3795  else
3796  {
3797  buffers.stamp.update();
3798  }
3799 
3800  return buffers.stamp;
3801 }
3802 
3803 bool ControlBoardRemapper::getRefPosition(const int j, double* ref)
3804 {
3805  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3806  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3807 
3808  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3809 
3810  if (!p)
3811  {
3812  return false;
3813  }
3814 
3815  if (p->posDir)
3816  {
3817  bool ret = p->posDir->getRefPosition(off, ref);
3818  return ret;
3819  }
3820 
3821  return false;
3822 }
3823 
3825 {
3826  bool ret=true;
3827  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3828 
3829  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3830  {
3831  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3832 
3833  bool ok = true;
3834 
3835  if( p->posDir )
3836  {
3837  ok = p->posDir->getRefPositions(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3838  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3839  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3840  }
3841  else
3842  {
3843  ok = false;
3844  }
3845 
3846  ret = ret && ok;
3847  }
3848 
3849  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(spds,remappedControlBoards);
3850 
3851  return ret;
3852 }
3853 
3854 
3855 bool ControlBoardRemapper::getRefPositions(const int n_joints, const int *joints, double *targets)
3856 {
3857  bool ret=true;
3858  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3859 
3860  // Resize the input buffers
3861  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
3862 
3863  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3864  {
3865  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3866 
3867  bool ok = true;
3868 
3869  if( p->posDir )
3870  {
3871  ok = p->posDir->getRefPositions(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3872  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3873  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3874  }
3875  else
3876  {
3877  ok = false;
3878  }
3879 
3880  ret = ret && ok;
3881  }
3882 
3883  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(targets,n_joints,joints,remappedControlBoards);
3884 
3885  return ret;
3886 }
3887 
3888 
3889 
3890 // IVelocityControl interface
3891 bool ControlBoardRemapper::velocityMove(const int n_joints, const int *joints, const double *spds)
3892 {
3893  bool ret=true;
3894  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3895 
3896  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(spds,n_joints,joints,remappedControlBoards);
3897 
3898  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3899  {
3900  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3901 
3902  bool ok = p->vel->velocityMove(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3903  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3904  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3905  ret = ret && ok;
3906  }
3907 
3908  return ret;
3909 }
3910 
3911 bool ControlBoardRemapper::getRefVelocity(const int j, double* vel)
3912 {
3913  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3914  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
3915 
3916  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
3917 
3918  if (!p)
3919  {
3920  return false;
3921  }
3922 
3923  if (p->vel)
3924  {
3925  bool ret = p->vel->getRefVelocity(off, vel);
3926  return ret;
3927  }
3928 
3929  return false;
3930 }
3931 
3932 
3934 {
3935  bool ret=true;
3936  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
3937 
3938  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3939  {
3940  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3941 
3942  bool ok = true;
3943 
3944  if( p->vel )
3945  {
3946  ok = p->vel->getRefVelocities(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3947  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3948  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3949  }
3950  else
3951  {
3952  ok = false;
3953  }
3954 
3955  ret = ret && ok;
3956  }
3957 
3958  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(vels,remappedControlBoards);
3959 
3960  return ret;
3961 }
3962 
3963 bool ControlBoardRemapper::getRefVelocities(const int n_joints, const int* joints, double* vels)
3964 {
3965  bool ret=true;
3966  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
3967 
3968  // Resize the input buffers
3969  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
3970 
3971  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
3972  {
3973  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
3974 
3975  bool ok = true;
3976 
3977  if( p->vel )
3978  {
3979  ok = p->vel->getRefVelocities(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
3980  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
3981  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
3982  }
3983  else
3984  {
3985  ok = false;
3986  }
3987 
3988  ret = ret && ok;
3989  }
3990 
3991  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(vels,n_joints,joints,remappedControlBoards);
3992 
3993  return ret;
3994 }
3995 
3997 {
3998  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
3999  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
4000 
4001  RemappedSubControlBoard *s=remappedControlBoards.getSubControlBoard(subIndex);
4002 
4003  if (!s)
4004  {
4005  return false;
4006  }
4007 
4008  if (s->iInteract)
4009  {
4010  return s->iInteract->getInteractionMode(off, mode);
4011  }
4012 
4013  return false;
4014 }
4015 
4017 {
4018  bool ret=true;
4019  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
4020 
4021  // Resize the input buffers
4022  selectedJointsBuffers.resizeSubControlBoardBuffers(n_joints,joints,remappedControlBoards);
4023 
4024  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4025  {
4026  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4027 
4028  bool ok = true;
4029 
4030  if( p->iMode )
4031  {
4032  ok = p->iInteract->getInteractionModes(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4033  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4034  selectedJointsBuffers.m_bufferForSubControlBoardInteractionModes[ctrlBrd].data());
4035  }
4036  else
4037  {
4038  ok = false;
4039  }
4040 
4041  ret = ret && ok;
4042  }
4043 
4044  selectedJointsBuffers.fillArbitraryJointVectorFromSubControlBoardBuffers(modes,n_joints,joints,remappedControlBoards);
4045 
4046  return ret;
4047 }
4048 
4050 {
4051  bool ret=true;
4052  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
4053 
4054  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4055  {
4056  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4057 
4058  bool ok = true;
4059 
4060  if( p->iMode )
4061  {
4062  ok = p->iInteract->getInteractionModes(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4063  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4064  allJointsBuffers.m_bufferForSubControlBoardInteractionModes[ctrlBrd].data());
4065  }
4066  else
4067  {
4068  ok = false;
4069  }
4070 
4071  ret = ret && ok;
4072  }
4073 
4074  allJointsBuffers.fillCompleteJointVectorFromSubControlBoardBuffers(modes,remappedControlBoards);
4075 
4076  return ret;
4077 }
4078 
4080 {
4081  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
4082  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
4083 
4084  RemappedSubControlBoard *s=remappedControlBoards.getSubControlBoard(subIndex);
4085 
4086  if (!s)
4087  {
4088  return false;
4089  }
4090 
4091  if (s->iInteract)
4092  {
4093  return s->iInteract->setInteractionMode(off, mode);
4094  }
4095 
4096  return false;
4097 }
4098 
4100 {
4101  bool ret=true;
4102  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
4103 
4104  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(modes,n_joints,joints,remappedControlBoards);
4105 
4106  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4107  {
4108  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4109 
4110  bool ok = p->iInteract->setInteractionModes(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4111  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4112  selectedJointsBuffers.m_bufferForSubControlBoardInteractionModes[ctrlBrd].data());
4113  ret = ret && ok;
4114  }
4115 
4116  return ret;
4117 }
4118 
4120 {
4121  bool ret=true;
4122  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
4123 
4124  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(modes,remappedControlBoards);
4125 
4126  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4127  {
4128  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4129 
4130  bool ok = p->iInteract->setInteractionModes(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4131  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4132  allJointsBuffers.m_bufferForSubControlBoardInteractionModes[ctrlBrd].data());
4133  ret = ret && ok;
4134  }
4135 
4136  return ret;
4137 }
4138 
4140 {
4141  bool ret = false;
4142 
4143  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4144 
4145  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4146 
4147  if (p && p->iPwm)
4148  {
4149  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4150  ret = p->iPwm->setRefDutyCycle(off, ref);
4151  }
4152 
4153  return ret;
4154 }
4155 
4157 {
4158  bool ret=true;
4159 
4160  for(int l=0;l<controlledJoints;l++)
4161  {
4162  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4163  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4164 
4165  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4166 
4167  if (!p)
4168  {
4169  return false;
4170  }
4171 
4172  if (p->iPwm)
4173  {
4174  bool ok = p->iPwm->setRefDutyCycle(off, refs[l]);
4175  ret = ret && ok;
4176  }
4177  else
4178  {
4179  ret=false;
4180  }
4181  }
4182 
4183  return ret;
4184 }
4185 
4187 {
4188  bool ret = false;
4189 
4190  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4191 
4192  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4193 
4194  if (p && p->iPwm)
4195  {
4196  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4197  ret = p->iPwm->getRefDutyCycle(off, ref);
4198  }
4199 
4200  return ret;
4201 }
4202 
4204 {
4205  bool ret=true;
4206 
4207  for(int l=0;l<controlledJoints;l++)
4208  {
4209  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4210  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4211 
4212  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4213 
4214  if (!p)
4215  {
4216  return false;
4217  }
4218 
4219  if (p->iPwm)
4220  {
4221  bool ok = p->iPwm->getRefDutyCycle(off, refs+l);
4222  ret = ret && ok;
4223  }
4224  else
4225  {
4226  ret=false;
4227  }
4228  }
4229 
4230  return ret;
4231 }
4232 
4233 bool ControlBoardRemapper::getDutyCycle(int m, double* val)
4234 {
4235  bool ret = false;
4236 
4237  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4238 
4239  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4240 
4241  if (p && p->iPwm)
4242  {
4243  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4244  ret = p->iPwm->getDutyCycle(off, val);
4245  }
4246 
4247  return ret;
4248 }
4249 
4251 {
4252  bool ret=true;
4253 
4254  for(int l=0;l<controlledJoints;l++)
4255  {
4256  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4257  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4258 
4259  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4260 
4261  if (!p)
4262  {
4263  return false;
4264  }
4265 
4266  if (p->iPwm)
4267  {
4268  bool ok = p->iPwm->getDutyCycle(off, vals+l);
4269  ret = ret && ok;
4270  }
4271  else
4272  {
4273  ret=false;
4274  }
4275  }
4276 
4277  return ret;
4278 }
4279 
4280 bool ControlBoardRemapper::getCurrent(int j, double *val)
4281 {
4282  bool ret = false;
4283 
4284  size_t subIndex=remappedControlBoards.lut[j].subControlBoardIndex;
4285 
4286  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4287 
4288  if (p && p->iCurr)
4289  {
4290  int off=(int)remappedControlBoards.lut[j].axisIndexInSubControlBoard;
4291  ret = p->iCurr->getCurrent(off, val);
4292  }
4293 
4294  return ret;
4295 }
4296 
4298 {
4299  bool ret=true;
4300 
4301  for(int l=0;l<controlledJoints;l++)
4302  {
4303  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4304  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4305 
4306  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4307 
4308  if (!p)
4309  {
4310  return false;
4311  }
4312 
4313  if (p->iCurr)
4314  {
4315  bool ok = p->iCurr->getCurrent(off, vals+l);
4316  ret = ret && ok;
4317  }
4318  else
4319  {
4320  ret=false;
4321  }
4322  }
4323 
4324  return ret;
4325 }
4326 
4327 bool ControlBoardRemapper::getCurrentRange(int m, double* min, double* max)
4328 {
4329  bool ret = false;
4330 
4331  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4332 
4333  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4334 
4335  if (p && p->iCurr)
4336  {
4337  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4338  ret = p->iCurr->getCurrentRange(off, min, max);
4339  }
4340 
4341  return ret;
4342 }
4343 
4344 bool ControlBoardRemapper::getCurrentRanges(double* min, double* max)
4345 {
4346  bool ret=true;
4347 
4348  for(int l=0;l<controlledJoints;l++)
4349  {
4350  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4351  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4352 
4353  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4354 
4355  if (!p)
4356  {
4357  return false;
4358  }
4359 
4360  if (p->iCurr)
4361  {
4362  bool ok = p->iCurr->getCurrentRange(off, min+l, max+l);
4363  ret = ret && ok;
4364  }
4365  else
4366  {
4367  ret=false;
4368  }
4369  }
4370 
4371  return ret;
4372 }
4373 
4374 bool ControlBoardRemapper::setRefCurrent(int m, double curr)
4375 {
4376  bool ret = false;
4377 
4378  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4379 
4380  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4381 
4382  if (p && p->iCurr)
4383  {
4384  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4385  ret = p->iCurr->setRefCurrent(off, curr);
4386  }
4387 
4388  return ret;
4389 }
4390 
4391 bool ControlBoardRemapper::setRefCurrents(const int n_motor, const int* motors, const double* currs)
4392 {
4393  bool ret=true;
4394  std::lock_guard<std::mutex> lock(selectedJointsBuffers.mutex);
4395 
4396  selectedJointsBuffers.fillSubControlBoardBuffersFromArbitraryJointVector(currs,n_motor,motors,remappedControlBoards);
4397 
4398  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4399  {
4400  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4401 
4402  if (!(p && p->iCurr))
4403  {
4404  ret = false;
4405  break;
4406  }
4407 
4408  bool ok = p->iCurr->setRefCurrents(selectedJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4409  selectedJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4410  selectedJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
4411  ret = ret && ok;
4412  }
4413 
4414  return ret;
4415 }
4416 
4417 bool ControlBoardRemapper::setRefCurrents(const double* currs)
4418 {
4419  bool ret=true;
4420  std::lock_guard<std::mutex> lock(allJointsBuffers.mutex);
4421 
4422  allJointsBuffers.fillSubControlBoardBuffersFromCompleteJointVector(currs,remappedControlBoards);
4423 
4424  for(size_t ctrlBrd=0; ctrlBrd < remappedControlBoards.getNrOfSubControlBoards(); ctrlBrd++)
4425  {
4426  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(ctrlBrd);
4427 
4428  bool ok = p->iCurr->setRefCurrents(allJointsBuffers.m_nJointsInSubControlBoard[ctrlBrd],
4429  allJointsBuffers.m_jointsInSubControlBoard[ctrlBrd].data(),
4430  allJointsBuffers.m_bufferForSubControlBoard[ctrlBrd].data());
4431  ret = ret && ok;
4432  }
4433 
4434  return ret;
4435 }
4436 
4437 bool ControlBoardRemapper::getRefCurrent(int m, double* curr)
4438 {
4439  bool ret = false;
4440 
4441  size_t subIndex=remappedControlBoards.lut[m].subControlBoardIndex;
4442 
4443  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4444 
4445  if (p && p->iCurr)
4446  {
4447  int off=(int)remappedControlBoards.lut[m].axisIndexInSubControlBoard;
4448  ret = p->iCurr->getRefCurrent(off, curr);
4449  }
4450 
4451  return ret;
4452 }
4453 
4455 {
4456  bool ret=true;
4457 
4458  for(int l=0;l<controlledJoints;l++)
4459  {
4460  int off=(int)remappedControlBoards.lut[l].axisIndexInSubControlBoard;
4461  size_t subIndex=remappedControlBoards.lut[l].subControlBoardIndex;
4462 
4463  RemappedSubControlBoard *p=remappedControlBoards.getSubControlBoard(subIndex);
4464 
4465  if (!p)
4466  {
4467  return false;
4468  }
4469 
4470  if (p->iCurr)
4471  {
4472  bool ok = p->iCurr->getRefCurrent(off, currs+l);
4473  ret = ret && ok;
4474  }
4475  else
4476  {
4477  ret=false;
4478  }
4479  }
4480 
4481  return ret;
4482 }
const yarp::os::LogComponent & CONTROLBOARDREMAPPER()
float t
constexpr yarp::conf::vocab32_t VOCAB_CM_IDLE
Definition: IControlMode.h:121
bool ret
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 axes 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 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
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 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 &params) override
Start calibration, this method is very often platform specific.
bool stop() override
Stop motion, multiple joints.
bool getCurrents(double *currs) override
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.
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
bool attach(yarp::dev::PolyDriver *d, const std::string &id)
yarp::dev::IPidControl * pid
yarp::dev::IControlLimits * lim
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.
Definition: IAxisInfo.h:36
virtual bool getAxisName(int axis, std::string &name)=0
virtual bool getJointType(int axis, yarp::dev::JointTypeEnum &type)
Definition: IAxisInfo.h:55
virtual bool setCalibrationParameters(int axis, const CalibrationParameters &params)
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 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.
Definition: IEncoders.h:116
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 getAxes(int *ax)=0
Get the number of controlled 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 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.
Definition: IMotor.h:147
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.
Definition: IMotor.h:155
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 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 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 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 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 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.
Definition: Bottle.h:73
void fromString(const std::string &text)
Initializes bottle from a string.
Definition: Bottle.cpp:204
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
Definition: Bottle.cpp:380
size_type size() const
Gets the number of elements in the bottle.
Definition: Bottle.cpp:251
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
Definition: Bottle.cpp:246
std::string toString() const override
Gives a human-readable textual representation of the bottle.
Definition: Bottle.cpp:211
A class for storing options and configuration information.
Definition: Property.h:33
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition: Property.cpp:1051
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
Definition: Property.cpp:1063
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition: Property.cpp:1041
Bottle & findGroup(const std::string &key) const override
Gets a list corresponding to a given keyword.
Definition: Property.cpp:1142
A base class for nested structures that can be searched.
Definition: Searchable.h:63
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.
Definition: Stamp.h:21
double getTime() const
Get the time stamp.
Definition: Stamp.cpp:34
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:204
virtual Bottle * asList() const
Get list value.
Definition: Value.cpp:240
virtual std::string asString() const
Get string value.
Definition: Value.cpp:234
#define yCInfo(component,...)
Definition: LogComponent.h:171
#define yCError(component,...)
Definition: LogComponent.h:213
#define yCWarning(component,...)
Definition: LogComponent.h:192
For streams capable of holding different kinds of content, check what they actually have.
PidControlTypeEnum
Definition: PidEnums.h:15
An interface to the operating system, including Port based communication.
size_t indexOfSubDeviceInPolyDriverList
std::string subDeviceKey