YARP
Yet Another Robot Platform
RemoteControlBoard.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #include "RemoteControlBoard.h"
12 #include "stateExtendedReader.h"
13 
14 #include <cstring>
15 
16 #include <yarp/os/PortablePair.h>
17 #include <yarp/os/BufferedPort.h>
18 #include <yarp/os/Time.h>
19 #include <yarp/os/Network.h>
20 #include <yarp/os/PeriodicThread.h>
21 #include <yarp/os/Vocab.h>
22 #include <yarp/os/Stamp.h>
23 #include <yarp/os/LogStream.h>
24 #include <yarp/os/QosStyle.h>
25 
26 
28 #include <yarp/dev/PolyDriver.h>
32 
33 #include <mutex>
34 
35 
36 using namespace yarp::os;
37 using namespace yarp::dev;
38 using namespace yarp::sig;
39 
40 namespace {
41 
42 constexpr int PROTOCOL_VERSION_MAJOR = 1;
43 constexpr int PROTOCOL_VERSION_MINOR = 9;
44 constexpr int PROTOCOL_VERSION_TWEAK = 0;
45 
46 constexpr double DIAGNOSTIC_THREAD_PERIOD = 1.000;
47 
48 inline bool getTimeStamp(Bottle &bot, Stamp &st)
49 {
50  if (bot.get(3).asVocab()==VOCAB_TIMESTAMP)
51  {
52  //yup! we have a timestamp
53  int fr=bot.get(4).asInt32();
54  double ts=bot.get(5).asFloat64();
55  st=Stamp(fr,ts);
56  return true;
57  }
58  return false;
59 }
60 
61 } // namespace
62 
63 
65  public PeriodicThread
66 {
67  StateExtendedInputPort *owner{nullptr};
68  std::string ownerName;
69 
70 public:
72 
74  {
75  owner = o;
76  ownerName = owner->getName();
77  }
78 
79  void run() override
80  {
81  if (owner != nullptr)
82  {
83  if (owner->getIterations() > 100)
84  {
85  int it;
86  double av;
87  double max;
88  double min;
89  owner->getEstFrequency(it, av, min, max);
90  owner->resetStat();
92  "%s: %d msgs av:%.2lf min:%.2lf max:%.2lf [ms]",
93  ownerName.c_str(),
94  it,
95  av,
96  min,
97  max);
98  }
99 
100  }
101  }
102 };
103 
104 
106 {
107  if (!njIsKnown) {
108  int axes = 0;
109  bool ok = get1V1I(VOCAB_AXES, axes);
110  if (axes >= 0 && ok) {
111  nj = axes;
112  njIsKnown = true;
113  }
114  }
115  return njIsKnown;
116 }
117 
118 
120 {
121  bool error=false;
122  // verify protocol
123  Bottle cmd, reply;
124  cmd.addVocab(VOCAB_GET);
126  rpc_p.write(cmd, reply);
127 
128  // check size and format of messages, expected [prot] int int int [ok]
129  if (reply.size()!=5)
130  error=true;
131 
132  if (reply.get(0).asVocab()!=VOCAB_PROTOCOL_VERSION)
133  error=true;
134 
135  if (!error)
136  {
137  protocolVersion.major=reply.get(1).asInt32();
138  protocolVersion.minor=reply.get(2).asInt32();
139  protocolVersion.tweak=reply.get(3).asInt32();
140 
141  //verify protocol
142  if (protocolVersion.major!=PROTOCOL_VERSION_MAJOR)
143  error=true;
144 
145  if (protocolVersion.minor!=PROTOCOL_VERSION_MINOR)
146  error=true;
147  }
148 
149  if (!error)
150  return true;
151 
152  // protocol did not match
154  "Expecting protocol %d %d %d, but the device we are connecting to has protocol version %d %d %d",
158  protocolVersion.major,
159  protocolVersion.minor,
160  protocolVersion.tweak);
161 
162  bool ret;
163  if (ignore)
164  {
165  yCWarning(REMOTECONTROLBOARD, "Ignoring error but please update YARP or the remotecontrolboard implementation");
166  ret = true;
167  }
168  else
169  {
170  yCError(REMOTECONTROLBOARD, "Please update YARP or the remotecontrolboard implementation");
171  ret = false;
172  }
173 
174  return ret;
175 }
176 
178 {
179  remote = config.find("remote").asString();
180  local = config.find("local").asString();
181 
182  if (config.check("timeout"))
183  {
184  extendedIntputStatePort.setTimeout(config.find("timeout").asFloat64());
185  }
186  // check the Qos perefernces if available (local and remote)
187  yarp::os::QosStyle localQos;
188  if (config.check("local_qos")) {
189  Bottle& qos = config.findGroup("local_qos");
190  if(qos.check("thread_priority"))
191  localQos.setThreadPriority(qos.find("thread_priority").asInt32());
192  if(qos.check("thread_policy"))
193  localQos.setThreadPolicy(qos.find("thread_policy").asInt32());
194  if(qos.check("packet_priority"))
195  localQos.setPacketPriority(qos.find("packet_priority").asString());
196  }
197 
198  yarp::os::QosStyle remoteQos;
199  if (config.check("remote_qos")) {
200  Bottle& qos = config.findGroup("remote_qos");
201  if(qos.check("thread_priority"))
202  remoteQos.setThreadPriority(qos.find("thread_priority").asInt32());
203  if(qos.check("thread_policy"))
204  remoteQos.setThreadPolicy(qos.find("thread_policy").asInt32());
205  if(qos.check("packet_priority"))
206  remoteQos.setPacketPriority(qos.find("packet_priority").asString());
207  }
208 
209  bool writeStrict_isFound = config.check("writeStrict");
210  if(writeStrict_isFound)
211  {
212  Value &gotStrictVal = config.find("writeStrict");
213  if(gotStrictVal.asString() == "on")
214  {
215  writeStrict_singleJoint = true;
216  writeStrict_moreJoints = true;
217  yCInfo(REMOTECONTROLBOARD, "RemoteControlBoard is ENABLING the writeStrict option for all commands");
218  }
219  else if(gotStrictVal.asString() == "off")
220  {
221  writeStrict_singleJoint = false;
222  writeStrict_moreJoints = false;
223  yCInfo(REMOTECONTROLBOARD, "RemoteControlBoard is DISABLING the writeStrict opition for all commands");
224  }
225  else
226  yCError(REMOTECONTROLBOARD, "Found writeStrict opition with wrong value. Accepted options are 'on' or 'off'");
227  }
228 
229  if (local=="") {
230  yCError(REMOTECONTROLBOARD, "Problem connecting to remote controlboard, 'local' port prefix not given");
231  return false;
232  }
233 
234  if (remote=="") {
235  yCError(REMOTECONTROLBOARD, "Problem connecting to remote controlboard, 'remote' port name not given");
236  return false;
237  }
238 
239  std::string carrier =
240  config.check("carrier",
241  Value("udp"),
242  "default carrier for streaming robot state").asString();
243 
244  bool portProblem = false;
245  if (local != "") {
246  std::string s1 = local;
247  s1 += "/rpc:o";
248  if (!rpc_p.open(s1)) { portProblem = true; }
249  s1 = local;
250  s1 += "/command:o";
251  if (!command_p.open(s1)) { portProblem = true; }
252  s1 = local;
253  s1 += "/stateExt:i";
254  if (!extendedIntputStatePort.open(s1)) { portProblem = true; }
255  if (!portProblem)
256  {
257  extendedIntputStatePort.useCallback();
258  }
259  }
260 
261  bool connectionProblem = false;
262  if (remote != "" && !portProblem)
263  {
264  std::string s1 = remote;
265  s1 += "/rpc:i";
266  std::string s2 = local;
267  s2 += "/rpc:o";
268  bool ok = false;
269  // RPC port needs to be tcp, therefore no carrier option is added here
270  // ok=Network::connect(s2.c_str(), s1.c_str()); //This doesn't take into consideration possible YARP_PORT_PREFIX on local ports
271  // ok=Network::connect(rpc_p.getName(), s1.c_str()); //This should work also with YARP_PORT_PREFIX because getting back the name of the port will return the modified name
272  ok=rpc_p.addOutput(s1); //This works because we are manipulating only remote side and let yarp handle the local side
273  if (!ok) {
274  yCError(REMOTECONTROLBOARD, "Problem connecting to %s, is the remote device available?", s1.c_str());
275  connectionProblem = true;
276  }
277 
278  s1 = remote;
279  s1 += "/command:i";
280  s2 = local;
281  s2 += "/command:o";
282  //ok = Network::connect(s2.c_str(), s1.c_str(), carrier);
283  // ok=Network::connect(command_p.getName(), s1.c_str(), carrier); //doesn't take into consideration possible YARP_PORT_PREFIX on local ports
284  ok = command_p.addOutput(s1, carrier);
285  if (!ok) {
286  yCError(REMOTECONTROLBOARD, "Problem connecting to %s, is the remote device available?", s1.c_str());
287  connectionProblem = true;
288  }
289  // set the QoS preferences for the 'command' port
290  if (config.check("local_qos") || config.check("remote_qos"))
291  NetworkBase::setConnectionQos(command_p.getName(), s1, localQos, remoteQos, false);
292 
293  s1 = remote;
294  s1 += "/stateExt:o";
295  s2 = local;
296  s2 += "/stateExt:i";
297  // not checking return value for now since it is wip (different machines can have different compilation flags
298  ok = Network::connect(s1, extendedIntputStatePort.getName(), carrier);
299  if (ok)
300  {
301  // set the QoS preferences for the 'state' port
302  if (config.check("local_qos") || config.check("remote_qos"))
303  NetworkBase::setConnectionQos(s1, extendedIntputStatePort.getName(), remoteQos, localQos, false);
304  }
305  else
306  {
307  yCError(REMOTECONTROLBOARD, "Problem connecting to %s, is the remote device available?", s1.c_str());
308  connectionProblem = true;
309  }
310  }
311 
312  if (connectionProblem||portProblem) {
313 
314  rpc_p.close();
315  command_p.close();
316  extendedIntputStatePort.close();
317  return false;
318  }
319 
320  state_buffer.setStrict(false);
321  command_buffer.attach(command_p);
322 
323  if (!checkProtocolVersion(config.check("ignoreProtocolCheck")))
324  {
325  yCError(REMOTECONTROLBOARD) << "checkProtocolVersion failed";
326  command_buffer.detach();
327  rpc_p.close();
328  command_p.close();
329  extendedIntputStatePort.close();
330  return false;
331  }
332 
333  if (!isLive()) {
334  if (remote!="") {
335  yCError(REMOTECONTROLBOARD, "Problems with obtaining the number of controlled axes");
336  command_buffer.detach();
337  rpc_p.close();
338  command_p.close();
339  extendedIntputStatePort.close();
340  return false;
341  }
342  }
343 
344  if (config.check("diagnostic"))
345  {
346  diagnosticThread = new DiagnosticThread(DIAGNOSTIC_THREAD_PERIOD);
347  diagnosticThread->setOwner(&extendedIntputStatePort);
348  diagnosticThread->start();
349  }
350  else
351  diagnosticThread=nullptr;
352 
353  // allocate memory for helper struct
354  // single joint
355  last_singleJoint.jointPosition.resize(1);
356  last_singleJoint.jointVelocity.resize(1);
357  last_singleJoint.jointAcceleration.resize(1);
358  last_singleJoint.motorPosition.resize(1);
359  last_singleJoint.motorVelocity.resize(1);
360  last_singleJoint.motorAcceleration.resize(1);
361  last_singleJoint.torque.resize(1);
362  last_singleJoint.pwmDutycycle.resize(1);
363  last_singleJoint.current.resize(1);
364  last_singleJoint.controlMode.resize(1);
365  last_singleJoint.interactionMode.resize(1);
366 
367  // whole part (safe here because we already got the nj
368  last_wholePart.jointPosition.resize(nj);
369  last_wholePart.jointVelocity.resize(nj);
370  last_wholePart.jointAcceleration.resize(nj);
371  last_wholePart.motorPosition.resize(nj);
372  last_wholePart.motorVelocity.resize(nj);
373  last_wholePart.motorAcceleration.resize(nj);
374  last_wholePart.torque.resize(nj);
375  last_wholePart.current.resize(nj);
376  last_wholePart.pwmDutycycle.resize(nj);
377  last_wholePart.controlMode.resize(nj);
378  last_wholePart.interactionMode.resize(nj);
379  return true;
380 }
381 
383 {
384  if (diagnosticThread!=nullptr)
385  {
386  diagnosticThread->stop();
387  delete diagnosticThread;
388  }
389 
390  rpc_p.interrupt();
391  command_p.interrupt();
392  extendedIntputStatePort.interrupt();
393 
394  rpc_p.close();
395  command_p.close();
396  extendedIntputStatePort.close();
397  return true;
398 }
399 
400 // BEGIN Helpers functions
401 
403 {
404  Bottle cmd, response;
405  cmd.addVocab(v);
406  bool ok=rpc_p.write(cmd, response);
407  if (CHECK_FAIL(ok, response)) {
408  return true;
409  }
410  return false;
411 }
412 
413 bool RemoteControlBoard::send2V(int v1, int v2)
414 {
415  Bottle cmd, response;
416  cmd.addVocab(v1);
417  cmd.addVocab(v2);
418  bool ok=rpc_p.write(cmd, response);
419  if (CHECK_FAIL(ok, response)) {
420  return true;
421  }
422  return false;
423 }
424 
425 bool RemoteControlBoard::send2V1I(int v1, int v2, int axis)
426 {
427  Bottle cmd, response;
428  cmd.addVocab(v1);
429  cmd.addVocab(v2);
430  cmd.addInt32(axis);
431  bool ok=rpc_p.write(cmd, response);
432  if (CHECK_FAIL(ok, response)) {
433  return true;
434  }
435  return false;
436 }
437 
438 bool RemoteControlBoard::send1V1I(int v, int axis)
439 {
440  Bottle cmd, response;
441  cmd.addVocab(v);
442  cmd.addInt32(axis);
443  bool ok=rpc_p.write(cmd, response);
444  if (CHECK_FAIL(ok, response)) {
445  return true;
446  }
447  return false;
448 }
449 
450 bool RemoteControlBoard::send3V1I(int v1, int v2, int v3, int j)
451 {
452  Bottle cmd, response;
453  cmd.addVocab(v1);
454  cmd.addVocab(v2);
455  cmd.addVocab(v3);
456  cmd.addInt32(j);
457  bool ok=rpc_p.write(cmd, response);
458  if (CHECK_FAIL(ok, response)) {
459  return true;
460  }
461  return false;
462 }
463 
465 {
466  Bottle cmd, response;
467  cmd.addVocab(VOCAB_SET);
468  cmd.addVocab(code);
469 
470  bool ok = rpc_p.write(cmd, response);
471  return CHECK_FAIL(ok, response);
472 }
473 
474 bool RemoteControlBoard::set1V2D(int code, double v)
475 {
476  Bottle cmd, response;
477  cmd.addVocab(VOCAB_SET);
478  cmd.addVocab(code);
479  cmd.addFloat64(v);
480 
481  bool ok = rpc_p.write(cmd, response);
482 
483  return CHECK_FAIL(ok, response);
484 }
485 
486 bool RemoteControlBoard::set1V1I(int code, int v)
487 {
488  Bottle cmd, response;
489  cmd.addVocab(VOCAB_SET);
490  cmd.addVocab(code);
491  cmd.addInt32(v);
492 
493  bool ok = rpc_p.write(cmd, response);
494 
495  return CHECK_FAIL(ok, response);
496 }
497 
498 bool RemoteControlBoard::get1V1D(int code, double& v) const
499 {
500  Bottle cmd;
501  Bottle response;
502  cmd.addVocab(VOCAB_GET);
503  cmd.addVocab(code);
504 
505  bool ok = rpc_p.write(cmd, response);
506 
507  if (CHECK_FAIL(ok, response)) {
508  // response should be [cmd] [name] value
509  v = response.get(2).asFloat64();
510 
511  getTimeStamp(response, lastStamp);
512  return true;
513  }
514 
515  return false;
516 }
517 
518 bool RemoteControlBoard::get1V1I(int code, int& v) const
519 {
520  Bottle cmd;
521  Bottle response;
522  cmd.addVocab(VOCAB_GET);
523  cmd.addVocab(code);
524 
525  bool ok = rpc_p.write(cmd, response);
526 
527  if (CHECK_FAIL(ok, response)) {
528  // response should be [cmd] [name] value
529  v = response.get(2).asInt32();
530 
531  getTimeStamp(response, lastStamp);
532  return true;
533  }
534 
535  return false;
536 }
537 
538 bool RemoteControlBoard::set1V1I1D(int code, int j, double val)
539 {
540  Bottle cmd, response;
541  cmd.addVocab(VOCAB_SET);
542  cmd.addVocab(code);
543  cmd.addInt32(j);
544  cmd.addFloat64(val);
545  bool ok = rpc_p.write(cmd, response);
546  return CHECK_FAIL(ok, response);
547 }
548 
549 bool RemoteControlBoard::set1V1I2D(int code, int j, double val1, double val2)
550 {
551  Bottle cmd, response;
552  cmd.addVocab(VOCAB_SET);
553  cmd.addVocab(code);
554  cmd.addInt32(j);
555  cmd.addFloat64(val1);
556  cmd.addFloat64(val2);
557 
558  bool ok = rpc_p.write(cmd, response);
559  return CHECK_FAIL(ok, response);
560 }
561 
562 bool RemoteControlBoard::set1VDA(int v, const double *val)
563 {
564  if (!isLive()) return false;
565  Bottle cmd, response;
566  cmd.addVocab(VOCAB_SET);
567  cmd.addVocab(v);
568  Bottle& l = cmd.addList();
569  for (size_t i = 0; i < nj; i++)
570  l.addFloat64(val[i]);
571  bool ok = rpc_p.write(cmd, response);
572  return CHECK_FAIL(ok, response);
573 }
574 
575 bool RemoteControlBoard::set2V1DA(int v1, int v2, const double *val)
576 {
577  if (!isLive()) return false;
578  Bottle cmd, response;
579  cmd.addVocab(VOCAB_SET);
580  cmd.addVocab(v1);
581  cmd.addVocab(v2);
582  Bottle& l = cmd.addList();
583  for (size_t i = 0; i < nj; i++)
584  l.addFloat64(val[i]);
585  bool ok = rpc_p.write(cmd, response);
586  return CHECK_FAIL(ok, response);
587 }
588 
589 bool RemoteControlBoard::set2V2DA(int v1, int v2, const double *val1, const double *val2)
590 {
591  if (!isLive()) return false;
592  Bottle cmd, response;
593  cmd.addVocab(VOCAB_SET);
594  cmd.addVocab(v1);
595  cmd.addVocab(v2);
596  Bottle& l1 = cmd.addList();
597  for (size_t i = 0; i < nj; i++)
598  l1.addFloat64(val1[i]);
599  Bottle& l2 = cmd.addList();
600  for (size_t i = 0; i < nj; i++)
601  l2.addFloat64(val2[i]);
602  bool ok = rpc_p.write(cmd, response);
603  return CHECK_FAIL(ok, response);
604 }
605 
606 bool RemoteControlBoard::set1V1I1IA1DA(int v, const int len, const int *val1, const double *val2)
607 {
608  if (!isLive()) return false;
609  Bottle cmd, response;
610  cmd.addVocab(VOCAB_SET);
611  cmd.addVocab(v);
612  cmd.addInt32(len);
613  int i;
614  Bottle& l1 = cmd.addList();
615  for (i = 0; i < len; i++)
616  l1.addInt32(val1[i]);
617  Bottle& l2 = cmd.addList();
618  for (i = 0; i < len; i++)
619  l2.addFloat64(val2[i]);
620  bool ok = rpc_p.write(cmd, response);
621  return CHECK_FAIL(ok, response);
622 }
623 
624 bool RemoteControlBoard::set2V1I1D(int v1, int v2, int axis, double val)
625 {
626  Bottle cmd, response;
627  cmd.addVocab(VOCAB_SET);
628  cmd.addVocab(v1);
629  cmd.addVocab(v2);
630  cmd.addInt32(axis);
631  cmd.addFloat64(val);
632  bool ok = rpc_p.write(cmd, response);
633  return CHECK_FAIL(ok, response);
634 }
635 
636 bool RemoteControlBoard::setValWithPidType(int voc, PidControlTypeEnum type, int axis, double val)
637 {
638  if (!isLive()) return false;
639  Bottle cmd, response;
640  cmd.addVocab(VOCAB_SET);
641  cmd.addVocab(VOCAB_PID);
642  cmd.addVocab(voc);
643  cmd.addVocab(type);
644  cmd.addInt32(axis);
645  cmd.addFloat64(val);
646  bool ok = rpc_p.write(cmd, response);
647  return CHECK_FAIL(ok, response);
648 }
649 
650 bool RemoteControlBoard::setValWithPidType(int voc, PidControlTypeEnum type, const double* val_arr)
651 {
652  if (!isLive()) return false;
653  Bottle cmd, response;
654  cmd.addVocab(VOCAB_SET);
655  cmd.addVocab(VOCAB_PID);
656  cmd.addVocab(voc);
657  cmd.addVocab(type);
658  Bottle& l = cmd.addList();
659  for (size_t i = 0; i < nj; i++)
660  l.addFloat64(val_arr[i]);
661  bool ok = rpc_p.write(cmd, response);
662  return CHECK_FAIL(ok, response);
663 }
664 
665 bool RemoteControlBoard::getValWithPidType(int voc, PidControlTypeEnum type, int j, double *val)
666 {
667  Bottle cmd, response;
668  cmd.addVocab(VOCAB_GET);
669  cmd.addVocab(VOCAB_PID);
670  cmd.addVocab(voc);
671  cmd.addVocab(type);
672  cmd.addInt32(j);
673  bool ok = rpc_p.write(cmd, response);
674 
675  if (CHECK_FAIL(ok, response))
676  {
677  *val = response.get(2).asFloat64();
678  getTimeStamp(response, lastStamp);
679  return true;
680  }
681  return false;
682 }
683 
685 {
686  if (!isLive()) return false;
687  Bottle cmd, response;
688  cmd.addVocab(VOCAB_GET);
689  cmd.addVocab(VOCAB_PID);
690  cmd.addVocab(voc);
691  cmd.addVocab(type);
692  bool ok = rpc_p.write(cmd, response);
693  if (CHECK_FAIL(ok, response))
694  {
695  Bottle* lp = response.get(2).asList();
696  if (lp == nullptr)
697  return false;
698  Bottle& l = *lp;
699  yCAssert(REMOTECONTROLBOARD, nj == l.size());
700  for (size_t i = 0; i < nj; i++)
701  val[i] = l.get(i).asFloat64();
702  getTimeStamp(response, lastStamp);
703  return true;
704  }
705  return false;
706 }
707 
708 bool RemoteControlBoard::set2V1I(int v1, int v2, int axis)
709 {
710  Bottle cmd, response;
711  cmd.addVocab(VOCAB_SET);
712  cmd.addVocab(v1);
713  cmd.addVocab(v2);
714  cmd.addInt32(axis);
715  bool ok = rpc_p.write(cmd, response);
716  return CHECK_FAIL(ok, response);
717 }
718 
719 bool RemoteControlBoard::get1V1I1D(int v, int j, double *val)
720 {
721  Bottle cmd, response;
722  cmd.addVocab(VOCAB_GET);
723  cmd.addVocab(v);
724  cmd.addInt32(j);
725  bool ok = rpc_p.write(cmd, response);
726 
727  if (CHECK_FAIL(ok, response)) {
728  // ok
729  *val = response.get(2).asFloat64();
730 
731  getTimeStamp(response, lastStamp);
732  return true;
733  }
734  return false;
735 }
736 
737 bool RemoteControlBoard::get1V1I1I(int v, int j, int *val)
738 {
739  Bottle cmd, response;
740  cmd.addVocab(VOCAB_GET);
741  cmd.addVocab(v);
742  cmd.addInt32(j);
743  bool ok = rpc_p.write(cmd, response);
744  if (CHECK_FAIL(ok, response)) {
745  // ok
746  *val = response.get(2).asInt32();
747 
748  getTimeStamp(response, lastStamp);
749  return true;
750  }
751  return false;
752 }
753 
754 bool RemoteControlBoard::get2V1I1D(int v1, int v2, int j, double *val)
755 {
756  Bottle cmd, response;
757  cmd.addVocab(VOCAB_GET);
758  cmd.addVocab(v1);
759  cmd.addVocab(v2);
760  cmd.addInt32(j);
761  bool ok = rpc_p.write(cmd, response);
762 
763  if (CHECK_FAIL(ok, response)) {
764  // ok
765  *val = response.get(2).asFloat64();
766 
767  getTimeStamp(response, lastStamp);
768  return true;
769  }
770  return false;
771 }
772 
773 bool RemoteControlBoard::get2V1I2D(int v1, int v2, int j, double *val1, double *val2)
774 {
775  Bottle cmd, response;
776  cmd.addVocab(VOCAB_GET);
777  cmd.addVocab(v1);
778  cmd.addVocab(v2);
779  cmd.addInt32(j);
780  bool ok = rpc_p.write(cmd, response);
781  if (CHECK_FAIL(ok, response)) {
782  // ok
783  *val1 = response.get(2).asFloat64();
784  *val2 = response.get(3).asFloat64();
785 
786  getTimeStamp(response, lastStamp);
787  return true;
788  }
789  return false;
790 }
791 
792 bool RemoteControlBoard::get1V1I2D(int code, int axis, double *v1, double *v2)
793 {
794  Bottle cmd, response;
795  cmd.addVocab(VOCAB_GET);
796  cmd.addVocab(code);
797  cmd.addInt32(axis);
798 
799  bool ok = rpc_p.write(cmd, response);
800 
801  if (CHECK_FAIL(ok, response)) {
802  *v1 = response.get(2).asFloat64();
803  *v2 = response.get(3).asFloat64();
804  return true;
805  }
806  return false;
807 }
808 
809 bool RemoteControlBoard::get1V1I1B(int v, int j, bool &val)
810 {
811  Bottle cmd, response;
812  cmd.addVocab(VOCAB_GET);
813  cmd.addVocab(v);
814  cmd.addInt32(j);
815  bool ok = rpc_p.write(cmd, response);
816  if (CHECK_FAIL(ok, response)) {
817  val = (response.get(2).asInt32()!=0);
818  getTimeStamp(response, lastStamp);
819  return true;
820  }
821  return false;
822 }
823 
824 bool RemoteControlBoard::get1V1I1IA1B(int v, const int len, const int *val1, bool &retVal)
825 {
826  Bottle cmd, response;
827  cmd.addVocab(VOCAB_GET);
828  cmd.addVocab(v);
829  cmd.addInt32(len);
830  Bottle& l1 = cmd.addList();
831  for (int i = 0; i < len; i++)
832  l1.addInt32(val1[i]);
833 
834  bool ok = rpc_p.write(cmd, response);
835 
836  if (CHECK_FAIL(ok, response)) {
837  retVal = (response.get(2).asInt32()!=0);
838  getTimeStamp(response, lastStamp);
839  return true;
840  }
841  return false;
842 }
843 
844 bool RemoteControlBoard::get2V1I1IA1DA(int v1, int v2, const int n_joints, const int *joints, double *retVals, std::string functionName)
845 {
846  Bottle cmd, response;
847  if (!isLive()) return false;
848 
849  cmd.addVocab(VOCAB_GET);
850  cmd.addVocab(v1);
851  cmd.addVocab(v2);
852  cmd.addInt32(n_joints);
853 
854  Bottle& l1 = cmd.addList();
855  for (int i = 0; i < n_joints; i++)
856  l1.addInt32(joints[i]);
857 
858  bool ok = rpc_p.write(cmd, response);
859 
860  if (CHECK_FAIL(ok, response))
861  {
862  int i;
863  Bottle& list = *(response.get(0).asList());
864  yCAssert(REMOTECONTROLBOARD, list.size() >= (size_t) n_joints)
865 
866  if (list.size() != (size_t )n_joints)
867  {
869  "%s length of response does not match: expected %d, received %zu\n ",
870  functionName.c_str(),
871  n_joints ,
872  list.size() );
873  return false;
874  }
875  else
876  {
877  for (i = 0; i < n_joints; i++)
878  {
879  retVals[i] = (double) list.get(i).asFloat64();
880  }
881  return true;
882  }
883  }
884  return false;
885 }
886 
887 bool RemoteControlBoard::get1V1B(int v, bool &val)
888 {
889  Bottle cmd, response;
890  cmd.addVocab(VOCAB_GET);
891  cmd.addVocab(v);
892  bool ok = rpc_p.write(cmd, response);
893  if (CHECK_FAIL(ok, response)) {
894  val = (response.get(2).asInt32()!=0);
895  getTimeStamp(response, lastStamp);
896  return true;
897  }
898  return false;
899 }
900 
901 bool RemoteControlBoard::get1VIA(int v, int *val)
902 {
903  if (!isLive()) return false;
904  Bottle cmd, response;
905  cmd.addVocab(VOCAB_GET);
906  cmd.addVocab(v);
907  bool ok = rpc_p.write(cmd, response);
908  if (CHECK_FAIL(ok, response)) {
909  Bottle* lp = response.get(2).asList();
910  if (lp == nullptr)
911  return false;
912  Bottle& l = *lp;
913  yCAssert(REMOTECONTROLBOARD, nj == l.size());
914  for (size_t i = 0; i < nj; i++)
915  val[i] = l.get(i).asInt32();
916 
917  getTimeStamp(response, lastStamp);
918 
919  return true;
920  }
921  return false;
922 }
923 
924 bool RemoteControlBoard::get1VDA(int v, double *val)
925 {
926  if (!isLive()) return false;
927  Bottle cmd, response;
928  cmd.addVocab(VOCAB_GET);
929  cmd.addVocab(v);
930  bool ok = rpc_p.write(cmd, response);
931  if (CHECK_FAIL(ok, response)) {
932  Bottle* lp = response.get(2).asList();
933  if (lp == nullptr)
934  return false;
935  Bottle& l = *lp;
936  yCAssert(REMOTECONTROLBOARD, nj == l.size());
937  for (size_t i = 0; i < nj; i++)
938  val[i] = l.get(i).asFloat64();
939 
940  getTimeStamp(response, lastStamp);
941 
942  return true;
943  }
944  return false;
945 }
946 
947 bool RemoteControlBoard::get1V1DA(int v1, double *val)
948 {
949  if (!isLive()) return false;
950  Bottle cmd, response;
951  cmd.addVocab(VOCAB_GET);
952  cmd.addVocab(v1);
953  bool ok = rpc_p.write(cmd, response);
954 
955  if (CHECK_FAIL(ok, response)) {
956  Bottle* lp = response.get(2).asList();
957  if (lp == nullptr)
958  return false;
959  Bottle& l = *lp;
960  yCAssert(REMOTECONTROLBOARD, nj == l.size());
961  for (size_t i = 0; i < nj; i++)
962  val[i] = l.get(i).asFloat64();
963 
964  getTimeStamp(response, lastStamp);
965  return true;
966  }
967  return false;
968 }
969 
970 bool RemoteControlBoard::get2V1DA(int v1, int v2, double *val)
971 {
972  if (!isLive()) return false;
973  Bottle cmd, response;
974  cmd.addVocab(VOCAB_GET);
975  cmd.addVocab(v1);
976  cmd.addVocab(v2);
977  bool ok = rpc_p.write(cmd, response);
978 
979  if (CHECK_FAIL(ok, response)) {
980  Bottle* lp = response.get(2).asList();
981  if (lp == nullptr)
982  return false;
983  Bottle& l = *lp;
984  yCAssert(REMOTECONTROLBOARD, nj == l.size());
985  for (size_t i = 0; i < nj; i++)
986  val[i] = l.get(i).asFloat64();
987 
988  getTimeStamp(response, lastStamp);
989  return true;
990  }
991  return false;
992 }
993 
994 bool RemoteControlBoard::get2V2DA(int v1, int v2, double *val1, double *val2)
995 {
996  if (!isLive()) return false;
997  Bottle cmd, response;
998  cmd.addVocab(VOCAB_GET);
999  cmd.addVocab(v1);
1000  cmd.addVocab(v2);
1001  bool ok = rpc_p.write(cmd, response);
1002  if (CHECK_FAIL(ok, response)) {
1003  Bottle* lp1 = response.get(2).asList();
1004  if (lp1 == nullptr)
1005  return false;
1006  Bottle& l1 = *lp1;
1007  Bottle* lp2 = response.get(3).asList();
1008  if (lp2 == nullptr)
1009  return false;
1010  Bottle& l2 = *lp2;
1011 
1012  size_t nj1 = l1.size();
1013  size_t nj2 = l2.size();
1014  // yCAssert(REMOTECONTROLBOARD, nj == nj1);
1015  // yCAssert(REMOTECONTROLBOARD, nj == nj2);
1016 
1017  for (size_t i = 0; i < nj1; i++)
1018  val1[i] = l1.get(i).asFloat64();
1019  for (size_t i = 0; i < nj2; i++)
1020  val2[i] = l2.get(i).asFloat64();
1021 
1022  getTimeStamp(response, lastStamp);
1023  return true;
1024  }
1025  return false;
1026 }
1027 
1028 bool RemoteControlBoard::get1V1I1S(int code, int j, std::string &name)
1029 {
1030  Bottle cmd, response;
1031  cmd.addVocab(VOCAB_GET);
1032  cmd.addVocab(code);
1033  cmd.addInt32(j);
1034  bool ok = rpc_p.write(cmd, response);
1035 
1036  if (CHECK_FAIL(ok, response)) {
1037  name = response.get(2).asString();
1038  return true;
1039  }
1040  return false;
1041 }
1042 
1043 
1044 bool RemoteControlBoard::get1V1I1IA1DA(int v, const int len, const int *val1, double *val2)
1045 {
1046  if(!isLive()) return false;
1047 
1048  Bottle cmd, response;
1049  cmd.addVocab(VOCAB_GET);
1050  cmd.addVocab(v);
1051  cmd.addInt32(len);
1052  Bottle &l1 = cmd.addList();
1053  for(int i = 0; i < len; i++)
1054  l1.addInt32(val1[i]);
1055 
1056  bool ok = rpc_p.write(cmd, response);
1057 
1058  if (CHECK_FAIL(ok, response)) {
1059  Bottle* lp2 = response.get(2).asList();
1060  if (lp2 == nullptr)
1061  return false;
1062  Bottle& l2 = *lp2;
1063 
1064  size_t nj2 = l2.size();
1065  if(nj2 != (unsigned)len)
1066  {
1067  yCError(REMOTECONTROLBOARD, "received an answer with an unexpected number of entries!");
1068  return false;
1069  }
1070  for (size_t i = 0; i < nj2; i++)
1071  val2[i] = l2.get(i).asFloat64();
1072 
1073  getTimeStamp(response, lastStamp);
1074  return true;
1075  }
1076  return false;
1077 }
1078 
1079 // END Helpers functions
1080 
1082 {
1083  return get1V1I(VOCAB_AXES, *ax);
1084 }
1085 
1086 // BEGIN IPidControl
1087 
1088 bool RemoteControlBoard::setPid(const PidControlTypeEnum& pidtype, int j, const Pid &pid)
1089 {
1090  Bottle cmd, response;
1091  cmd.addVocab(VOCAB_SET);
1092  cmd.addVocab(VOCAB_PID);
1093  cmd.addVocab(VOCAB_PID);
1094  cmd.addVocab(pidtype);
1095  cmd.addInt32(j);
1096  Bottle& l = cmd.addList();
1097  l.addFloat64(pid.kp);
1098  l.addFloat64(pid.kd);
1099  l.addFloat64(pid.ki);
1100  l.addFloat64(pid.max_int);
1101  l.addFloat64(pid.max_output);
1102  l.addFloat64(pid.offset);
1103  l.addFloat64(pid.scale);
1104  l.addFloat64(pid.stiction_up_val);
1106  l.addFloat64(pid.kff);
1107  bool ok = rpc_p.write(cmd, response);
1108  return CHECK_FAIL(ok, response);
1109 }
1110 
1111 bool RemoteControlBoard::setPids(const PidControlTypeEnum& pidtype, const Pid *pids)
1112 {
1113  if (!isLive()) return false;
1114  Bottle cmd, response;
1115  cmd.addVocab(VOCAB_SET);
1116  cmd.addVocab(VOCAB_PID);
1117  cmd.addVocab(VOCAB_PIDS);
1118  cmd.addVocab(pidtype);
1119  Bottle& l = cmd.addList();
1120  for (size_t i = 0; i < nj; i++) {
1121  Bottle& m = l.addList();
1122  m.addFloat64(pids[i].kp);
1123  m.addFloat64(pids[i].kd);
1124  m.addFloat64(pids[i].ki);
1125  m.addFloat64(pids[i].max_int);
1126  m.addFloat64(pids[i].max_output);
1127  m.addFloat64(pids[i].offset);
1128  m.addFloat64(pids[i].scale);
1129  m.addFloat64(pids[i].stiction_up_val);
1130  m.addFloat64(pids[i].stiction_down_val);
1131  m.addFloat64(pids[i].kff);
1132  }
1133 
1134  bool ok = rpc_p.write(cmd, response);
1135  return CHECK_FAIL(ok, response);
1136 }
1137 
1138 bool RemoteControlBoard::setPidReference(const PidControlTypeEnum& pidtype, int j, double ref)
1139 {
1140  return setValWithPidType(VOCAB_REF, pidtype, j, ref);
1141 }
1142 
1143 bool RemoteControlBoard::setPidReferences(const PidControlTypeEnum& pidtype, const double *refs)
1144 {
1145  return setValWithPidType(VOCAB_REFS, pidtype, refs);
1146 }
1147 
1148 bool RemoteControlBoard::setPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double limit)
1149 {
1150  return setValWithPidType(VOCAB_LIM, pidtype, j, limit);
1151 }
1152 
1153 bool RemoteControlBoard::setPidErrorLimits(const PidControlTypeEnum& pidtype, const double *limits)
1154 {
1155  return setValWithPidType(VOCAB_LIMS, pidtype, limits);
1156 }
1157 
1158 bool RemoteControlBoard::getPidError(const PidControlTypeEnum& pidtype, int j, double *err)
1159 {
1160  return getValWithPidType(VOCAB_ERR, pidtype, j, err);
1161 }
1162 
1163 bool RemoteControlBoard::getPidErrors(const PidControlTypeEnum& pidtype, double *errs)
1164 {
1165  return getValWithPidType(VOCAB_ERRS, pidtype, errs);
1166 }
1167 
1168 bool RemoteControlBoard::getPid(const PidControlTypeEnum& pidtype, int j, Pid *pid)
1169 {
1170  Bottle cmd, response;
1171  cmd.addVocab(VOCAB_GET);
1172  cmd.addVocab(VOCAB_PID);
1173  cmd.addVocab(VOCAB_PID);
1174  cmd.addVocab(pidtype);
1175  cmd.addInt32(j);
1176  bool ok = rpc_p.write(cmd, response);
1177  if (CHECK_FAIL(ok, response)) {
1178  Bottle* lp = response.get(2).asList();
1179  if (lp == nullptr)
1180  return false;
1181  Bottle& l = *lp;
1182  pid->kp = l.get(0).asFloat64();
1183  pid->kd = l.get(1).asFloat64();
1184  pid->ki = l.get(2).asFloat64();
1185  pid->max_int = l.get(3).asFloat64();
1186  pid->max_output = l.get(4).asFloat64();
1187  pid->offset = l.get(5).asFloat64();
1188  pid->scale = l.get(6).asFloat64();
1189  pid->stiction_up_val = l.get(7).asFloat64();
1190  pid->stiction_down_val = l.get(8).asFloat64();
1191  pid->kff = l.get(9).asFloat64();
1192  return true;
1193  }
1194  return false;
1195 }
1196 
1198 {
1199  if (!isLive()) return false;
1200  Bottle cmd, response;
1201  cmd.addVocab(VOCAB_GET);
1202  cmd.addVocab(VOCAB_PID);
1203  cmd.addVocab(VOCAB_PIDS);
1204  cmd.addVocab(pidtype);
1205  bool ok = rpc_p.write(cmd, response);
1206  if (CHECK_FAIL(ok, response))
1207  {
1208  Bottle* lp = response.get(2).asList();
1209  if (lp == nullptr)
1210  return false;
1211  Bottle& l = *lp;
1212  yCAssert(REMOTECONTROLBOARD, nj == l.size());
1213  for (size_t i = 0; i < nj; i++)
1214  {
1215  Bottle* mp = l.get(i).asList();
1216  if (mp == nullptr)
1217  return false;
1218  pids[i].kp = mp->get(0).asFloat64();
1219  pids[i].kd = mp->get(1).asFloat64();
1220  pids[i].ki = mp->get(2).asFloat64();
1221  pids[i].max_int = mp->get(3).asFloat64();
1222  pids[i].max_output = mp->get(4).asFloat64();
1223  pids[i].offset = mp->get(5).asFloat64();
1224  pids[i].scale = mp->get(6).asFloat64();
1225  pids[i].stiction_up_val = mp->get(7).asFloat64();
1226  pids[i].stiction_down_val = mp->get(8).asFloat64();
1227  pids[i].kff = mp->get(9).asFloat64();
1228  }
1229  return true;
1230  }
1231  return false;
1232 }
1233 
1234 bool RemoteControlBoard::getPidReference(const PidControlTypeEnum& pidtype, int j, double *ref)
1235 {
1236  return getValWithPidType(VOCAB_REF, pidtype, j, ref);
1237 }
1238 
1240 {
1241  return getValWithPidType(VOCAB_REFS, pidtype, refs);
1242 }
1243 
1244 bool RemoteControlBoard::getPidErrorLimit(const PidControlTypeEnum& pidtype, int j, double *limit)
1245 {
1246  return getValWithPidType(VOCAB_LIM, pidtype, j, limit);
1247 }
1248 
1249 bool RemoteControlBoard::getPidErrorLimits(const PidControlTypeEnum& pidtype, double *limits)
1250 {
1251  return getValWithPidType(VOCAB_LIMS, pidtype, limits);
1252 }
1253 
1255 {
1256  if (!isLive()) return false;
1257  Bottle cmd, response;
1258  cmd.addVocab(VOCAB_SET);
1259  cmd.addVocab(VOCAB_PID);
1260  cmd.addVocab(VOCAB_RESET);
1261  cmd.addVocab(pidtype);
1262  cmd.addInt32(j);
1263  bool ok = rpc_p.write(cmd, response);
1264  return CHECK_FAIL(ok, response);
1265 }
1266 
1268 {
1269  if (!isLive()) return false;
1270  Bottle cmd, response;
1271  cmd.addVocab(VOCAB_SET);
1272  cmd.addVocab(VOCAB_PID);
1273  cmd.addVocab(VOCAB_DISABLE);
1274  cmd.addVocab(pidtype);
1275  cmd.addInt32(j);
1276  bool ok = rpc_p.write(cmd, response);
1277  return CHECK_FAIL(ok, response);
1278 }
1279 
1281 {
1282  if (!isLive()) return false;
1283  Bottle cmd, response;
1284  cmd.addVocab(VOCAB_SET);
1285  cmd.addVocab(VOCAB_PID);
1286  cmd.addVocab(VOCAB_ENABLE);
1287  cmd.addVocab(pidtype);
1288  cmd.addInt32(j);
1289  bool ok = rpc_p.write(cmd, response);
1290  return CHECK_FAIL(ok, response);
1291 }
1292 
1293 bool RemoteControlBoard::isPidEnabled(const PidControlTypeEnum& pidtype, int j, bool* enabled)
1294 {
1295  Bottle cmd, response;
1296  cmd.addVocab(VOCAB_GET);
1297  cmd.addVocab(VOCAB_PID);
1298  cmd.addVocab(VOCAB_ENABLE);
1299  cmd.addVocab(pidtype);
1300  cmd.addInt32(j);
1301  bool ok = rpc_p.write(cmd, response);
1302  if (CHECK_FAIL(ok, response))
1303  {
1304  *enabled = response.get(2).asBool();
1305  return true;
1306  }
1307  return false;
1308 }
1309 
1310 bool RemoteControlBoard::getPidOutput(const PidControlTypeEnum& pidtype, int j, double *out)
1311 {
1312  return getValWithPidType(VOCAB_OUTPUT, pidtype, j, out);
1313 }
1314 
1315 bool RemoteControlBoard::getPidOutputs(const PidControlTypeEnum& pidtype, double *outs)
1316 {
1317  return getValWithPidType(VOCAB_OUTPUTS, pidtype, outs);
1318 }
1319 
1320 bool RemoteControlBoard::setPidOffset(const PidControlTypeEnum& pidtype, int j, double v)
1321 {
1322  return setValWithPidType(VOCAB_OFFSET, pidtype, j, v);
1323 }
1324 
1325 // END IPidControl
1326 
1327 // BEGIN IEncoder
1328 
1330 {
1331  return set1V1I(VOCAB_E_RESET, j);
1332 }
1333 
1335 {
1336  return set1V(VOCAB_E_RESETS);
1337 }
1338 
1339 bool RemoteControlBoard::setEncoder(int j, double val)
1340 {
1341  return set1V1I1D(VOCAB_ENCODER, j, val);
1342 }
1343 
1344 bool RemoteControlBoard::setEncoders(const double *vals)
1345 {
1346  return set1VDA(VOCAB_ENCODERS, vals);
1347 }
1348 
1349 bool RemoteControlBoard::getEncoder(int j, double *v)
1350 {
1351  double localArrivalTime = 0.0;
1352 
1353  extendedPortMutex.lock();
1354  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_ENCODER, v, lastStamp, localArrivalTime);
1355  extendedPortMutex.unlock();
1356  return ret;
1357 }
1358 
1359 bool RemoteControlBoard::getEncoderTimed(int j, double *v, double *t)
1360 {
1361  double localArrivalTime = 0.0;
1362 
1363  extendedPortMutex.lock();
1364  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_ENCODER, v, lastStamp, localArrivalTime);
1365  *t=lastStamp.getTime();
1366  extendedPortMutex.unlock();
1367  return ret;
1368 }
1369 
1371 {
1372  double localArrivalTime = 0.0;
1373 
1374  extendedPortMutex.lock();
1375  bool ret = extendedIntputStatePort.getLastVector(VOCAB_ENCODERS, encs, lastStamp, localArrivalTime);
1376  extendedPortMutex.unlock();
1377 
1378  return ret;
1379 }
1380 
1381 bool RemoteControlBoard::getEncodersTimed(double *encs, double *ts)
1382 {
1383  double localArrivalTime=0.0;
1384 
1385  extendedPortMutex.lock();
1386  bool ret = extendedIntputStatePort.getLastVector(VOCAB_ENCODERS, encs, lastStamp, localArrivalTime);
1387  std::fill_n(ts, nj, lastStamp.getTime());
1388  extendedPortMutex.unlock();
1389  return ret;
1390 }
1391 
1393 {
1394  double localArrivalTime=0.0;
1395 
1396  extendedPortMutex.lock();
1397  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_ENCODER_SPEED, sp, lastStamp, localArrivalTime);
1398  extendedPortMutex.unlock();
1399  return ret;
1400 }
1401 
1403 {
1404  double localArrivalTime=0.0;
1405 
1406  extendedPortMutex.lock();
1407  bool ret = extendedIntputStatePort.getLastVector(VOCAB_ENCODER_SPEEDS, spds, lastStamp, localArrivalTime);
1408  extendedPortMutex.unlock();
1409  return ret;
1410 }
1411 
1413 {
1414  double localArrivalTime=0.0;
1415  extendedPortMutex.lock();
1416  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_ENCODER_ACCELERATION, acc, lastStamp, localArrivalTime);
1417  extendedPortMutex.unlock();
1418  return ret;
1419 }
1420 
1422 {
1423  double localArrivalTime=0.0;
1424  extendedPortMutex.lock();
1425  bool ret = extendedIntputStatePort.getLastVector(VOCAB_ENCODER_ACCELERATIONS, accs, lastStamp, localArrivalTime);
1426  extendedPortMutex.unlock();
1427  return ret;
1428 }
1429 
1430 // END IEncoder
1431 
1432 // BEGIN IRemoteVariable
1433 
1435 {
1436  Bottle cmd, response;
1437  cmd.addVocab(VOCAB_GET);
1439  cmd.addVocab(VOCAB_VARIABLE);
1440  cmd.addString(key);
1441  bool ok = rpc_p.write(cmd, response);
1442  if (CHECK_FAIL(ok, response))
1443  {
1444  val = *(response.get(2).asList());
1445  return true;
1446  }
1447  return false;
1448 }
1449 
1451 {
1452  Bottle cmd, response;
1453  cmd.addVocab(VOCAB_SET);
1455  cmd.addVocab(VOCAB_VARIABLE);
1456  cmd.addString(key);
1457  cmd.append(val);
1458  //std::string s = cmd.toString();
1459  bool ok = rpc_p.write(cmd, response);
1460 
1461  return CHECK_FAIL(ok, response);
1462 }
1463 
1464 
1466 {
1467  Bottle cmd, response;
1468  cmd.addVocab(VOCAB_GET);
1471  bool ok = rpc_p.write(cmd, response);
1472  //std::string s = response.toString();
1473  if (CHECK_FAIL(ok, response))
1474  {
1475  *listOfKeys = *(response.get(2).asList());
1476  //std::string s = listOfKeys->toString();
1477  return true;
1478  }
1479  return false;
1480 }
1481 
1482 // END IRemoteVariable
1483 
1484 // BEGIN IMotor
1485 
1487 {
1488  return get1V1I(VOCAB_MOTORS_NUMBER, *num);
1489 }
1490 
1491 bool RemoteControlBoard::getTemperature (int m, double* val)
1492 {
1493  return get1V1I1D(VOCAB_TEMPERATURE, m, val);
1494 }
1495 
1497 {
1498  return get1VDA(VOCAB_TEMPERATURES, vals);
1499 }
1500 
1502 {
1503  return get1V1I1D(VOCAB_TEMPERATURE_LIMIT, m, val);
1504 }
1505 
1506 bool RemoteControlBoard::setTemperatureLimit (int m, const double val)
1507 {
1508  return set1V1I1D(VOCAB_TEMPERATURE_LIMIT, m, val);
1509 }
1510 
1511 bool RemoteControlBoard::getGearboxRatio(int m, double* val)
1512 {
1513  return get1V1I1D(VOCAB_GEARBOX_RATIO, m, val);
1514 }
1515 
1516 bool RemoteControlBoard::setGearboxRatio(int m, const double val)
1517 {
1518  return set1V1I1D(VOCAB_GEARBOX_RATIO, m, val);
1519 }
1520 
1521 // END IMotor
1522 
1523 // BEGIN IMotorEncoder
1524 
1526 {
1527  return set1V1I(VOCAB_MOTOR_E_RESET, j);
1528 }
1529 
1531 {
1532  return set1V(VOCAB_MOTOR_E_RESETS);
1533 }
1534 
1535 bool RemoteControlBoard::setMotorEncoder(int j, const double val)
1536 {
1537  return set1V1I1D(VOCAB_MOTOR_ENCODER, j, val);
1538 }
1539 
1541 {
1542  return set1V1I1D(VOCAB_MOTOR_CPR, m, cpr);
1543 }
1544 
1546 {
1547  return get1V1I1D(VOCAB_MOTOR_CPR, m, cpr);
1548 }
1549 
1551 {
1552  return set1VDA(VOCAB_MOTOR_ENCODERS, vals);
1553 }
1554 
1556 {
1557  double localArrivalTime = 0.0;
1558 
1559  extendedPortMutex.lock();
1560  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_MOTOR_ENCODER, v, lastStamp, localArrivalTime);
1561  extendedPortMutex.unlock();
1562  return ret;
1563 }
1564 
1565 bool RemoteControlBoard::getMotorEncoderTimed(int j, double *v, double *t)
1566 {
1567  double localArrivalTime = 0.0;
1568 
1569  extendedPortMutex.lock();
1570  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_MOTOR_ENCODER, v, lastStamp, localArrivalTime);
1571  *t=lastStamp.getTime();
1572  extendedPortMutex.unlock();
1573  return ret;
1574 }
1575 
1577 {
1578  double localArrivalTime=0.0;
1579 
1580  extendedPortMutex.lock();
1581  bool ret = extendedIntputStatePort.getLastVector(VOCAB_MOTOR_ENCODERS, encs, lastStamp, localArrivalTime);
1582  extendedPortMutex.unlock();
1583 
1584  return ret;
1585 }
1586 
1587 bool RemoteControlBoard::getMotorEncodersTimed(double *encs, double *ts)
1588 {
1589  double localArrivalTime=0.0;
1590 
1591  extendedPortMutex.lock();
1592  bool ret = extendedIntputStatePort.getLastVector(VOCAB_MOTOR_ENCODERS, encs, lastStamp, localArrivalTime);
1593  std::fill_n(ts, nj, lastStamp.getTime());
1594  extendedPortMutex.unlock();
1595  return ret;
1596 }
1597 
1599 {
1600  double localArrivalTime=0.0;
1601  extendedPortMutex.lock();
1602  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_MOTOR_ENCODER_SPEED, sp, lastStamp, localArrivalTime);
1603  extendedPortMutex.unlock();
1604  return ret;
1605 }
1606 
1608 {
1609  double localArrivalTime=0.0;
1610  extendedPortMutex.lock();
1611  bool ret = extendedIntputStatePort.getLastVector(VOCAB_MOTOR_ENCODER_SPEEDS, spds, lastStamp, localArrivalTime);
1612  extendedPortMutex.unlock();
1613  return ret;
1614 }
1615 
1617 {
1618  double localArrivalTime=0.0;
1619  extendedPortMutex.lock();
1620  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_MOTOR_ENCODER_ACCELERATION, acc, lastStamp, localArrivalTime);
1621  extendedPortMutex.unlock();
1622  return ret;
1623 }
1624 
1626 {
1627  double localArrivalTime=0.0;
1628  extendedPortMutex.lock();
1629  bool ret = extendedIntputStatePort.getLastVector(VOCAB_MOTOR_ENCODER_SPEEDS, accs, lastStamp, localArrivalTime);
1630  extendedPortMutex.unlock();
1631  return ret;
1632 }
1633 
1635 {
1636  return get1V1I(VOCAB_MOTOR_ENCODER_NUMBER, *num);
1637 }
1638 
1639 // END IMotorEncoder
1640 
1641 // BEGIN IPreciselyTimed
1642 
1648 {
1649  Stamp ret;
1650 // mutex.lock();
1651  ret = lastStamp;
1652 // mutex.unlock();
1653  return ret;
1654 }
1655 
1656 // END IPreciselyTimed
1657 
1658 // BEGIN IPositionControl
1659 
1660 bool RemoteControlBoard::positionMove(int j, double ref)
1661 {
1662  return set1V1I1D(VOCAB_POSITION_MOVE, j, ref);
1663 }
1664 
1665 bool RemoteControlBoard::positionMove(const int n_joint, const int *joints, const double *refs)
1666 {
1667  return set1V1I1IA1DA(VOCAB_POSITION_MOVE_GROUP, n_joint, joints, refs);
1668 }
1669 
1670 bool RemoteControlBoard::positionMove(const double *refs)
1671 {
1672  return set1VDA(VOCAB_POSITION_MOVES, refs);
1673 }
1674 
1675 bool RemoteControlBoard::getTargetPosition(const int joint, double *ref)
1676 {
1677  return get1V1I1D(VOCAB_POSITION_MOVE, joint, ref);
1678 }
1679 
1681 {
1682  return get1V1DA(VOCAB_POSITION_MOVES, refs);
1683 }
1684 
1685 bool RemoteControlBoard::getTargetPositions(const int n_joint, const int *joints, double *refs)
1686 {
1687  return get1V1I1IA1DA(VOCAB_POSITION_MOVE_GROUP, n_joint, joints, refs);
1688 }
1689 
1690 bool RemoteControlBoard::relativeMove(int j, double delta)
1691 {
1692  return set1V1I1D(VOCAB_RELATIVE_MOVE, j, delta);
1693 }
1694 
1695 bool RemoteControlBoard::relativeMove(const int n_joint, const int *joints, const double *refs)
1696 {
1697  return set1V1I1IA1DA(VOCAB_RELATIVE_MOVE_GROUP, n_joint, joints, refs);
1698 }
1699 
1700 bool RemoteControlBoard::relativeMove(const double *deltas)
1701 {
1702  return set1VDA(VOCAB_RELATIVE_MOVES, deltas);
1703 }
1704 
1706 {
1707  return get1V1I1B(VOCAB_MOTION_DONE, j, *flag);
1708 }
1709 
1710 bool RemoteControlBoard::checkMotionDone(const int n_joint, const int *joints, bool *flag)
1711 {
1712  return get1V1I1IA1B(VOCAB_MOTION_DONE_GROUP, n_joint, joints, *flag);
1713 }
1714 
1716 {
1717  return get1V1B(VOCAB_MOTION_DONES, *flag);
1718 }
1719 
1720 bool RemoteControlBoard::setRefSpeed(int j, double sp)
1721 {
1722  return set1V1I1D(VOCAB_REF_SPEED, j, sp);
1723 }
1724 
1725 bool RemoteControlBoard::setRefSpeeds(const int n_joint, const int *joints, const double *spds)
1726 {
1727  return set1V1I1IA1DA(VOCAB_REF_SPEED_GROUP, n_joint, joints, spds);
1728 }
1729 
1730 bool RemoteControlBoard::setRefSpeeds(const double *spds)
1731 {
1732  return set1VDA(VOCAB_REF_SPEEDS, spds);
1733 }
1734 
1736 {
1737  return set1V1I1D(VOCAB_REF_ACCELERATION, j, acc);
1738 }
1739 
1740 bool RemoteControlBoard::setRefAccelerations(const int n_joint, const int *joints, const double *accs)
1741 {
1742  return set1V1I1IA1DA(VOCAB_REF_ACCELERATION_GROUP, n_joint, joints, accs);
1743 }
1744 
1746 {
1747  return set1VDA(VOCAB_REF_ACCELERATIONS, accs);
1748 }
1749 
1750 bool RemoteControlBoard::getRefSpeed(int j, double *ref)
1751 {
1752  return get1V1I1D(VOCAB_REF_SPEED, j, ref);
1753 }
1754 
1755 bool RemoteControlBoard::getRefSpeeds(const int n_joint, const int *joints, double *spds)
1756 {
1757  return get1V1I1IA1DA(VOCAB_REF_SPEED_GROUP, n_joint, joints, spds);
1758 }
1759 
1761 {
1762  return get1VDA(VOCAB_REF_SPEEDS, spds);
1763 }
1764 
1766 {
1767  return get1V1I1D(VOCAB_REF_ACCELERATION, j, acc);
1768 }
1769 
1770 bool RemoteControlBoard::getRefAccelerations(const int n_joint, const int *joints, double *accs)
1771 {
1772  return get1V1I1IA1DA(VOCAB_REF_ACCELERATION_GROUP, n_joint, joints, accs);
1773 }
1774 
1776 {
1777  return get1VDA(VOCAB_REF_ACCELERATIONS, accs);
1778 }
1779 
1781 {
1782  return set1V1I(VOCAB_STOP, j);
1783 }
1784 
1785 bool RemoteControlBoard::stop(const int len, const int *val1)
1786 {
1787  if (!isLive()) return false;
1788  Bottle cmd, response;
1789  cmd.addVocab(VOCAB_SET);
1791  cmd.addInt32(len);
1792  int i;
1793  Bottle& l1 = cmd.addList();
1794  for (i = 0; i < len; i++)
1795  l1.addInt32(val1[i]);
1796 
1797  bool ok = rpc_p.write(cmd, response);
1798  return CHECK_FAIL(ok, response);
1799 }
1800 
1802 {
1803  return set1V(VOCAB_STOPS);
1804 }
1805 
1806 // END IPositionControl
1807 
1808 // BEGIN IVelocityControl
1809 
1811 {
1812  // return set1V1I1D(VOCAB_VELOCITY_MOVE, j, v);
1813  if (!isLive()) return false;
1814  CommandMessage& c = command_buffer.get();
1815  c.head.clear();
1816  c.head.addVocab(VOCAB_VELOCITY_MOVE);
1817  c.head.addInt32(j);
1818  c.body.resize(1);
1819  memcpy(&(c.body[0]), &v, sizeof(double));
1820  command_buffer.write(writeStrict_singleJoint);
1821  return true;
1822 }
1823 
1825 {
1826  if (!isLive()) return false;
1827  CommandMessage& c = command_buffer.get();
1828  c.head.clear();
1829  c.head.addVocab(VOCAB_VELOCITY_MOVES);
1830  c.body.resize(nj);
1831  memcpy(&(c.body[0]), v, sizeof(double)*nj);
1832  command_buffer.write(writeStrict_moreJoints);
1833  return true;
1834 }
1835 
1836 // END IVelocityControl
1837 
1838 // BEGIN IAmplifierControl
1839 
1841 {
1842  return set1V1I(VOCAB_AMP_ENABLE, j);
1843 }
1844 
1846 {
1847  return set1V1I(VOCAB_AMP_DISABLE, j);
1848 }
1849 
1851 {
1852  return get1VIA(VOCAB_AMP_STATUS, st);
1853 }
1854 
1856 {
1857  return get1V1I1I(VOCAB_AMP_STATUS_SINGLE, j, st);
1858 }
1859 
1861 {
1862  return set1V1I1D(VOCAB_AMP_MAXCURRENT, j, v);
1863 }
1864 
1866 {
1867  return get1V1I1D(VOCAB_AMP_MAXCURRENT, j, v);
1868 }
1869 
1871 {
1872  return get1V1I1D(VOCAB_AMP_NOMINAL_CURRENT, m, val);
1873 }
1874 
1875 bool RemoteControlBoard::setNominalCurrent(int m, const double val)
1876 {
1877  return set1V1I1D(VOCAB_AMP_NOMINAL_CURRENT, m, val);
1878 }
1879 
1880 bool RemoteControlBoard::getPeakCurrent(int m, double *val)
1881 {
1882  return get1V1I1D(VOCAB_AMP_PEAK_CURRENT, m, val);
1883 }
1884 
1885 bool RemoteControlBoard::setPeakCurrent(int m, const double val)
1886 {
1887  return set1V1I1D(VOCAB_AMP_PEAK_CURRENT, m, val);
1888 }
1889 
1890 bool RemoteControlBoard::getPWM(int m, double* val)
1891 {
1892  double localArrivalTime = 0.0;
1893  extendedPortMutex.lock();
1894  bool ret = extendedIntputStatePort.getLastSingle(m, VOCAB_PWMCONTROL_PWM_OUTPUT, val, lastStamp, localArrivalTime);
1895  extendedPortMutex.unlock();
1896  return ret;
1897 }
1898 
1899 bool RemoteControlBoard::getPWMLimit(int m, double* val)
1900 {
1901  return get1V1I1D(VOCAB_AMP_PWM_LIMIT, m, val);
1902 }
1903 
1904 bool RemoteControlBoard::setPWMLimit(int m, const double val)
1905 {
1906  return set1V1I1D(VOCAB_AMP_PWM_LIMIT, m, val);
1907 }
1908 
1910 {
1911  return get1V1I1D(VOCAB_AMP_VOLTAGE_SUPPLY, m, val);
1912 }
1913 
1914 // END IAmplifierControl
1915 
1916 // BEGIN IControlLimits
1917 
1918 bool RemoteControlBoard::setLimits(int axis, double min, double max)
1919 {
1920  return set1V1I2D(VOCAB_LIMITS, axis, min, max);
1921 }
1922 
1923 bool RemoteControlBoard::getLimits(int axis, double *min, double *max)
1924 {
1925  return get1V1I2D(VOCAB_LIMITS, axis, min, max);
1926 }
1927 
1928 bool RemoteControlBoard::setVelLimits(int axis, double min, double max)
1929 {
1930  return set1V1I2D(VOCAB_VEL_LIMITS, axis, min, max);
1931 }
1932 
1933 bool RemoteControlBoard::getVelLimits(int axis, double *min, double *max)
1934 {
1935  return get1V1I2D(VOCAB_VEL_LIMITS, axis, min, max);
1936 }
1937 
1938 // END IControlLimits
1939 
1940 // BEGIN IAxisInfo
1941 
1942 bool RemoteControlBoard::getAxisName(int j, std::string& name)
1943 {
1944  return get1V1I1S(VOCAB_INFO_NAME, j, name);
1945 }
1946 
1948 {
1949  return get1V1I1I(VOCAB_INFO_TYPE, j, (int*)&type);
1950 }
1951 
1952 // END IAxisInfo
1953 
1954 // BEGIN IControlCalibration
1956 {
1957  return send1V(VOCAB_CALIBRATE);
1958 }
1959 
1961 {
1962  return send1V(VOCAB_ABORTCALIB);
1963 }
1964 
1966 {
1967  return send1V(VOCAB_ABORTPARK);
1968 }
1969 
1971 {
1972  return send1V(VOCAB_PARK);
1973 }
1974 
1975 bool RemoteControlBoard::calibrateAxisWithParams(int j, unsigned int ui, double v1, double v2, double v3)
1976 {
1977  Bottle cmd, response;
1978 
1980  cmd.addInt32(j);
1981  cmd.addInt32(ui);
1982  cmd.addFloat64(v1);
1983  cmd.addFloat64(v2);
1984  cmd.addFloat64(v3);
1985 
1986  bool ok = rpc_p.write(cmd, response);
1987 
1988  if (CHECK_FAIL(ok, response)) {
1989  return true;
1990  }
1991  return false;
1992 }
1993 
1995 {
1996  Bottle cmd, response;
1997 
1999  cmd.addInt32(j);
2000  cmd.addInt32(params.type);
2001  cmd.addFloat64(params.param1);
2002  cmd.addFloat64(params.param2);
2003  cmd.addFloat64(params.param3);
2004  cmd.addFloat64(params.param4);
2005 
2006  bool ok = rpc_p.write(cmd, response);
2007 
2008  if (CHECK_FAIL(ok, response)) {
2009  return true;
2010  }
2011  return false;
2012 }
2013 
2015 {
2016  return send1V1I(VOCAB_CALIBRATE_DONE, j);
2017 }
2018 
2019 // END IControlCalibration
2020 
2021 // BEGIN ITorqueControl
2022 
2024 {
2025  return get2V1I1D(VOCAB_TORQUE, VOCAB_REF, j, t);
2026 }
2027 
2029 {
2030  return get2V1DA(VOCAB_TORQUE, VOCAB_REFS, t);
2031 }
2032 
2034 {
2035  //Now we use streaming instead of rpc
2036  //return set2V1DA(VOCAB_TORQUE, VOCAB_REFS, t);
2037  if (!isLive()) return false;
2038  CommandMessage& c = command_buffer.get();
2039  c.head.clear();
2040  c.head.addVocab(VOCAB_TORQUES_DIRECTS);
2041 
2042  c.body.resize(nj);
2043 
2044  memcpy(c.body.data(), t, sizeof(double) * nj);
2045 
2046  command_buffer.write(writeStrict_moreJoints);
2047  return true;
2048 }
2049 
2051 {
2052  //return set2V1I1D(VOCAB_TORQUE, VOCAB_REF, j, v);
2053  // use the streaming port!
2054  if (!isLive()) return false;
2055  CommandMessage& c = command_buffer.get();
2056  c.head.clear();
2057  // in streaming port only SET command can be sent, so it is implicit
2058  c.head.addVocab(VOCAB_TORQUES_DIRECT);
2059  c.head.addInt32(j);
2060 
2061  c.body.clear();
2062  c.body.resize(1);
2063  c.body[0] = v;
2064  command_buffer.write(writeStrict_singleJoint);
2065  return true;
2066 }
2067 
2068 bool RemoteControlBoard::setRefTorques(const int n_joint, const int *joints, const double *t)
2069 {
2070  //return set2V1I1D(VOCAB_TORQUE, VOCAB_REF, j, v);
2071  // use the streaming port!
2072  if (!isLive()) return false;
2073  CommandMessage& c = command_buffer.get();
2074  c.head.clear();
2075  // in streaming port only SET command can be sent, so it is implicit
2076  c.head.addVocab(VOCAB_TORQUES_DIRECT_GROUP);
2077  c.head.addInt32(n_joint);
2078  Bottle &jointList = c.head.addList();
2079  for (int i = 0; i < n_joint; i++)
2080  jointList.addInt32(joints[i]);
2081  c.body.resize(n_joint);
2082  memcpy(&(c.body[0]), t, sizeof(double)*n_joint);
2083  command_buffer.write(writeStrict_moreJoints);
2084  return true;
2085 }
2086 
2088 {
2089  Bottle cmd, response;
2090  cmd.addVocab(VOCAB_SET);
2091  cmd.addVocab(VOCAB_TORQUE);
2093  cmd.addInt32(j);
2094  Bottle& b = cmd.addList();
2095  b.addFloat64(params.bemf);
2096  b.addFloat64(params.bemf_scale);
2097  b.addFloat64(params.ktau);
2098  b.addFloat64(params.ktau_scale);
2099  bool ok = rpc_p.write(cmd, response);
2100  return CHECK_FAIL(ok, response);
2101 }
2102 
2104 {
2105  Bottle cmd, response;
2106  cmd.addVocab(VOCAB_GET);
2107  cmd.addVocab(VOCAB_TORQUE);
2109  cmd.addInt32(j);
2110  bool ok = rpc_p.write(cmd, response);
2111  if (CHECK_FAIL(ok, response)) {
2112  Bottle* lp = response.get(2).asList();
2113  if (lp == nullptr)
2114  return false;
2115  Bottle& l = *lp;
2116  if (l.size() != 4)
2117  {
2118  yCError(REMOTECONTROLBOARD, "getMotorTorqueParams return value not understood, size!=4");
2119  return false;
2120  }
2121  params->bemf = l.get(0).asFloat64();
2122  params->bemf_scale = l.get(1).asFloat64();
2123  params->ktau = l.get(2).asFloat64();
2124  params->ktau_scale = l.get(3).asFloat64();
2125  return true;
2126  }
2127  return false;
2128 }
2129 
2130 bool RemoteControlBoard::getTorque(int j, double *t)
2131 {
2132  double localArrivalTime=0.0;
2133  extendedPortMutex.lock();
2134  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_TRQ, t, lastStamp, localArrivalTime);
2135  extendedPortMutex.unlock();
2136  return ret;
2137 }
2138 
2140 {
2141  double localArrivalTime=0.0;
2142  extendedPortMutex.lock();
2143  bool ret = extendedIntputStatePort.getLastVector(VOCAB_TRQS, t, lastStamp, localArrivalTime);
2144  extendedPortMutex.unlock();
2145  return ret;
2146 }
2147 
2148 bool RemoteControlBoard::getTorqueRange(int j, double *min, double* max)
2149 {
2150  return get2V1I2D(VOCAB_TORQUE, VOCAB_RANGE, j, min, max);
2151 }
2152 
2153 bool RemoteControlBoard::getTorqueRanges(double *min, double *max)
2154 {
2155  return get2V2DA(VOCAB_TORQUE, VOCAB_RANGES, min, max);
2156 }
2157 
2158 // END ITorqueControl
2159 
2160 // BEGIN IImpedanceControl
2161 
2162 bool RemoteControlBoard::getImpedance(int j, double *stiffness, double *damping)
2163 {
2164  Bottle cmd, response;
2165  cmd.addVocab(VOCAB_GET);
2168  cmd.addInt32(j);
2169  bool ok = rpc_p.write(cmd, response);
2170  if (CHECK_FAIL(ok, response)) {
2171  Bottle* lp = response.get(2).asList();
2172  if (lp == nullptr)
2173  return false;
2174  Bottle& l = *lp;
2175  *stiffness = l.get(0).asFloat64();
2176  *damping = l.get(1).asFloat64();
2177  return true;
2178  }
2179  return false;
2180 }
2181 
2182 bool RemoteControlBoard::getImpedanceOffset(int j, double *offset)
2183 {
2184  Bottle cmd, response;
2185  cmd.addVocab(VOCAB_GET);
2188  cmd.addInt32(j);
2189  bool ok = rpc_p.write(cmd, response);
2190  if (CHECK_FAIL(ok, response)) {
2191  Bottle* lp = response.get(2).asList();
2192  if (lp == nullptr)
2193  return false;
2194  Bottle& l = *lp;
2195  *offset = l.get(0).asFloat64();
2196  return true;
2197  }
2198  return false;
2199 }
2200 
2201 bool RemoteControlBoard::setImpedance(int j, double stiffness, double damping)
2202 {
2203  Bottle cmd, response;
2204  cmd.addVocab(VOCAB_SET);
2207  cmd.addInt32(j);
2208 
2209  Bottle& b = cmd.addList();
2210  b.addFloat64(stiffness);
2211  b.addFloat64(damping);
2212 
2213  bool ok = rpc_p.write(cmd, response);
2214  return CHECK_FAIL(ok, response);
2215 }
2216 
2217 bool RemoteControlBoard::setImpedanceOffset(int j, double offset)
2218 {
2219  Bottle cmd, response;
2220  cmd.addVocab(VOCAB_SET);
2223  cmd.addInt32(j);
2224 
2225  Bottle& b = cmd.addList();
2226  b.addFloat64(offset);
2227 
2228  bool ok = rpc_p.write(cmd, response);
2229  return CHECK_FAIL(ok, response);
2230 }
2231 
2232 bool RemoteControlBoard::getCurrentImpedanceLimit(int j, double *min_stiff, double *max_stiff, double *min_damp, double *max_damp)
2233 {
2234  Bottle cmd, response;
2235  cmd.addVocab(VOCAB_GET);
2237  cmd.addVocab(VOCAB_LIMITS);
2238  cmd.addInt32(j);
2239  bool ok = rpc_p.write(cmd, response);
2240  if (CHECK_FAIL(ok, response)) {
2241  Bottle* lp = response.get(2).asList();
2242  if (lp == nullptr)
2243  return false;
2244  Bottle& l = *lp;
2245  *min_stiff = l.get(0).asFloat64();
2246  *max_stiff = l.get(1).asFloat64();
2247  *min_damp = l.get(2).asFloat64();
2248  *max_damp = l.get(3).asFloat64();
2249  return true;
2250  }
2251  return false;
2252 }
2253 
2254 // END IImpedanceControl
2255 
2256 // BEGIN IControlMode
2257 
2259 {
2260  double localArrivalTime=0.0;
2261  extendedPortMutex.lock();
2262  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_CM_CONTROL_MODE, mode, lastStamp, localArrivalTime);
2263  extendedPortMutex.unlock();
2264  return ret;
2265 }
2266 
2268 {
2269  double localArrivalTime=0.0;
2270  extendedPortMutex.lock();
2271  bool ret = extendedIntputStatePort.getLastVector(VOCAB_CM_CONTROL_MODES, modes, lastStamp, localArrivalTime);
2272  extendedPortMutex.unlock();
2273  return ret;
2274 }
2275 
2276 bool RemoteControlBoard::getControlModes(const int n_joint, const int *joints, int *modes)
2277 {
2278  double localArrivalTime=0.0;
2279 
2280  extendedPortMutex.lock();
2281  bool ret = extendedIntputStatePort.getLastVector(VOCAB_CM_CONTROL_MODES, last_wholePart.controlMode.data(), lastStamp, localArrivalTime);
2282  if(ret)
2283  {
2284  for (int i = 0; i < n_joint; i++)
2285  modes[i] = last_wholePart.controlMode[joints[i]];
2286  }
2287  else
2288  ret = false;
2289 
2290  extendedPortMutex.unlock();
2291  return ret;
2292 }
2293 
2294 bool RemoteControlBoard::setControlMode(const int j, const int mode)
2295 {
2296  if (!isLive()) return false;
2297  Bottle cmd, response;
2298  cmd.addVocab(VOCAB_SET);
2301  cmd.addInt32(j);
2302  cmd.addVocab(mode);
2303 
2304  bool ok = rpc_p.write(cmd, response);
2305  return CHECK_FAIL(ok, response);
2306 }
2307 
2308 bool RemoteControlBoard::setControlModes(const int n_joint, const int *joints, int *modes)
2309 {
2310  if (!isLive()) return false;
2311  Bottle cmd, response;
2312  cmd.addVocab(VOCAB_SET);
2315  cmd.addInt32(n_joint);
2316  int i;
2317  Bottle& l1 = cmd.addList();
2318  for (i = 0; i < n_joint; i++)
2319  l1.addInt32(joints[i]);
2320 
2321  Bottle& l2 = cmd.addList();
2322  for (i = 0; i < n_joint; i++)
2323  l2.addVocab(modes[i]);
2324 
2325  bool ok = rpc_p.write(cmd, response);
2326  return CHECK_FAIL(ok, response);
2327 }
2328 
2330 {
2331  if (!isLive()) return false;
2332  Bottle cmd, response;
2333  cmd.addVocab(VOCAB_SET);
2336 
2337  Bottle& l2 = cmd.addList();
2338  for (size_t i = 0; i < nj; i++)
2339  l2.addVocab(modes[i]);
2340 
2341  bool ok = rpc_p.write(cmd, response);
2342  return CHECK_FAIL(ok, response);
2343 }
2344 
2345 // END IControlMode
2346 
2347 // BEGIN IPositionDirect
2348 
2349 bool RemoteControlBoard::setPosition(int j, double ref)
2350 {
2351  if (!isLive()) return false;
2352  CommandMessage& c = command_buffer.get();
2353  c.head.clear();
2354  c.head.addVocab(VOCAB_POSITION_DIRECT);
2355  c.head.addInt32(j);
2356  c.body.resize(1);
2357  memcpy(&(c.body[0]), &ref, sizeof(double));
2358  command_buffer.write(writeStrict_singleJoint);
2359  return true;
2360 }
2361 
2362 bool RemoteControlBoard::setPositions(const int n_joint, const int *joints, const double *refs)
2363 {
2364  if (!isLive()) return false;
2365  CommandMessage& c = command_buffer.get();
2366  c.head.clear();
2367  c.head.addVocab(VOCAB_POSITION_DIRECT_GROUP);
2368  c.head.addInt32(n_joint);
2369  Bottle &jointList = c.head.addList();
2370  for (int i = 0; i < n_joint; i++)
2371  jointList.addInt32(joints[i]);
2372  c.body.resize(n_joint);
2373  memcpy(&(c.body[0]), refs, sizeof(double)*n_joint);
2374  command_buffer.write(writeStrict_moreJoints);
2375  return true;
2376 }
2377 
2378 bool RemoteControlBoard::setPositions(const double *refs)
2379 {
2380  if (!isLive()) return false;
2381  CommandMessage& c = command_buffer.get();
2382  c.head.clear();
2383  c.head.addVocab(VOCAB_POSITION_DIRECTS);
2384  c.body.resize(nj);
2385  memcpy(&(c.body[0]), refs, sizeof(double)*nj);
2386  command_buffer.write(writeStrict_moreJoints);
2387  return true;
2388 }
2389 
2390 bool RemoteControlBoard::getRefPosition(const int joint, double* ref)
2391 {
2392  return get1V1I1D(VOCAB_POSITION_DIRECT, joint, ref);
2393 }
2394 
2396 {
2397  return get1V1DA(VOCAB_POSITION_DIRECTS, refs);
2398 }
2399 
2400 bool RemoteControlBoard::getRefPositions(const int n_joint, const int* joints, double* refs)
2401 {
2402  return get1V1I1IA1DA(VOCAB_POSITION_DIRECT_GROUP, n_joint, joints, refs);
2403 }
2404 
2405 // END IPositionDirect
2406 
2407 // BEGIN IVelocityControl
2408 
2409 bool RemoteControlBoard::velocityMove(const int n_joint, const int *joints, const double *spds)
2410 {
2411  // streaming port
2412  if (!isLive())
2413  return false;
2414  CommandMessage& c = command_buffer.get();
2415  c.head.clear();
2416  c.head.addVocab(VOCAB_VELOCITY_MOVE_GROUP);
2417  c.head.addInt32(n_joint);
2418  Bottle &jointList = c.head.addList();
2419  for (int i = 0; i < n_joint; i++)
2420  jointList.addInt32(joints[i]);
2421  c.body.resize(n_joint);
2422  memcpy(&(c.body[0]), spds, sizeof(double)*n_joint);
2423  command_buffer.write(writeStrict_moreJoints);
2424  return true;
2425 }
2426 
2427 bool RemoteControlBoard::getRefVelocity(const int joint, double* vel)
2428 {
2429  return get1V1I1D(VOCAB_VELOCITY_MOVE, joint, vel);
2430 }
2431 
2433 {
2434  return get1VDA(VOCAB_VELOCITY_MOVES, vels);
2435 }
2436 
2437 bool RemoteControlBoard::getRefVelocities(const int n_joint, const int* joints, double* vels)
2438 {
2439  return get1V1I1IA1DA(VOCAB_VELOCITY_MOVE_GROUP, n_joint, joints, vels);
2440 }
2441 
2442 // END IVelocityControl
2443 
2444 // BEGIN IInteractionMode
2445 
2447 {
2448  double localArrivalTime=0.0;
2449  extendedPortMutex.lock();
2450  bool ret = extendedIntputStatePort.getLastSingle(axis, VOCAB_INTERACTION_MODE, (int*) mode, lastStamp, localArrivalTime);
2451  extendedPortMutex.unlock();
2452  return ret;
2453 }
2454 
2456 {
2457  double localArrivalTime=0.0;
2458 
2459  extendedPortMutex.lock();
2460  bool ret = extendedIntputStatePort.getLastVector(VOCAB_INTERACTION_MODES, last_wholePart.interactionMode.data(), lastStamp, localArrivalTime);
2461  if(ret)
2462  {
2463  for (int i = 0; i < n_joints; i++)
2464  modes[i] = (yarp::dev::InteractionModeEnum)last_wholePart.interactionMode[joints[i]];
2465  }
2466  else
2467  ret = false;
2468 
2469  extendedPortMutex.unlock();
2470  return ret;
2471 }
2472 
2474 {
2475  double localArrivalTime=0.0;
2476  extendedPortMutex.lock();
2477  bool ret = extendedIntputStatePort.getLastVector(VOCAB_INTERACTION_MODES, (int*) modes, lastStamp, localArrivalTime);
2478  extendedPortMutex.unlock();
2479  return ret;
2480 }
2481 
2483 {
2484  Bottle cmd, response;
2485  if (!isLive()) return false;
2486 
2487  cmd.addVocab(VOCAB_SET);
2490  cmd.addInt32(axis);
2491  cmd.addVocab(mode);
2492 
2493  bool ok = rpc_p.write(cmd, response);
2494  return CHECK_FAIL(ok, response);
2495 }
2496 
2498 {
2499  Bottle cmd, response;
2500  if (!isLive()) return false;
2501 
2502  cmd.addVocab(VOCAB_SET);
2505  cmd.addInt32(n_joints);
2506 
2507  Bottle& l1 = cmd.addList();
2508  for (int i = 0; i < n_joints; i++)
2509  l1.addInt32(joints[i]);
2510 
2511  Bottle& l2 = cmd.addList();
2512  for (int i = 0; i < n_joints; i++)
2513  {
2514  l2.addVocab(modes[i]);
2515  }
2516  bool ok = rpc_p.write(cmd, response);
2517  return CHECK_FAIL(ok, response);
2518 }
2519 
2521 {
2522  Bottle cmd, response;
2523  if (!isLive()) return false;
2524 
2525  cmd.addVocab(VOCAB_SET);
2528 
2529  Bottle& l1 = cmd.addList();
2530  for (size_t i = 0; i < nj; i++)
2531  l1.addVocab(modes[i]);
2532 
2533  bool ok = rpc_p.write(cmd, response);
2534  return CHECK_FAIL(ok, response);
2535 }
2536 
2537 // END IInteractionMode
2538 
2539 // BEGIN IRemoteCalibrator
2540 
2542 {
2543  Bottle cmd, response;
2544  cmd.addVocab(VOCAB_GET);
2547  bool ok = rpc_p.write(cmd, response);
2548  if(ok) {
2549  *isCalib = response.get(2).asInt32()!=0;
2550  } else {
2551  *isCalib = false;
2552  }
2553  return CHECK_FAIL(ok, response);
2554 }
2555 
2557 {
2559 }
2560 
2562 {
2563  Bottle cmd, response;
2564  cmd.addVocab(VOCAB_SET);
2567  bool ok = rpc_p.write(cmd, response);
2568  return CHECK_FAIL(ok, response);
2569 }
2570 
2572 {
2574 }
2575 
2577 {
2578  Bottle cmd, response;
2579  cmd.addVocab(VOCAB_SET);
2582  bool ok = rpc_p.write(cmd, response);
2583  yCDebug(REMOTECONTROLBOARD) << "Sent homing whole part message";
2584  return CHECK_FAIL(ok, response);
2585 }
2586 
2588 {
2590 }
2591 
2593 {
2594  Bottle cmd, response;
2595  cmd.addVocab(VOCAB_SET);
2598  bool ok = rpc_p.write(cmd, response);
2599  return CHECK_FAIL(ok, response);
2600 }
2601 
2603 {
2604  Bottle cmd, response;
2605  cmd.addVocab(VOCAB_SET);
2608  bool ok = rpc_p.write(cmd, response);
2609  return CHECK_FAIL(ok, response);
2610 }
2611 
2613 {
2614  Bottle cmd, response;
2615  cmd.addVocab(VOCAB_SET);
2618  bool ok = rpc_p.write(cmd, response);
2619  return CHECK_FAIL(ok, response);
2620 }
2621 
2622 // END IRemoteCalibrator
2623 
2624 // BEGIN ICurrentControl
2625 
2627 {
2629 }
2630 
2632 {
2633  return get2V1I1D(VOCAB_CURRENTCONTROL_INTERFACE, VOCAB_CURRENT_REF, j, t);
2634 }
2635 
2636 bool RemoteControlBoard::setRefCurrents(const double *refs)
2637 {
2638  if (!isLive()) return false;
2639  CommandMessage& c = command_buffer.get();
2640  c.head.clear();
2642  c.head.addVocab(VOCAB_CURRENT_REFS);
2643  c.body.resize(nj);
2644  memcpy(&(c.body[0]), refs, sizeof(double)*nj);
2645  command_buffer.write(writeStrict_moreJoints);
2646  return true;
2647 }
2648 
2649 bool RemoteControlBoard::setRefCurrent(int j, double ref)
2650 {
2651  if (!isLive()) return false;
2652  CommandMessage& c = command_buffer.get();
2653  c.head.clear();
2655  c.head.addVocab(VOCAB_CURRENT_REF);
2656  c.head.addInt32(j);
2657  c.body.resize(1);
2658  memcpy(&(c.body[0]), &ref, sizeof(double));
2659  command_buffer.write(writeStrict_singleJoint);
2660  return true;
2661 }
2662 
2663 bool RemoteControlBoard::setRefCurrents(const int n_joint, const int *joints, const double *refs)
2664 {
2665  if (!isLive()) return false;
2666  CommandMessage& c = command_buffer.get();
2667  c.head.clear();
2669  c.head.addVocab(VOCAB_CURRENT_REF_GROUP);
2670  c.head.addInt32(n_joint);
2671  Bottle &jointList = c.head.addList();
2672  for (int i = 0; i < n_joint; i++)
2673  jointList.addInt32(joints[i]);
2674  c.body.resize(n_joint);
2675  memcpy(&(c.body[0]), refs, sizeof(double)*n_joint);
2676  command_buffer.write(writeStrict_moreJoints);
2677  return true;
2678 }
2679 
2681 {
2682  double localArrivalTime=0.0;
2683  extendedPortMutex.lock();
2684  bool ret = extendedIntputStatePort.getLastVector(VOCAB_AMP_CURRENTS, vals, lastStamp, localArrivalTime);
2685  extendedPortMutex.unlock();
2686  return ret;
2687 }
2688 
2689 bool RemoteControlBoard::getCurrent(int j, double *val)
2690 {
2691  double localArrivalTime=0.0;
2692  extendedPortMutex.lock();
2693  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_AMP_CURRENT, val, lastStamp, localArrivalTime);
2694  extendedPortMutex.unlock();
2695  return ret;
2696 }
2697 
2698 bool RemoteControlBoard::getCurrentRange(int j, double *min, double *max)
2699 {
2700  return get2V1I2D(VOCAB_CURRENTCONTROL_INTERFACE, VOCAB_CURRENT_RANGE, j, min, max);
2701 }
2702 
2703 bool RemoteControlBoard::getCurrentRanges(double *min, double *max)
2704 {
2705  return get2V2DA(VOCAB_CURRENTCONTROL_INTERFACE, VOCAB_CURRENT_RANGES, min, max);
2706 }
2707 
2708 // END ICurrentControl
2709 
2710 // BEGIN IPWMControl
2712 {
2713  // using the streaming port
2714  if (!isLive()) return false;
2715  CommandMessage& c = command_buffer.get();
2716  c.head.clear();
2717  // in streaming port only SET command can be sent, so it is implicit
2718  c.head.addVocab(VOCAB_PWMCONTROL_INTERFACE);
2719  c.head.addVocab(VOCAB_PWMCONTROL_REF_PWM);
2720  c.head.addInt32(j);
2721 
2722  c.body.clear();
2723  c.body.resize(1);
2724  c.body[0] = v;
2725  command_buffer.write(writeStrict_singleJoint);
2726  return true;
2727 }
2728 
2730 {
2731  // using the streaming port
2732  if (!isLive()) return false;
2733  CommandMessage& c = command_buffer.get();
2734  c.head.clear();
2735  c.head.addVocab(VOCAB_PWMCONTROL_INTERFACE);
2736  c.head.addVocab(VOCAB_PWMCONTROL_REF_PWMS);
2737 
2738  c.body.resize(nj);
2739 
2740  memcpy(&(c.body[0]), v, sizeof(double)*nj);
2741 
2742  command_buffer.write(writeStrict_moreJoints);
2743 
2744  return true;
2745 }
2746 
2747 bool RemoteControlBoard::getRefDutyCycle(int j, double *ref)
2748 {
2749  Bottle cmd, response;
2750  cmd.addVocab(VOCAB_GET);
2753  cmd.addInt32(j);
2754  response.clear();
2755 
2756  bool ok = rpc_p.write(cmd, response);
2757 
2758  if (CHECK_FAIL(ok, response))
2759  {
2760  // ok
2761  *ref = response.get(2).asFloat64();
2762 
2763  getTimeStamp(response, lastStamp);
2764  return true;
2765  }
2766  else
2767  return false;
2768 }
2769 
2771 {
2772  return get2V1DA(VOCAB_PWMCONTROL_INTERFACE, VOCAB_PWMCONTROL_REF_PWMS, refs);
2773 }
2774 
2775 bool RemoteControlBoard::getDutyCycle(int j, double *out)
2776 {
2777  double localArrivalTime = 0.0;
2778  extendedPortMutex.lock();
2779  bool ret = extendedIntputStatePort.getLastSingle(j, VOCAB_PWMCONTROL_PWM_OUTPUT, out, lastStamp, localArrivalTime);
2780  extendedPortMutex.unlock();
2781  return ret;
2782 }
2783 
2785 {
2786  double localArrivalTime = 0.0;
2787  extendedPortMutex.lock();
2788  bool ret = extendedIntputStatePort.getLastVector(VOCAB_PWMCONTROL_PWM_OUTPUTS, outs, lastStamp, localArrivalTime);
2789  extendedPortMutex.unlock();
2790  return ret;
2791 }
2792 // END IPWMControl
VOCAB_TEMPERATURE
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE
Definition: IMotor.h:165
LogStream.h
VOCAB_CURRENT_RANGE
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_RANGE
Definition: ICurrentControl.h:202
VOCAB_TEMPERATURES
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURES
Definition: IMotor.h:167
DiagnosticThread::setOwner
void setOwner(StateExtendedInputPort *o)
Definition: RemoteControlBoard.cpp:73
RemoteControlBoard::getJointType
bool getJointType(int j, yarp::dev::JointTypeEnum &type) override
Definition: RemoteControlBoard.cpp:1947
RemoteControlBoard::getRemoteVariable
bool getRemoteVariable(std::string key, yarp::os::Bottle &val) override
Definition: RemoteControlBoard.cpp:1434
VOCAB_VARIABLE
constexpr yarp::conf::vocab32_t VOCAB_VARIABLE
Definition: IRemoteVariables.h:66
RemoteControlBoard::abortCalibration
bool abortCalibration() override
Definition: RemoteControlBoard.cpp:1960
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
RemoteControlBoard::setRemoteVariable
bool setRemoteVariable(std::string key, const yarp::os::Bottle &val) override
Definition: RemoteControlBoard.cpp:1450
yarp::os::Value::asVocab
virtual std::int32_t asVocab() const
Get vocabulary identifier as an integer.
Definition: Value.cpp:231
RemoteControlBoard::send2V
bool send2V(int v1, int v2)
Definition: RemoteControlBoard.cpp:413
VOCAB_AMP_PEAK_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_PEAK_CURRENT
Definition: IAmplifierControl.h:329
VOCAB_MOTOR_ENCODERS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODERS
Definition: IMotorEncoders.h:280
VOCAB_RELATIVE_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVE_GROUP
Definition: IPositionControl.h:478
VOCAB_LIM
constexpr yarp::conf::vocab32_t VOCAB_LIM
Definition: GenericVocabs.h:30
RemoteControlBoard::getMotorEncoder
bool getMotorEncoder(int j, double *v) override
Read the value of a motor encoder.
Definition: RemoteControlBoard.cpp:1555
yarp::dev::MotorTorqueParameters::bemf
double bemf
Definition: ITorqueControl.h:26
RemoteControlBoard::getMotorEncoderCountsPerRevolution
bool getMotorEncoderCountsPerRevolution(int m, double *cpr) override
Gets number of counts per revolution for motor encoder m.
Definition: RemoteControlBoard.cpp:1545
RemoteControlBoard::disableAmp
bool disableAmp(int j) override
Disable the amplifier on a specific joint.
Definition: RemoteControlBoard.cpp:1845
RemoteControlBoard::getRefPositions
bool getRefPositions(double *refs) override
Get the last position reference for all axes.
Definition: RemoteControlBoard.cpp:2395
RemoteControlBoard::getTemperatureLimit
bool getTemperatureLimit(int m, double *val) override
Retreives the current temperature limit for a specific motor.
Definition: RemoteControlBoard.cpp:1501
VOCAB_STOP
constexpr yarp::conf::vocab32_t VOCAB_STOP
Definition: ControlBoardVocabs.h:31
RemoteControlBoard.h
RemoteControlBoard::getTargetPositions
bool getTargetPositions(double *refs) override
Get the last position reference for all axes.
Definition: RemoteControlBoard.cpp:1680
yarp::os::Bottle::clear
void clear()
Empties the bottle of any objects it contains.
Definition: Bottle.cpp:124
VOCAB_HOMING_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_HOMING_WHOLE_PART
Definition: CalibratorVocabs.h:20
RemoteControlBoard::getImpedance
bool getImpedance(int j, double *stiffness, double *damping) override
Get current impedance gains (stiffness,damping,offset) for a specific joint.
Definition: RemoteControlBoard.cpp:2162
Network.h
VOCAB_AMP_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENT
Definition: IAmplifierControl.h:325
RemoteControlBoard::get1V1DA
bool get1V1DA(int v1, double *val)
Helper method to get an array of double from the remote peer.
Definition: RemoteControlBoard.cpp:947
RemoteControlBoard::setEncoders
bool setEncoders(const double *vals) override
Set the value of all encoders.
Definition: RemoteControlBoard.cpp:1344
RemoteControlBoard::send3V1I
bool send3V1I(int v1, int v2, int v3, int j)
Definition: RemoteControlBoard.cpp:450
stateExtendedReader.h
yarp::os::Searchable
A base class for nested structures that can be searched.
Definition: Searchable.h:69
yarp::dev::Pid::stiction_up_val
double stiction_up_val
up stiction offset added to the pid output
Definition: ControlBoardPid.h:38
yarp::os::NetworkBase::setConnectionQos
static bool setConnectionQos(const std::string &src, const std::string &dest, const QosStyle &srcStyle, const QosStyle &destStyle, bool quiet=true)
Adjust the Qos preferences of a connection.
Definition: Network.cpp:1082
yarp::os::QosStyle
Preferences for the port's Quality of Service.
Definition: QosStyle.h:26
StateExtendedInputPort
Definition: stateExtendedReader.h:44
yarp::os::PortablePair
Group a pair of objects to be sent and received together.
Definition: PortablePair.h:51
RemoteControlBoard::getPidErrorLimit
bool getPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double *limit) override
Get the error limit for the controller on a specific joint.
Definition: RemoteControlBoard.cpp:1244
yarp::os::Bottle::size
size_type size() const
Gets the number of elements in the bottle.
Definition: Bottle.cpp:254
VOCAB_ENABLE
constexpr yarp::conf::vocab32_t VOCAB_ENABLE
Definition: GenericVocabs.h:34
VOCAB_CALIBRATE_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_SINGLE_JOINT
Definition: CalibratorVocabs.h:17
RemoteControlBoard::enableAmp
bool enableAmp(int j) override
Enable the amplifier on a specific joint.
Definition: RemoteControlBoard.cpp:1840
VOCAB_INTERACTION_MODES
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODES
Definition: IInteractionMode.h:32
RemoteControlBoard::setPids
bool setPids(const PidControlTypeEnum &pidtype, const Pid *pids) override
Set new pid value on multiple axes.
Definition: RemoteControlBoard.cpp:1111
VOCAB_ENCODER_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_SPEEDS
Definition: IEncoders.h:216
yarp::dev::MotorTorqueParameters::ktau_scale
double ktau_scale
Definition: ITorqueControl.h:29
yarp::os::PortablePair::body
BODY body
An object of the second type (BODY).
Definition: PortablePair.h:61
yarp::sig
Signal processing.
Definition: Image.h:25
DiagnosticThread::run
void run() override
Loop function.
Definition: RemoteControlBoard.cpp:79
RemoteControlBoard::getRefCurrent
bool getRefCurrent(int j, double *t) override
Get the reference value of the current for a single motor.
Definition: RemoteControlBoard.cpp:2631
t
float t
Definition: FfmpegWriter.cpp:74
VOCAB_ENCODER_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_ACCELERATIONS
Definition: IEncoders.h:218
RemoteControlBoard::resetEncoder
bool resetEncoder(int j) override
Reset encoder, single joint.
Definition: RemoteControlBoard.cpp:1329
VOCAB_CALIBRATE_JOINT_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_JOINT_PARAMS
Definition: IControlCalibration.h:145
VOCAB_AMP_VOLTAGE_SUPPLY
constexpr yarp::conf::vocab32_t VOCAB_AMP_VOLTAGE_SUPPLY
Definition: IAmplifierControl.h:332
yarp::dev::Pid::max_output
double max_output
max output
Definition: ControlBoardPid.h:36
RemoteControlBoard::getAxes
bool getAxes(int *ax) override
Get the number of controlled axes.
Definition: RemoteControlBoard.cpp:1081
VOCAB_AMP_PWM_LIMIT
constexpr yarp::conf::vocab32_t VOCAB_AMP_PWM_LIMIT
Definition: IAmplifierControl.h:331
VOCAB_TEMPERATURE_LIMIT
constexpr yarp::conf::vocab32_t VOCAB_TEMPERATURE_LIMIT
Definition: IMotor.h:168
RemoteControlBoard::getMotorEncoderTimed
bool getMotorEncoderTimed(int j, double *v, double *t) override
Read the instantaneous position of a motor encoder.
Definition: RemoteControlBoard.cpp:1565
RemoteControlBoard::calibrateRobot
bool calibrateRobot() override
Calibrate robot by using an external calibrator.
Definition: RemoteControlBoard.cpp:1955
RemoteControlBoard::setPidReferences
bool setPidReferences(const PidControlTypeEnum &pidtype, const double *refs) override
Set the controller reference, multiple axes.
Definition: RemoteControlBoard.cpp:1143
yarp::os::Searchable::findGroup
virtual Bottle & findGroup(const std::string &key) const =0
Gets a list corresponding to a given keyword.
yCWarning
#define yCWarning(component,...)
Definition: LogComponent.h:146
RemoteControlBoard::calibrationDone
bool calibrationDone(int j) override
Check if the calibration is terminated, on a particular joint.
Definition: RemoteControlBoard.cpp:2014
VOCAB_AMP_STATUS
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS
Definition: IAmplifierControl.h:323
RemoteControlBoard::resetPid
bool resetPid(const PidControlTypeEnum &pidtype, int j) override
Reset the controller of a given joint, usually sets the current status of the joint as the reference ...
Definition: RemoteControlBoard.cpp:1254
VOCAB_CURRENT_REF_GROUP
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF_GROUP
Definition: ICurrentControl.h:201
VOCAB_PWMCONTROL_REF_PWMS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWMS
Definition: IPWMControl.h:147
VOCAB_MOTOR_ENCODER_SPEED
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEED
Definition: IMotorEncoders.h:285
yarp::dev::MotorTorqueParameters
Definition: ITorqueControl.h:24
RemoteControlBoard::setRefTorque
bool setRefTorque(int j, double v) override
Set the reference value of the torque for a given joint.
Definition: RemoteControlBoard.cpp:2050
RemoteControlBoard::getMotorEncodersTimed
bool getMotorEncodersTimed(double *encs, double *ts) override
Read the instantaneous position of all motor encoders.
Definition: RemoteControlBoard.cpp:1587
RemoteControlBoard::getTargetPosition
bool getTargetPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
Definition: RemoteControlBoard.cpp:1675
VOCAB_INTERACTION_MODE
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODE
Definition: IInteractionMode.h:30
VOCAB_POSITION_MOVES
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVES
Definition: ControlBoardVocabs.h:23
VOCAB_AMP_NOMINAL_CURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_NOMINAL_CURRENT
Definition: IAmplifierControl.h:328
RemoteControlBoard::resetMotorEncoders
bool resetMotorEncoders() override
Reset motor encoders.
Definition: RemoteControlBoard.cpp:1530
VOCAB_MOTION_DONE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONE_GROUP
Definition: IPositionControl.h:479
RemoteControlBoard::getDutyCycle
bool getDutyCycle(int j, double *out) override
Gets the current dutycycle of the output of the amplifier (i.e.
Definition: RemoteControlBoard.cpp:2775
yarp::dev::CalibrationParameters::param3
double param3
Definition: IControlCalibration.h:36
IPreciselyTimed.h
yarp::dev::CalibrationParameters::param1
double param1
Definition: IControlCalibration.h:34
VOCAB_TORQUES_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT
Definition: ITorqueControl.h:245
RemoteControlBoard::isPidEnabled
bool isPidEnabled(const PidControlTypeEnum &pidtype, int j, bool *enabled) override
Get the current status (enabled/disabled) of the pid.
Definition: RemoteControlBoard.cpp:1293
RemoteControlBoard::getRefAcceleration
bool getRefAcceleration(int j, double *acc) override
Get reference acceleration for a joint.
Definition: RemoteControlBoard.cpp:1765
VOCAB_AMP_MAXCURRENT
constexpr yarp::conf::vocab32_t VOCAB_AMP_MAXCURRENT
Definition: IAmplifierControl.h:327
RemoteControlBoard::getPeakCurrent
bool getPeakCurrent(int m, double *val) override
Definition: RemoteControlBoard.cpp:1880
VOCAB_ENCODER
constexpr yarp::conf::vocab32_t VOCAB_ENCODER
Definition: IEncoders.h:211
VOCAB_GET
constexpr yarp::conf::vocab32_t VOCAB_GET
Definition: GenericVocabs.h:16
VOCAB_TORQUES_DIRECTS
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECTS
Definition: ITorqueControl.h:244
RemoteControlBoard::getRefTorques
bool getRefTorques(double *t) override
Get the reference value of the torque for all joints.
Definition: RemoteControlBoard.cpp:2028
VOCAB_RELATIVE_MOVES
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVES
Definition: ControlBoardVocabs.h:26
RemoteControlBoard::getCurrentRange
bool getCurrentRange(int j, double *min, double *max) override
Get the full scale of the current measurement for a given motor (e.g.
Definition: RemoteControlBoard.cpp:2698
VOCAB_AMP_DISABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_DISABLE
Definition: IAmplifierControl.h:322
VOCAB_RANGES
constexpr yarp::conf::vocab32_t VOCAB_RANGES
Definition: ITorqueControl.h:240
RemoteControlBoard::getDutyCycles
bool getDutyCycles(double *outs) override
Gets the current dutycycle of the output of the amplifier (i.e.
Definition: RemoteControlBoard.cpp:2784
VOCAB_AMP_CURRENTS
constexpr yarp::conf::vocab32_t VOCAB_AMP_CURRENTS
Definition: IAmplifierControl.h:326
ControlBoardHelpers.h
REMOTECONTROLBOARD
const yarp::os::LogComponent & REMOTECONTROLBOARD()
Definition: RemoteControlBoardLogComponent.cpp:11
RemoteControlBoard::setMotorEncoder
bool setMotorEncoder(int j, const double val) override
Set the value of the motor encoder for a given motor.
Definition: RemoteControlBoard.cpp:1535
RemoteControlBoard::isLive
bool isLive()
Definition: RemoteControlBoard.cpp:105
RemoteControlBoard::setPid
bool setPid(const PidControlTypeEnum &pidtype, int j, const Pid &pid) override
Set new pid value for a joint axis.
Definition: RemoteControlBoard.cpp:1088
yarp::os::PeriodicThread::PeriodicThread
PeriodicThread(double period, ShouldUseSystemClock useSystemClock=ShouldUseSystemClock::No)
Constructor.
Definition: PeriodicThread.cpp:271
VOCAB_POSITION_DIRECTS
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECTS
Definition: IPositionDirect.h:194
VOCAB_CALIBRATE_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_WHOLE_PART
Definition: CalibratorVocabs.h:18
RemoteControlBoard::relativeMove
bool relativeMove(int j, double delta) override
Set relative position.
Definition: RemoteControlBoard.cpp:1690
RemoteControlBoard::getPidErrorLimits
bool getPidErrorLimits(const PidControlTypeEnum &pidtype, double *limits) override
Get the error limit for all controllers.
Definition: RemoteControlBoard.cpp:1249
VOCAB_REMOTE_CALIBRATOR_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_REMOTE_CALIBRATOR_INTERFACE
Definition: CalibratorVocabs.h:15
VOCAB_RESET
constexpr yarp::conf::vocab32_t VOCAB_RESET
Definition: GenericVocabs.h:32
RemoteControlBoard::setMotorEncoders
bool setMotorEncoders(const double *vals) override
Set the value of all motor encoders.
Definition: RemoteControlBoard.cpp:1550
RemoteControlBoard::getRefSpeed
bool getRefSpeed(int j, double *ref) override
Get reference speed for a joint.
Definition: RemoteControlBoard.cpp:1750
yarp::dev::Pid::scale
double scale
scale for the pid output
Definition: ControlBoardPid.h:35
yarp::dev::Pid::ki
double ki
integrative gain
Definition: ControlBoardPid.h:33
ret
bool ret
Definition: ImplementAxisInfo.cpp:72
RemoteControlBoard::getPidOutputs
bool getPidOutputs(const PidControlTypeEnum &pidtype, double *outs) override
Get the output of the controllers (e.g.
Definition: RemoteControlBoard.cpp:1315
RemoteControlBoard::set1V1I1IA1DA
bool set1V1I1IA1DA(int v, const int len, const int *val1, const double *val2)
Definition: RemoteControlBoard.cpp:606
RemoteControlBoard::quitCalibrate
bool quitCalibrate() override
quitCalibrate: interrupt the calibration procedure
Definition: RemoteControlBoard.cpp:2602
VOCAB_REF
constexpr yarp::conf::vocab32_t VOCAB_REF
Definition: GenericVocabs.h:27
RemoteControlBoard::getLimits
bool getLimits(int axis, double *min, double *max) override
Get the software limits for a particular axis.
Definition: RemoteControlBoard.cpp:1923
RemoteControlBoard::getPidError
bool getPidError(const PidControlTypeEnum &pidtype, int j, double *err) override
Get the current error for a joint.
Definition: RemoteControlBoard.cpp:1158
VOCAB_E_RESET
constexpr yarp::conf::vocab32_t VOCAB_E_RESET
Definition: IEncoders.h:209
RemoteControlBoard::get2V1DA
bool get2V1DA(int v1, int v2, double *val)
Helper method to get an array of double from the remote peer.
Definition: RemoteControlBoard.cpp:970
RemoteControlBoard::get2V1I1IA1DA
bool get2V1I1IA1DA(int v1, int v2, const int n_joints, const int *joints, double *retVals, std::string functionName="")
Definition: RemoteControlBoard.cpp:844
RemoteControlBoard::getCurrent
bool getCurrent(int j, double *val) override
Definition: RemoteControlBoard.cpp:2689
RemoteControlBoard::getTemperature
bool getTemperature(int m, double *val) override
Get temperature of a motor.
Definition: RemoteControlBoard.cpp:1491
ControlBoardInterfaces.h
define control board standard interfaces
RemoteControlBoard::getRefVelocity
bool getRefVelocity(const int joint, double *vel) override
Get the last reference speed set by velocityMove for single joint.
Definition: RemoteControlBoard.cpp:2427
RemoteControlBoard::getRefDutyCycles
bool getRefDutyCycles(double *refs) override
Gets the last reference sent using the setRefDutyCycles function.
Definition: RemoteControlBoard.cpp:2770
yarp::os::Bottle::addFloat64
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
Definition: Bottle.cpp:161
RemoteControlBoard::getCurrents
bool getCurrents(double *vals) override
Definition: RemoteControlBoard.cpp:2680
VOCAB_TRQ
constexpr yarp::conf::vocab32_t VOCAB_TRQ
Definition: ITorqueControl.h:237
VOCAB_OFFSET
constexpr yarp::conf::vocab32_t VOCAB_OFFSET
Definition: GenericVocabs.h:26
yarp::os::Bottle::find
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition: Bottle.cpp:290
PortablePair.h
yarp::dev
An interface for the device drivers.
Definition: audioBufferSizeData.cpp:17
RemoteControlBoard::quitPark
bool quitPark() override
quitPark: interrupt the park procedure
Definition: RemoteControlBoard.cpp:2612
yarp::dev::MotorTorqueParameters::ktau
double ktau
Definition: ITorqueControl.h:28
RemoteControlBoardLogComponent.h
RemoteControlBoard::setMotorTorqueParams
bool setMotorTorqueParams(int j, const MotorTorqueParameters params) override
Set a subset of motor parameters (bemf, ktau etc) useful for torque control.
Definition: RemoteControlBoard.cpp:2087
VOCAB_TORQUES_DIRECT_GROUP
constexpr yarp::conf::vocab32_t VOCAB_TORQUES_DIRECT_GROUP
Definition: ITorqueControl.h:246
RemoteControlBoard::velocityMove
bool velocityMove(int j, double v) override
Start motion at a given speed, single joint.
Definition: RemoteControlBoard.cpp:1810
RemoteControlBoard::parkSingleJoint
bool parkSingleJoint(int j, bool _wait=true) override
parkSingleJoint(): start the parking procedure for the single joint
Definition: RemoteControlBoard.cpp:2587
yarp::os::QosStyle::setPacketPriority
bool setPacketPriority(const std::string &priority)
sets the packet priority from a string.
Definition: QosStyle.cpp:42
RemoteControlBoard::getPidReferences
bool getPidReferences(const PidControlTypeEnum &pidtype, double *refs) override
Get the current reference of all pid controllers.
Definition: RemoteControlBoard.cpp:1239
RemoteControlBoard::getRefCurrents
bool getRefCurrents(double *t) override
Get the reference value of the currents for all motors.
Definition: RemoteControlBoard.cpp:2626
RemoteControlBoard::setRefSpeeds
bool setRefSpeeds(const int n_joint, const int *joints, const double *spds) override
Set reference speed on all joints.
Definition: RemoteControlBoard.cpp:1725
RemoteControlBoard::setPidOffset
bool setPidOffset(const PidControlTypeEnum &pidtype, int j, double v) override
Set offset value for a given controller.
Definition: RemoteControlBoard.cpp:1320
RemoteControlBoard::getVelLimits
bool getVelLimits(int axis, double *min, double *max) override
Get the software speed limits for a particular axis.
Definition: RemoteControlBoard.cpp:1933
RemoteControlBoard::get1VIA
bool get1VIA(int v, int *val)
Helper method to get an array of integers from the remote peer.
Definition: RemoteControlBoard.cpp:901
VOCAB_VELOCITY_MOVES
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVES
Definition: ControlBoardVocabs.h:37
RemoteControlBoard::setTemperatureLimit
bool setTemperatureLimit(int m, const double val) override
Set the temperature limit for a specific motor.
Definition: RemoteControlBoard.cpp:1506
RemoteControlBoard::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: RemoteControlBoard.cpp:2232
VOCAB_TRQS
constexpr yarp::conf::vocab32_t VOCAB_TRQS
Definition: ITorqueControl.h:236
RemoteControlBoard::setValWithPidType
bool setValWithPidType(int voc, PidControlTypeEnum type, int axis, double val)
Definition: RemoteControlBoard.cpp:636
VOCAB_REF_SPEED_GROUP
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEED_GROUP
Definition: IPositionControl.h:480
RemoteControlBoard::getTemperatures
bool getTemperatures(double *vals) override
Get temperature of all the motors.
Definition: RemoteControlBoard.cpp:1496
VOCAB_ENCODER_SPEED
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_SPEED
Definition: IEncoders.h:215
VOCAB_CM_CONTROL_MODE
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODE
Definition: IControlMode.h:120
yarp::os::Bottle::check
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition: Bottle.cpp:280
RemoteControlBoard::getPids
bool getPids(const PidControlTypeEnum &pidtype, Pid *pids) override
Get current pid value for a specific joint.
Definition: RemoteControlBoard.cpp:1197
RemoteControlBoard::getRefVelocities
bool getRefVelocities(double *vels) override
Get the last reference speed set by velocityMove for all joints.
Definition: RemoteControlBoard.cpp:2432
RemoteControlBoard::getPidErrors
bool getPidErrors(const PidControlTypeEnum &pidtype, double *errs) override
Get the error of all joints.
Definition: RemoteControlBoard.cpp:1163
RemoteControlBoard::set1V
bool set1V(int code)
Send a SET command without parameters and wait for a reply.
Definition: RemoteControlBoard.cpp:464
RemoteControlBoard::getEncoderTimed
bool getEncoderTimed(int j, double *v, double *t) override
Read the instantaneous acceleration of all axes.
Definition: RemoteControlBoard.cpp:1359
VOCAB_PARK
constexpr yarp::conf::vocab32_t VOCAB_PARK
Definition: IControlCalibration.h:151
VOCAB_MOTOR_ENCODER_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_ACCELERATION
Definition: IMotorEncoders.h:287
RemoteControlBoard::get2V1I1D
bool get2V1I1D(int v1, int v2, int j, double *val)
Definition: RemoteControlBoard.cpp:754
RemoteControlBoard::setLimits
bool setLimits(int axis, double min, double max) override
Set the software limits for a particular axis, the behavior of the control card when these limits are...
Definition: RemoteControlBoard.cpp:1918
RemoteControlBoard::getPid
bool getPid(const PidControlTypeEnum &pidtype, int j, Pid *pid) override
Get current pid value for a specific joint.
Definition: RemoteControlBoard.cpp:1168
RemoteControlBoard::setControlModes
bool setControlModes(const int n_joint, const int *joints, int *modes) override
Set the current control mode for a subset of axes.
Definition: RemoteControlBoard.cpp:2308
VOCAB_AXES
constexpr yarp::conf::vocab32_t VOCAB_AXES
Definition: GenericVocabs.h:39
RemoteControlBoard::setPidReference
bool setPidReference(const PidControlTypeEnum &pidtype, int j, double ref) override
Set the controller reference for a given axis.
Definition: RemoteControlBoard.cpp:1138
RemoteControlBoard::set1V1I1D
bool set1V1I1D(int code, int j, double val)
Helper method to set a double value to a single axis.
Definition: RemoteControlBoard.cpp:538
RemoteControlBoard::get2V1I2D
bool get2V1I2D(int v1, int v2, int j, double *val1, double *val2)
Definition: RemoteControlBoard.cpp:773
yarp::dev::Pid::offset
double offset
pwm offset added to the pid output
Definition: ControlBoardPid.h:37
RemoteControlBoard::getGearboxRatio
bool getGearboxRatio(int m, double *val) override
Get the gearbox ratio for a specific motor.
Definition: RemoteControlBoard.cpp:1511
RemoteControlBoard::set1VDA
bool set1VDA(int v, const double *val)
Helper method used to set an array of double to all axes.
Definition: RemoteControlBoard.cpp:562
RemoteControlBoard::getMaxCurrent
bool getMaxCurrent(int j, double *v) override
Returns the maximum electric current allowed for a given motor.
Definition: RemoteControlBoard.cpp:1865
VOCAB_CALIBRATE_DONE
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_DONE
Definition: IControlCalibration.h:150
RemoteControlBoard::getNumberOfMotors
bool getNumberOfMotors(int *num) override
Retrieves the number of controlled axes from the current physical interface.
Definition: RemoteControlBoard.cpp:1486
yarp::dev::Pid::max_int
double max_int
saturation threshold for the integrator
Definition: ControlBoardPid.h:34
VOCAB_SET
constexpr yarp::conf::vocab32_t VOCAB_SET
Definition: GenericVocabs.h:15
RemoteControlBoard::setNominalCurrent
bool setNominalCurrent(int m, const double val) override
Definition: RemoteControlBoard.cpp:1875
DiagnosticThread
Definition: RemoteControlBoard.cpp:66
VOCAB_INTERFACE_INTERACTION_MODE
constexpr yarp::conf::vocab32_t VOCAB_INTERFACE_INTERACTION_MODE
Definition: IInteractionMode.h:29
RemoteControlBoard::getValWithPidType
bool getValWithPidType(int voc, PidControlTypeEnum type, int j, double *val)
Definition: RemoteControlBoard.cpp:665
RemoteControlBoard::getPWM
bool getPWM(int m, double *val) override
Definition: RemoteControlBoard.cpp:1890
RemoteControlBoard::setMaxCurrent
bool setMaxCurrent(int j, double v) override
Definition: RemoteControlBoard.cpp:1860
RemoteControlBoard::setPositions
bool setPositions(const int n_joint, const int *joints, const double *refs) override
Set new reference point for all axes.
Definition: RemoteControlBoard.cpp:2362
VOCAB_MOTOR_ENCODER_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_NUMBER
Definition: IMotorEncoders.h:284
VOCAB_REFS
constexpr yarp::conf::vocab32_t VOCAB_REFS
Definition: GenericVocabs.h:28
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
RemoteControlBoard::getRefSpeeds
bool getRefSpeeds(const int n_joint, const int *joints, double *spds) override
Get reference speed of all joints.
Definition: RemoteControlBoard.cpp:1755
VOCAB_MOTOR_ENCODER
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER
Definition: IMotorEncoders.h:279
RemoteControlBoard::getNominalCurrent
bool getNominalCurrent(int m, double *val) override
Definition: RemoteControlBoard.cpp:1870
yarp::os::Bottle::addList
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
Definition: Bottle.cpp:185
RemoteControlBoard::setPWMLimit
bool setPWMLimit(int m, const double val) override
Definition: RemoteControlBoard.cpp:1904
RemoteControlBoard::calibrateSingleJoint
bool calibrateSingleJoint(int j) override
calibrateSingleJoint: call the calibration procedure for the single joint
Definition: RemoteControlBoard.cpp:2556
VOCAB_INTERACTION_MODE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_INTERACTION_MODE_GROUP
Definition: IInteractionMode.h:31
VOCAB_AMP_ENABLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_ENABLE
Definition: IAmplifierControl.h:321
VOCAB_OUTPUT
constexpr yarp::conf::vocab32_t VOCAB_OUTPUT
Definition: GenericVocabs.h:35
RemoteControlBoard::setImpedanceOffset
bool setImpedanceOffset(int j, double offset) override
Set current force Offset for a specific joint.
Definition: RemoteControlBoard.cpp:2217
VOCAB_REF_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEEDS
Definition: ControlBoardVocabs.h:28
yarp::dev::PidControlTypeEnum
PidControlTypeEnum
Definition: PidEnums.h:21
VOCAB_QUIT_CALIBRATE
constexpr yarp::conf::vocab32_t VOCAB_QUIT_CALIBRATE
Definition: CalibratorVocabs.h:23
QosStyle.h
RemoteControlBoard::setEncoder
bool setEncoder(int j, double val) override
Set the value of the encoder for a given joint.
Definition: RemoteControlBoard.cpp:1339
RemoteControlBoard::setRefCurrents
bool setRefCurrents(const double *refs) override
Set the reference value of the currents for all motors.
Definition: RemoteControlBoard.cpp:2636
RemoteControlBoard::get1V1B
bool get1V1B(int v, bool &val)
Definition: RemoteControlBoard.cpp:887
RemoteControlBoard::send1V1I
bool send1V1I(int v, int axis)
Definition: RemoteControlBoard.cpp:438
PolyDriver.h
VOCAB_CURRENT_REFS
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REFS
Definition: ICurrentControl.h:200
RemoteControlBoard::getEncoders
bool getEncoders(double *encs) override
Read the position of all axes.
Definition: RemoteControlBoard.cpp:1370
RemoteControlBoard::get1V1I1B
bool get1V1I1B(int v, int j, bool &val)
Helper method used to get a double value from the remote peer.
Definition: RemoteControlBoard.cpp:809
yarp::dev::Pid::kd
double kd
derivative gain
Definition: ControlBoardPid.h:32
RemoteControlBoard::park
bool park(bool wait=true) override
Definition: RemoteControlBoard.cpp:1970
VOCAB_REMOTE_VARIABILE_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_REMOTE_VARIABILE_INTERFACE
Definition: IRemoteVariables.h:65
VOCAB_GEARBOX_RATIO
constexpr yarp::conf::vocab32_t VOCAB_GEARBOX_RATIO
Definition: IMotor.h:166
Stamp.h
VOCAB_RANGE
constexpr yarp::conf::vocab32_t VOCAB_RANGE
Definition: ITorqueControl.h:241
yarp::os::Value::asBool
virtual bool asBool() const
Get boolean value.
Definition: Value.cpp:189
yarp::os::Value::asString
virtual std::string asString() const
Get string value.
Definition: Value.cpp:237
yarp::os::NetworkBase::connect
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
Definition: Network.cpp:685
VOCAB_POSITION_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVE_GROUP
Definition: IPositionControl.h:477
PROTOCOL_VERSION_MINOR
constexpr int PROTOCOL_VERSION_MINOR
Definition: ControlBoardWrapperCommon.h:15
RemoteControlBoard::getPidOutput
bool getPidOutput(const PidControlTypeEnum &pidtype, int j, double *out) override
Get the output of the controller (e.g.
Definition: RemoteControlBoard.cpp:1310
yarp::dev::Pid::kp
double kp
proportional gain
Definition: ControlBoardPid.h:31
RemoteControlBoard::checkProtocolVersion
bool checkProtocolVersion(bool ignore)
Definition: RemoteControlBoard.cpp:119
yarp::dev::InteractionModeEnum
InteractionModeEnum
Definition: IInteractionMode.h:21
VOCAB_ABORTCALIB
constexpr yarp::conf::vocab32_t VOCAB_ABORTCALIB
Definition: IControlCalibration.h:148
VOCAB_IMP_PARAM
constexpr yarp::conf::vocab32_t VOCAB_IMP_PARAM
Definition: ITorqueControl.h:242
yarp::os::Searchable::check
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
RemoteControlBoard::getControlModes
bool getControlModes(int *modes) override
Get the current control mode (multiple joints).
Definition: RemoteControlBoard.cpp:2267
RemoteControlBoard::getInteractionMode
bool getInteractionMode(int axis, yarp::dev::InteractionModeEnum *mode) override
Get the current interaction mode of the robot, values can be stiff or compliant.
Definition: RemoteControlBoard.cpp:2446
yarp::dev::Pid::kff
double kff
feedforward gain
Definition: ControlBoardPid.h:40
VOCAB_POSITION_DIRECT
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT
Definition: IPositionDirect.h:193
RemoteControlBoard::setRefTorques
bool setRefTorques(const double *t) override
Set the reference value of the torque for all joints.
Definition: RemoteControlBoard.cpp:2033
RemoteControlBoard::set1V2D
bool set1V2D(int code, double v)
Send a SET command and an additional double valued variable and then wait for a reply.
Definition: RemoteControlBoard.cpp:474
RemoteControlBoard::setPeakCurrent
bool setPeakCurrent(int m, const double val) override
Definition: RemoteControlBoard.cpp:1885
RemoteControlBoard::getMotorEncoderSpeeds
bool getMotorEncoderSpeeds(double *spds) override
Read the instantaneous speed of all motor encoders.
Definition: RemoteControlBoard.cpp:1607
RemoteControlBoard::abortPark
bool abortPark() override
Definition: RemoteControlBoard.cpp:1965
RemoteControlBoard::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: RemoteControlBoard.cpp:1975
RemoteControlBoard::getPidReference
bool getPidReference(const PidControlTypeEnum &pidtype, int j, double *ref) override
Get the current reference of the pid controller for a specific joint.
Definition: RemoteControlBoard.cpp:1234
yarp::os::Searchable::find
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
yarp::os::Bottle::addInt32
void addInt32(std::int32_t x)
Places a 32-bit integer in the bottle, at the end of the list.
Definition: Bottle.cpp:143
yarp::os::QosStyle::setThreadPriority
void setThreadPriority(int priority)
sets the communication thread priority level
Definition: QosStyle.h:130
VOCAB_MOTOR_ENCODER_SPEEDS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_ENCODER_SPEEDS
Definition: IMotorEncoders.h:286
RemoteControlBoard::getMotorEncoderAcceleration
bool getMotorEncoderAcceleration(int j, double *acc) override
Read the instantaneous acceleration of a motor encoder.
Definition: RemoteControlBoard.cpp:1616
yarp::dev::CalibrationParameters::type
unsigned int type
Definition: IControlCalibration.h:33
VOCAB_IMPEDANCE
constexpr yarp::conf::vocab32_t VOCAB_IMPEDANCE
Definition: IImpedanceControl.h:117
RemoteControlBoard::open
bool open(Searchable &config) override
Open the DeviceDriver.
Definition: RemoteControlBoard.cpp:177
RemoteControlBoard::setPidErrorLimit
bool setPidErrorLimit(const PidControlTypeEnum &pidtype, int j, double limit) override
Set the error limit for the controller on a specifi joint.
Definition: RemoteControlBoard.cpp:1148
RemoteControlBoard::isCalibratorDevicePresent
bool isCalibratorDevicePresent(bool *isCalib) override
isCalibratorDevicePresent: check if a calibrator device has been set
Definition: RemoteControlBoard.cpp:2541
RemoteControlBoard::setRefDutyCycles
bool setRefDutyCycles(const double *v) override
Sets the reference dutycycle for all the motors.
Definition: RemoteControlBoard.cpp:2729
RemoteControlBoard::stop
bool stop() override
Stop motion, multiple joints.
Definition: RemoteControlBoard.cpp:1801
RemoteControlBoard::setGearboxRatio
bool setGearboxRatio(int m, const double val) override
Set the gearbox ratio for a specific motor.
Definition: RemoteControlBoard.cpp:1516
RemoteControlBoard::get2V2DA
bool get2V2DA(int v1, int v2, double *val1, double *val2)
Definition: RemoteControlBoard.cpp:994
RemoteControlBoard::setRefAccelerations
bool setRefAccelerations(const int n_joint, const int *joints, const double *accs) override
Set reference acceleration on all joints.
Definition: RemoteControlBoard.cpp:1740
RemoteControlBoard::disablePid
bool disablePid(const PidControlTypeEnum &pidtype, int j) override
Disable the pid computation for a joint.
Definition: RemoteControlBoard.cpp:1267
RemoteControlBoard::enablePid
bool enablePid(const PidControlTypeEnum &pidtype, int j) override
Enable the pid computation for a joint.
Definition: RemoteControlBoard.cpp:1280
yarp::os::BufferedPort::getName
std::string getName() const override
Get name of port.
Definition: BufferedPort-inl.h:108
VOCAB_PWMCONTROL_PWM_OUTPUT
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUT
Definition: IPWMControl.h:148
BufferedPort.h
yarp::os::Bottle::addString
void addString(const char *str)
Places a string in the bottle, at the end of the list.
Definition: Bottle.cpp:173
RemoteControlBoard::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: RemoteControlBoard.cpp:2130
yarp::dev::CalibrationParameters::param4
double param4
Definition: IControlCalibration.h:37
RemoteControlBoard::getPWMLimit
bool getPWMLimit(int m, double *val) override
Definition: RemoteControlBoard.cpp:1899
RemoteControlBoard::setControlMode
bool setControlMode(const int j, const int mode) override
Set the current control mode.
Definition: RemoteControlBoard.cpp:2294
RemoteControlBoard::resetEncoders
bool resetEncoders() override
Reset encoders.
Definition: RemoteControlBoard.cpp:1334
VOCAB_MOTOR_PARAMS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_PARAMS
Definition: ITorqueControl.h:239
yarp::dev::Pid::stiction_down_val
double stiction_down_val
down stiction offset added to the pid output
Definition: ControlBoardPid.h:39
yarp::os::PeriodicThread
An abstraction for a periodic thread.
Definition: PeriodicThread.h:25
RemoteControlBoard::send2V1I
bool send2V1I(int v1, int v2, int axis)
Definition: RemoteControlBoard.cpp:425
VOCAB_ENCODER_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_ENCODER_ACCELERATION
Definition: IEncoders.h:217
RemoteControlBoard::getRefAccelerations
bool getRefAccelerations(const int n_joint, const int *joints, double *accs) override
Get reference acceleration for a joint.
Definition: RemoteControlBoard.cpp:1770
yarp::os::Bottle::addVocab
void addVocab(int x)
Places a vocabulary item in the bottle, at the end of the list.
Definition: Bottle.cpp:167
RemoteControlBoard::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: RemoteControlBoard.cpp:2139
RemoteControlBoard::getRefTorque
bool getRefTorque(int j, double *t) override
Get the reference value of the torque for a given joint.
Definition: RemoteControlBoard.cpp:2023
VOCAB_CM_CONTROL_MODES
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODES
Definition: IControlMode.h:122
VOCAB_DISABLE
constexpr yarp::conf::vocab32_t VOCAB_DISABLE
Definition: GenericVocabs.h:33
RemoteControlBoard::getLastInputStamp
Stamp getLastInputStamp() override
Get the time stamp for the last read data.
Definition: RemoteControlBoard.cpp:1647
RemoteControlBoard::getEncodersTimed
bool getEncodersTimed(double *encs, double *ts) override
Read the instantaneous acceleration of all axes.
Definition: RemoteControlBoard.cpp:1381
PROTOCOL_VERSION_TWEAK
constexpr int PROTOCOL_VERSION_TWEAK
Definition: ControlBoardWrapperCommon.h:16
RemoteControlBoard::setRefDutyCycle
bool setRefDutyCycle(int j, double v) override
Sets the reference dutycycle to a single motor.
Definition: RemoteControlBoard.cpp:2711
RemoteControlBoard::get1V1I1IA1DA
bool get1V1I1IA1DA(int v, const int len, const int *val1, double *val2)
Definition: RemoteControlBoard.cpp:1044
yCAssert
#define yCAssert(component, x)
Definition: LogComponent.h:172
RemoteControlBoard::get1V1I1S
bool get1V1I1S(int code, int j, std::string &name)
Definition: RemoteControlBoard.cpp:1028
PeriodicThread.h
VOCAB_ENCODERS
constexpr yarp::conf::vocab32_t VOCAB_ENCODERS
Definition: IEncoders.h:212
VOCAB_VEL_LIMITS
constexpr yarp::conf::vocab32_t VOCAB_VEL_LIMITS
Definition: IControlLimits.h:131
RemoteControlBoard::getEncoderAccelerations
bool getEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all axes.
Definition: RemoteControlBoard.cpp:1421
VOCAB_ERR
constexpr yarp::conf::vocab32_t VOCAB_ERR
Definition: GenericVocabs.h:20
RemoteControlBoard::getEncoder
bool getEncoder(int j, double *v) override
Read the value of an encoder.
Definition: RemoteControlBoard.cpp:1349
RemoteControlBoard::getRefPosition
bool getRefPosition(const int joint, double *ref) override
Get the last position reference for the specified axis.
Definition: RemoteControlBoard.cpp:2390
VOCAB_PIDS
constexpr yarp::conf::vocab32_t VOCAB_PIDS
Definition: IPidControl.h:385
VOCAB_HOMING_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_HOMING_SINGLE_JOINT
Definition: CalibratorVocabs.h:19
RemoteControlBoard::getMotorEncoderSpeed
bool getMotorEncoderSpeed(int j, double *sp) override
Read the istantaneous speed of a motor encoder.
Definition: RemoteControlBoard.cpp:1598
PROTOCOL_VERSION_MAJOR
constexpr int PROTOCOL_VERSION_MAJOR
Definition: ControlBoardWrapperCommon.h:14
yarp::os::QosStyle::setThreadPolicy
void setThreadPolicy(int policy)
sets the communication thread scheduling policy
Definition: QosStyle.h:140
RemoteControlBoard::get1V1I1I
bool get1V1I1I(int v, int j, int *val)
Helper method used to get an integer value from the remote peer.
Definition: RemoteControlBoard.cpp:737
RemoteControlBoard::checkMotionDone
bool checkMotionDone(int j, bool *flag) override
Check if the current trajectory is terminated.
Definition: RemoteControlBoard.cpp:1705
RemoteControlBoard::positionMove
bool positionMove(int j, double ref) override
Set new reference point for a single axis.
Definition: RemoteControlBoard.cpp:1660
RemoteControlBoard::getMotorEncoderAccelerations
bool getMotorEncoderAccelerations(double *accs) override
Read the instantaneous acceleration of all motor encoders.
Definition: RemoteControlBoard.cpp:1625
RemoteControlBoard::set1V1I
bool set1V1I(int code, int v)
Send a SET command with an additional integer valued variable and then wait for a reply.
Definition: RemoteControlBoard.cpp:486
yarp::dev::MotorTorqueParameters::bemf_scale
double bemf_scale
Definition: ITorqueControl.h:27
yarp::os::Stamp
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:25
RemoteControlBoard::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: RemoteControlBoard.cpp:2455
yCError
#define yCError(component,...)
Definition: LogComponent.h:157
RemoteControlBoard::get1V1I
bool get1V1I(int code, int &v) const
Send a GET command expecting an integer value in return.
Definition: RemoteControlBoard.cpp:518
VOCAB_CURRENTCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_CURRENTCONTROL_INTERFACE
Definition: ICurrentControl.h:196
VOCAB_INFO_NAME
constexpr yarp::conf::vocab32_t VOCAB_INFO_NAME
Definition: IAxisInfo.h:92
VOCAB_RELATIVE_MOVE
constexpr yarp::conf::vocab32_t VOCAB_RELATIVE_MOVE
Definition: ControlBoardVocabs.h:24
yarp::os::Value::asInt32
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:207
yarp::dev::CalibrationParameters::param2
double param2
Definition: IControlCalibration.h:35
VOCAB_TORQUE
constexpr yarp::conf::vocab32_t VOCAB_TORQUE
Definition: ITorqueControl.h:234
VOCAB_QUIT_PARK
constexpr yarp::conf::vocab32_t VOCAB_QUIT_PARK
Definition: CalibratorVocabs.h:24
VOCAB_AMP_STATUS_SINGLE
constexpr yarp::conf::vocab32_t VOCAB_AMP_STATUS_SINGLE
Definition: IAmplifierControl.h:324
VOCAB_MOTOR_CPR
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_CPR
Definition: IMotorEncoders.h:281
yarp::os::PortablePair::head
HEAD head
An object of the first type (HEAD).
Definition: PortablePair.h:56
VOCAB_ERRS
constexpr yarp::conf::vocab32_t VOCAB_ERRS
Definition: GenericVocabs.h:21
VOCAB_MOTION_DONES
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONES
Definition: ControlBoardVocabs.h:17
VOCAB_LIMS
constexpr yarp::conf::vocab32_t VOCAB_LIMS
Definition: GenericVocabs.h:31
RemoteControlBoard::getEncoderSpeeds
bool getEncoderSpeeds(double *spds) override
Read the instantaneous speed of all axes.
Definition: RemoteControlBoard.cpp:1402
yCInfo
#define yCInfo(component,...)
Definition: LogComponent.h:135
RemoteControlBoard::calibrateWholePart
bool calibrateWholePart() override
calibrateWholePart: call the procedure for calibrating the whole device
Definition: RemoteControlBoard.cpp:2561
VOCAB_IMP_OFFSET
constexpr yarp::conf::vocab32_t VOCAB_IMP_OFFSET
Definition: ITorqueControl.h:243
yarp::os
An interface to the operating system, including Port based communication.
Definition: AbstractCarrier.h:17
yCDebug
#define yCDebug(component,...)
Definition: LogComponent.h:112
RemoteControlBoard::setMotorEncoderCountsPerRevolution
bool setMotorEncoderCountsPerRevolution(int m, const double cpr) override
Sets number of counts per revolution for motor encoder m.
Definition: RemoteControlBoard.cpp:1540
RemoteControlBoard::getTorqueRange
bool getTorqueRange(int j, double *min, double *max) override
Get the full scale of the torque sensor of a given joint.
Definition: RemoteControlBoard.cpp:2148
VOCAB_CALIBRATE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE_JOINT
Definition: IControlCalibration.h:144
VOCAB_E_RESETS
constexpr yarp::conf::vocab32_t VOCAB_E_RESETS
Definition: IEncoders.h:210
VOCAB_OUTPUTS
constexpr yarp::conf::vocab32_t VOCAB_OUTPUTS
Definition: GenericVocabs.h:36
RemoteControlBoard::setRefAcceleration
bool setRefAcceleration(int j, double acc) override
Set reference acceleration for a joint.
Definition: RemoteControlBoard.cpp:1735
RemoteControlBoard::set2V1I1D
bool set2V1I1D(int v1, int v2, int axis, double val)
Definition: RemoteControlBoard.cpp:624
RemoteControlBoard::getMotorEncoders
bool getMotorEncoders(double *encs) override
Read the position of all motor encoders.
Definition: RemoteControlBoard.cpp:1576
VOCAB_PROTOCOL_VERSION
constexpr yarp::conf::vocab32_t VOCAB_PROTOCOL_VERSION
Definition: ControlBoardVocabs.h:40
Vocab.h
RemoteControlBoard::setPidErrorLimits
bool setPidErrorLimits(const PidControlTypeEnum &pidtype, const double *limits) override
Get the error limit for the controller on all joints.
Definition: RemoteControlBoard.cpp:1153
VOCAB_INFO_TYPE
constexpr yarp::conf::vocab32_t VOCAB_INFO_TYPE
Definition: IAxisInfo.h:93
VOCAB_PID
constexpr yarp::conf::vocab32_t VOCAB_PID
Definition: IPidControl.h:384
ControlBoardInterfacesImpl.h
VOCAB_MOTOR_E_RESETS
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESETS
Definition: IMotorEncoders.h:278
VOCAB_MOTOR_E_RESET
constexpr yarp::conf::vocab32_t VOCAB_MOTOR_E_RESET
Definition: IMotorEncoders.h:277
VOCAB_LIST_VARIABLES
constexpr yarp::conf::vocab32_t VOCAB_LIST_VARIABLES
Definition: IRemoteVariables.h:67
VOCAB_CM_CONTROL_MODE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_CM_CONTROL_MODE_GROUP
Definition: IControlMode.h:121
RemoteControlBoard::getRefDutyCycle
bool getRefDutyCycle(int j, double *ref) override
Gets the last reference sent using the setRefDutyCycle function.
Definition: RemoteControlBoard.cpp:2747
RemoteControlBoard::getPowerSupplyVoltage
bool getPowerSupplyVoltage(int m, double *val) override
Definition: RemoteControlBoard.cpp:1909
yarp::os::Value::asList
virtual Bottle * asList() const
Get list value.
Definition: Value.cpp:243
RemoteControlBoard::getAxisName
bool getAxisName(int j, std::string &name) override
Definition: RemoteControlBoard.cpp:1942
yarp::dev::Pid
Contains the parameters for a PID.
Definition: ControlBoardPid.h:29
VOCAB_PARK_WHOLE_PART
constexpr yarp::conf::vocab32_t VOCAB_PARK_WHOLE_PART
Definition: CalibratorVocabs.h:22
Time.h
RemoteControlBoard::getAmpStatus
bool getAmpStatus(int *st) override
Definition: RemoteControlBoard.cpp:1850
yarp::dev::CalibrationParameters
Definition: IControlCalibration.h:32
VOCAB_PARK_SINGLE_JOINT
constexpr yarp::conf::vocab32_t VOCAB_PARK_SINGLE_JOINT
Definition: CalibratorVocabs.h:21
VOCAB_CURRENT_RANGES
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_RANGES
Definition: ICurrentControl.h:203
RemoteControlBoard::set2V2DA
bool set2V2DA(int v1, int v2, const double *val1, const double *val2)
Definition: RemoteControlBoard.cpp:589
VOCAB_REF_ACCELERATION_GROUP
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATION_GROUP
Definition: IPositionControl.h:481
RemoteControlBoard::setImpedance
bool setImpedance(int j, double stiffness, double damping) override
Set current impedance gains (stiffness,damping) for a specific joint.
Definition: RemoteControlBoard.cpp:2201
RemoteControlBoard::getEncoderSpeed
bool getEncoderSpeed(int j, double *sp) override
Read the istantaneous speed of an axis.
Definition: RemoteControlBoard.cpp:1392
RemoteControlBoard::getRemoteVariablesList
bool getRemoteVariablesList(yarp::os::Bottle *listOfKeys) override
Definition: RemoteControlBoard.cpp:1465
RemoteControlBoard::close
bool close() override
Close the device driver and stop the port connections.
Definition: RemoteControlBoard.cpp:382
VOCAB_LIMITS
constexpr yarp::conf::vocab32_t VOCAB_LIMITS
Definition: IControlLimits.h:130
VOCAB_ICONTROLMODE
constexpr yarp::conf::vocab32_t VOCAB_ICONTROLMODE
Definition: IControlMode.h:118
RemoteControlBoard::getNumberOfMotorEncoders
bool getNumberOfMotorEncoders(int *num) override
Get the number of available motor encoders.
Definition: RemoteControlBoard.cpp:1634
yarp::os::Value
A single value (typically within a Bottle).
Definition: Value.h:47
RemoteControlBoard::setInteractionMode
bool setInteractionMode(int axis, yarp::dev::InteractionModeEnum mode) override
Set the interaction mode of the robot, values can be stiff or compliant.
Definition: RemoteControlBoard.cpp:2482
RemoteControlBoard::parkWholePart
bool parkWholePart() override
parkWholePart: start the parking procedure for the whole part
Definition: RemoteControlBoard.cpp:2592
RemoteControlBoard::getTorqueRanges
bool getTorqueRanges(double *min, double *max) override
Get the full scale of the torque sensors of all joints.
Definition: RemoteControlBoard.cpp:2153
VOCAB_VELOCITY_MOVE
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE
Definition: ControlBoardVocabs.h:36
RemoteControlBoard::setVelLimits
bool setVelLimits(int axis, double min, double max) override
Set the software speed limits for a particular axis, the behavior of the control card when these limi...
Definition: RemoteControlBoard.cpp:1928
VOCAB_MOTORS_NUMBER
constexpr yarp::conf::vocab32_t VOCAB_MOTORS_NUMBER
Definition: IMotor.h:164
VOCAB_STOP_GROUP
constexpr yarp::conf::vocab32_t VOCAB_STOP_GROUP
Definition: IPositionControl.h:482
RemoteControlBoard::set2V1DA
bool set2V1DA(int v1, int v2, const double *val)
Definition: RemoteControlBoard.cpp:575
RemoteControlBoard::set2V1I
bool set2V1I(int v1, int v2, int axis)
Definition: RemoteControlBoard.cpp:708
RemoteControlBoard::get1V1D
bool get1V1D(int code, double &v) const
Send a GET command expecting a double value in return.
Definition: RemoteControlBoard.cpp:498
VOCAB_PWMCONTROL_REF_PWM
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_REF_PWM
Definition: IPWMControl.h:146
VOCAB_PWMCONTROL_PWM_OUTPUTS
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_PWM_OUTPUTS
Definition: IPWMControl.h:149
RemoteControlBoard::getImpedanceOffset
bool getImpedanceOffset(int j, double *offset) override
Get current force Offset for a specific joint.
Definition: RemoteControlBoard.cpp:2182
VOCAB_REF_ACCELERATIONS
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATIONS
Definition: ControlBoardVocabs.h:30
yarp::os::Value::asFloat64
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:225
VOCAB_TIMESTAMP
constexpr yarp::conf::vocab32_t VOCAB_TIMESTAMP
Definition: ControlBoardVocabs.h:18
yarp::dev::JointTypeEnum
JointTypeEnum
Definition: IAxisInfo.h:29
RemoteControlBoard::homingWholePart
bool homingWholePart() override
homingWholePart: call the homing procedure for a the whole part/device
Definition: RemoteControlBoard.cpp:2576
RemoteControlBoard::set1V1I2D
bool set1V1I2D(int code, int j, double val1, double val2)
Definition: RemoteControlBoard.cpp:549
VOCAB_CURRENT_REF
constexpr yarp::conf::vocab32_t VOCAB_CURRENT_REF
Definition: ICurrentControl.h:199
VOCAB_MOTION_DONE
constexpr yarp::conf::vocab32_t VOCAB_MOTION_DONE
Definition: ControlBoardVocabs.h:16
VOCAB_REF_SPEED
constexpr yarp::conf::vocab32_t VOCAB_REF_SPEED
Definition: ControlBoardVocabs.h:27
RemoteControlBoard::get1V1I2D
bool get1V1I2D(int code, int axis, double *v1, double *v2)
Definition: RemoteControlBoard.cpp:792
RemoteControlBoard::getMotorTorqueParams
bool getMotorTorqueParams(int j, MotorTorqueParameters *params) override
Get a subset of motor parameters (bemf, ktau etc) useful for torque control.
Definition: RemoteControlBoard.cpp:2103
VOCAB_PWMCONTROL_INTERFACE
constexpr yarp::conf::vocab32_t VOCAB_PWMCONTROL_INTERFACE
Definition: IPWMControl.h:144
RemoteControlBoard::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: RemoteControlBoard.cpp:2497
RemoteControlBoard::setRefCurrent
bool setRefCurrent(int j, double ref) override
Set the reference value of the current for a single motor.
Definition: RemoteControlBoard.cpp:2649
RemoteControlBoard::homingSingleJoint
bool homingSingleJoint(int j) override
homingSingleJoint: call the homing procedure for a single joint
Definition: RemoteControlBoard.cpp:2571
RemoteControlBoard::get1V1I1D
bool get1V1I1D(int v, int j, double *val)
Helper method used to get a double value from the remote peer.
Definition: RemoteControlBoard.cpp:719
VOCAB_STOPS
constexpr yarp::conf::vocab32_t VOCAB_STOPS
Definition: ControlBoardVocabs.h:32
RemoteControlBoard::send1V
bool send1V(int v)
Definition: RemoteControlBoard.cpp:402
RemoteControlBoard::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: RemoteControlBoard.cpp:1720
RemoteControlBoard::get1VDA
bool get1VDA(int v, double *val)
Helper method to get an array of double from the remote peer.
Definition: RemoteControlBoard.cpp:924
VOCAB_IS_CALIBRATOR_PRESENT
constexpr yarp::conf::vocab32_t VOCAB_IS_CALIBRATOR_PRESENT
Definition: CalibratorVocabs.h:16
RemoteControlBoard::getControlMode
bool getControlMode(int j, int *mode) override
Get the current control mode.
Definition: RemoteControlBoard.cpp:2258
RemoteControlBoard::resetMotorEncoder
bool resetMotorEncoder(int j) override
Reset motor encoder, single motor.
Definition: RemoteControlBoard.cpp:1525
RemoteControlBoard::setPosition
bool setPosition(int j, double ref) override
Set new position for a single axis.
Definition: RemoteControlBoard.cpp:2349
VOCAB_CALIBRATE
constexpr yarp::conf::vocab32_t VOCAB_CALIBRATE
Definition: IControlCalibration.h:146
VOCAB_VELOCITY_MOVE_GROUP
constexpr yarp::conf::vocab32_t VOCAB_VELOCITY_MOVE_GROUP
Definition: IVelocityControl.h:302
VOCAB_ABORTPARK
constexpr yarp::conf::vocab32_t VOCAB_ABORTPARK
Definition: IControlCalibration.h:149
yarp::os::Bottle::append
void append(const Bottle &alt)
Append the content of the given bottle to the current list.
Definition: Bottle.cpp:383
RemoteControlBoard::get1V1I1IA1B
bool get1V1I1IA1B(int v, const int len, const int *val1, bool &retVal)
Definition: RemoteControlBoard.cpp:824
RemoteControlBoard::setCalibrationParameters
bool setCalibrationParameters(int j, const CalibrationParameters &params) override
Start calibration, this method is very often platform specific.
Definition: RemoteControlBoard.cpp:1994
VOCAB_POSITION_MOVE
constexpr yarp::conf::vocab32_t VOCAB_POSITION_MOVE
Definition: ControlBoardVocabs.h:22
VOCAB_POSITION_DIRECT_GROUP
constexpr yarp::conf::vocab32_t VOCAB_POSITION_DIRECT_GROUP
Definition: IPositionDirect.h:195
RemoteControlBoard::getCurrentRanges
bool getCurrentRanges(double *min, double *max) override
Get the full scale of the current measurements for all motors motor (e.g.
Definition: RemoteControlBoard.cpp:2703
RemoteControlBoard::getEncoderAcceleration
bool getEncoderAcceleration(int j, double *acc) override
Read the instantaneous acceleration of an axis.
Definition: RemoteControlBoard.cpp:1412
VOCAB_REF_ACCELERATION
constexpr yarp::conf::vocab32_t VOCAB_REF_ACCELERATION
Definition: ControlBoardVocabs.h:29