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