YARP
Yet Another Robot Platform
ControlBoard_nws_yarp.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
8 
10 #include "RPCMessagesParser.h"
12 
13 #include <yarp/os/LogStream.h>
15 
16 #include <numeric>
17 
18 
19 using namespace yarp::os;
20 using namespace yarp::dev;
21 using namespace yarp::sig;
23 
25  yarp::os::PeriodicThread(default_period)
26 {
27 }
28 
29 void ControlBoard_nws_yarp::closePorts()
30 {
31  inputRPCPort.interrupt();
32  inputRPCPort.removeCallbackLock();
33  inputRPCPort.close();
34 
35  inputStreamingPort.interrupt();
36  inputStreamingPort.close();
37 
38  outputPositionStatePort.interrupt();
39  outputPositionStatePort.close();
40 
41  extendedOutputStatePort.interrupt();
42  extendedOutputStatePort.close();
43 }
44 
46 {
47  // Ensure that the device is not running
48  if (isRunning()) {
49  stop();
50  }
51 
52  closeDevice();
53  closePorts();
54 
55  return true;
56 }
57 
58 bool ControlBoard_nws_yarp::checkPortName(Searchable& params)
59 {
60  // find name as port name (similar both in new and old policy)
61  if (!params.check("name")) {
63  "*************************************************************************************\n"
64  "* controlBoard_nws_yarp missing mandatory parameter 'name' for port name, usage is: *\n"
65  "* name: full port prefix name with leading '/', e.g. /robotName/part/ *\n"
66  "*************************************************************************************";
67  return false;
68  }
69 
70  partName = params.find("name").asString();
71  if (partName[0] != '/') {
73  "*************************************************************************************\n"
74  "* controlBoard_nws_yarp 'name' parameter for port name does not follow convention, *\n"
75  "* it MUST start with a leading '/' since it is used as the full prefix port name *\n"
76  "* name: full port prefix name with leading '/', e.g. /robotName/part/ *\n"
77  "* A temporary automatic fix will be done for you, but please fix your config file *\n"
78  "*************************************************************************************";
79  rootName = "/" + partName;
80  } else {
81  rootName = partName;
82  }
83 
84  return true;
85 }
86 
87 
89 {
90  Property prop;
91  prop.fromString(config.toString());
92 
93  if (!checkPortName(config)) {
94  yCError(CONTROLBOARD) << "'portName' was not correctly set, check you r configuration file";
95  return false;
96  }
97 
98  // Check parameter, so if both are present we use the correct one
99  if (prop.check("period")) {
100  if (!prop.find("period").isFloat64()) {
101  yCError(CONTROLBOARD) << "'period' parameter is not a double value";
102  return false;
103  }
104  period = prop.find("period").asFloat64();
105  if (period <= 0) {
106  yCError(CONTROLBOARD) << "'period' parameter is not valid, read value is" << period;
107  return false;
108  }
109  } else {
110  yCDebug(CONTROLBOARD) << "'period' parameter missing, using default thread period = 0.02s";
111  period = default_period;
112  }
113 
114  // Check if we need to create subdevice or if they are
115  // passed later on thorugh attachAll()
116  if (prop.check("subdevice")) {
117  prop.setMonitor(config.getMonitor());
118  if (!openAndAttachSubDevice(prop)) {
119  yCError(CONTROLBOARD, "Error while opening subdevice");
120  return false;
121  }
122  subdevice_ready = true;
123  }
124 
125  rootName = prop.check("rootName", Value("/"), "starting '/' if needed.").asString();
126  partName = prop.check("name", Value("controlboard"), "prefix for port names").asString();
127  rootName += (partName);
128  if (rootName.find("//") != std::string::npos) {
129  rootName.replace(rootName.find("//"), 2, "/");
130  }
131 
132  // Open ports, then attach the readers or callbacks
133  if (!inputRPCPort.open((rootName + "/rpc:i"))) {
134  yCError(CONTROLBOARD) << "Error opening port " << rootName + "/rpc:i";
135  closePorts();
136  return false;
137  }
138  inputRPCPort.setReader(RPC_parser);
139  inputRPC_buffer.attach(inputRPCPort);
140  RPC_parser.attach(inputRPC_buffer);
141 
142  if (!inputStreamingPort.open(rootName + "/command:i")) {
143  yCError(CONTROLBOARD) << "Error opening port " << rootName + "/rpc:i";
144  closePorts();
145  return false;
146  }
147  inputStreamingPort.setStrict();
148  inputStreamingPort.useCallback(streaming_parser);
149 
150  if (!outputPositionStatePort.open(rootName + "/state:o")) {
151  yCError(CONTROLBOARD) << "Error opening port " << rootName + "/state:o";
152  closePorts();
153  return false;
154  }
155 
156  // Extended output state port
157  if (!extendedOutputStatePort.open(rootName + "/stateExt:o")) {
158  yCError(CONTROLBOARD) << "Error opening port " << rootName + "/state:o";
159  closePorts();
160  return false;
161  }
162  extendedOutputState_buffer.attach(extendedOutputStatePort);
163 
164  // In case attach is not deferred and the controlboard already owns a valid device
165  // we can start the thread. Otherwise this will happen when attachAll is called
166  if (subdevice_ready) {
167  setPeriod(period);
168  if (!start()) {
169  yCError(CONTROLBOARD) << "Error starting thread";
170  return false;
171  }
172  }
173 
174  return true;
175 }
176 
177 
178 // For the simulator, if a subdevice parameter is given to the wrapper, it will
179 // open it and attach to immediately.
180 bool ControlBoard_nws_yarp::openAndAttachSubDevice(Property& prop)
181 {
182  Property p;
183  auto* subDeviceOwned = new PolyDriver;
184  p.fromString(prop.toString());
185 
186  std::string subdevice = prop.find("subdevice").asString();
187  p.setMonitor(prop.getMonitor(), subdevice.c_str()); // pass on any monitoring
188  p.unput("device");
189  p.put("device", subdevice); // subdevice was already checked before
190 
191  // if errors occurred during open, quit here.
192  yCDebug(CONTROLBOARD, "opening subdevice");
193  subDeviceOwned->open(p);
194 
195  if (!subDeviceOwned->isValid()) {
196  yCError(CONTROLBOARD, "opening subdevice... FAILED");
197  return false;
198  }
199 
200  return setDevice(subDeviceOwned, true);
201 }
202 
203 
204 bool ControlBoard_nws_yarp::setDevice(yarp::dev::DeviceDriver* driver, bool owned)
205 {
206  // Save the pointer and subDeviceOwned
207  subdevice_ptr = driver;
208  subdevice_owned = owned;
209 
210  // yarp::dev::IPidControl* iPidControl{nullptr};
211  subdevice_ptr->view(iPidControl);
212  if (!iPidControl) {
213  yCWarning(CONTROLBOARD, "Part <%s>: IPidControl interface was not found in subdevice.", partName.c_str());
214  }
215 
216  // yarp::dev::IPositionControl* iPositionControl{nullptr};
217  subdevice_ptr->view(iPositionControl);
218  if (!iPositionControl) {
219  yCError(CONTROLBOARD, "Part <%s>: IPositionControl interface was not found in subdevice. Quitting", partName.c_str());
220  return false;
221  }
222 
223  // yarp::dev::IPositionDirect* iPositionDirect{nullptr};
224  subdevice_ptr->view(iPositionDirect);
225  if (!iPositionDirect) {
226  yCWarning(CONTROLBOARD, "Part <%s>: IPositionDirect interface was not found in subdevice.", partName.c_str());
227  }
228 
229  // yarp::dev::IVelocityControl* iVelocityControl{nullptr};
230  subdevice_ptr->view(iVelocityControl);
231  if (!iVelocityControl) {
232  yCError(CONTROLBOARD, "Part <%s>: IVelocityControl interface was not found in subdevice. Quitting", partName.c_str());
233  return false;
234  }
235 
236  // yarp::dev::IEncodersTimed* iEncodersTimed{nullptr};
237  subdevice_ptr->view(iEncodersTimed);
238  if (!iEncodersTimed) {
239  yCError(CONTROLBOARD, "Part <%s>: IEncodersTimed interface was not found in subdevice. Quitting", partName.c_str());
240  return false;
241  }
242 
243  // yarp::dev::IMotor* iMotor{nullptr};
244  subdevice_ptr->view(iMotor);
245  if (!iMotor) {
246  yCWarning(CONTROLBOARD, "Part <%s>: IMotor interface was not found in subdevice.", partName.c_str());
247  }
248 
249  // yarp::dev::IMotorEncoders* iMotorEncoders{nullptr};
250  subdevice_ptr->view(iMotorEncoders);
251  if (!iMotorEncoders) {
252  yCWarning(CONTROLBOARD, "Part <%s>: IMotorEncoders interface was not found in subdevice.", partName.c_str());
253  }
254 
255  // yarp::dev::IAmplifierControl* iAmplifierControl{nullptr};
256  subdevice_ptr->view(iAmplifierControl);
257  if (!iAmplifierControl) {
258  yCWarning(CONTROLBOARD, "Part <%s>: IAmplifierControl interface was not found in subdevice.", partName.c_str());
259  }
260 
261  // yarp::dev::IControlLimits* iControlLimits{nullptr};
262  subdevice_ptr->view(iControlLimits);
263  if (!iControlLimits) {
264  yCWarning(CONTROLBOARD, "Part <%s>: IControlLimits interface was not found in subdevice.", partName.c_str());
265  }
266 
267  // yarp::dev::IControlCalibration* iControlCalibration{nullptr};
268  subdevice_ptr->view(iControlCalibration);
269  if (!iControlCalibration) {
270  yCWarning(CONTROLBOARD, "Part <%s>: IControlCalibration interface was not found in subdevice.", partName.c_str());
271  }
272 
273  // yarp::dev::ITorqueControl* iTorqueControl{nullptr};
274  subdevice_ptr->view(iTorqueControl);
275  if (!iTorqueControl) {
276  yCWarning(CONTROLBOARD, "Part <%s>: ITorqueControl interface was not found in subdevice.", partName.c_str());
277  }
278 
279  // yarp::dev::IImpedanceControl* iImpedanceControl{nullptr};
280  subdevice_ptr->view(iImpedanceControl);
281  if (!iImpedanceControl) {
282  yCWarning(CONTROLBOARD, "Part <%s>: IImpedanceControl interface was not found in subdevice.", partName.c_str());
283  }
284 
285  // yarp::dev::IControlMode* iControlMode{nullptr};
286  subdevice_ptr->view(iControlMode);
287  if (!iControlMode) {
288  yCWarning(CONTROLBOARD, "Part <%s>: IControlMode interface was not found in subdevice.", partName.c_str());
289  }
290 
291  // yarp::dev::IAxisInfo* iAxisInfo{nullptr};
292  subdevice_ptr->view(iAxisInfo);
293  if (!iAxisInfo) {
294  yCWarning(CONTROLBOARD, "Part <%s>: IAxisInfo interface was not found in subdevice.", partName.c_str());
295  }
296 
297  // yarp::dev::IPreciselyTimed* iPreciselyTimed{nullptr};
298  subdevice_ptr->view(iPreciselyTimed);
299  if (!iPreciselyTimed) {
300  yCWarning(CONTROLBOARD, "Part <%s>: IPreciselyTimed interface was not found in subdevice.", partName.c_str());
301  }
302 
303  // yarp::dev::IInteractionMode* iInteractionMode{nullptr};
304  subdevice_ptr->view(iInteractionMode);
305  if (!iInteractionMode) {
306  yCWarning(CONTROLBOARD, "Part <%s>: IInteractionMode interface was not found in subdevice.", partName.c_str());
307  }
308 
309  // yarp::dev::IRemoteVariables* iRemoteVariables{nullptr};
310  subdevice_ptr->view(iRemoteVariables);
311  if (!iRemoteVariables) {
312  yCWarning(CONTROLBOARD, "Part <%s>: IRemoteVariables interface was not found in subdevice.", partName.c_str());
313  }
314 
315  // yarp::dev::IPWMControl* iPWMControl{nullptr};
316  subdevice_ptr->view(iPWMControl);
317  if (!iPWMControl) {
318  yCWarning(CONTROLBOARD, "Part <%s>: IPWMControl interface was not found in subdevice.", partName.c_str());
319  }
320 
321  // yarp::dev::ICurrentControl* iCurrentControl{nullptr};
322  subdevice_ptr->view(iCurrentControl);
323  if (!iCurrentControl) {
324  yCWarning(CONTROLBOARD, "Part <%s>: ICurrentControl interface was not found in subdevice.", partName.c_str());
325  }
326 
327 
328  // Get the number of controlled joints
329  int tmp_axes;
330  if (!iPositionControl->getAxes(&tmp_axes)) {
331  yCError(CONTROLBOARD) << "Part <%s>: Failed to get axes number for subdevice " << partName.c_str();
332  return false;
333  }
334  if (tmp_axes <= 0) {
335  yCError(CONTROLBOARD, "Part <%s>: attached device has an invalid number of joints (%d)", partName.c_str(), tmp_axes);
336  return false;
337  }
338  subdevice_joints = static_cast<size_t>(tmp_axes);
339  times.resize(subdevice_joints);
340 
341  // Initialization
342  streaming_parser.init(subdevice_ptr);
343  streaming_parser.initialize();
344 
345  RPC_parser.init(subdevice_ptr);
346  RPC_parser.initialize();
347 
348  return true;
349 }
350 
351 void ControlBoard_nws_yarp::closeDevice()
352 {
353  // Reset callbacks
354  streaming_parser.reset();
355  RPC_parser.reset();
356 
357  // If the subdevice is owned, close and delete the device
358  if (subdevice_owned) {
359  subdevice_ptr->close();
360  delete subdevice_ptr;
361  }
362  subdevice_ptr = nullptr;
363  subdevice_owned = false;
364  subdevice_joints = 0;
365  subdevice_ready = false;
366 
367  times.clear();
368 
369  // Clear all interfaces
370  iPidControl = nullptr;
371  iPositionControl = nullptr;
372  iPositionDirect = nullptr;
373  iVelocityControl = nullptr;
374  iEncodersTimed = nullptr;
375  iMotor = nullptr;
376  iMotorEncoders = nullptr;
377  iAmplifierControl = nullptr;
378  iControlLimits = nullptr;
379  iControlCalibration = nullptr;
380  iTorqueControl = nullptr;
381  iImpedanceControl = nullptr;
382  iControlMode = nullptr;
383  iAxisInfo = nullptr;
384  iPreciselyTimed = nullptr;
385  iInteractionMode = nullptr;
386  iRemoteVariables = nullptr;
387  iPWMControl = nullptr;
388  iCurrentControl = nullptr;
389 }
390 
392 {
393  // Check if we already instantiated a subdevice previously
394  if (subdevice_ready) {
395  return false;
396  }
397 
398  if (!setDevice(poly, false)) {
399  return false;
400  }
401 
402  setPeriod(period);
403  if (!start()) {
404  yCError(CONTROLBOARD) << "Error starting thread";
405  return false;
406  }
407 
408  return true;
409 }
410 
412 {
413  //check if we already instantiated a subdevice previously
414  if (subdevice_owned) {
415  return false;
416  }
417 
418  // Ensure that the device is not running
419  if (isRunning()) {
420  stop();
421  }
422 
423  closeDevice();
424 
425  return true;
426 }
427 
429 {
430  // check we are not overflowing with input messages
431  constexpr int reads_for_warning = 20;
432  if (inputStreamingPort.getPendingReads() >= reads_for_warning) {
433  yCWarning(CONTROLBOARD) << "Number of streaming input messages to be read is " << inputStreamingPort.getPendingReads() << " and can overflow";
434  }
435 
436  // Update the port envelope time by averaging all timestamps
437  time.update(std::accumulate(times.begin(), times.end(), 0.0) / subdevice_joints);
438  yarp::os::Stamp averageTime = time;
439 
440  // handle stateExt first
441  jointData& data = extendedOutputState_buffer.get();
442 
443  data.jointPosition.resize(subdevice_joints);
444  data.jointVelocity.resize(subdevice_joints);
445  data.jointAcceleration.resize(subdevice_joints);
446  data.motorPosition.resize(subdevice_joints);
447  data.motorVelocity.resize(subdevice_joints);
448  data.motorAcceleration.resize(subdevice_joints);
449  data.torque.resize(subdevice_joints);
450  data.pwmDutycycle.resize(subdevice_joints);
451  data.current.resize(subdevice_joints);
452  data.controlMode.resize(subdevice_joints);
453  data.interactionMode.resize(subdevice_joints);
454 
455  // Get data from HW
456  if (iEncodersTimed) {
457  data.jointPosition_isValid = iEncodersTimed->getEncodersTimed(data.jointPosition.data(), times.data());
458  data.jointVelocity_isValid = iEncodersTimed->getEncoderSpeeds(data.jointVelocity.data());
460  } else {
461  data.jointPosition_isValid = false;
462  data.jointVelocity_isValid = false;
463  data.jointAcceleration_isValid = false;
464  }
465 
466  if (iMotorEncoders) {
467  data.motorPosition_isValid = iMotorEncoders->getMotorEncoders(data.motorPosition.data());
468  data.motorVelocity_isValid = iMotorEncoders->getMotorEncoderSpeeds(data.motorVelocity.data());
470  } else {
471  data.motorPosition_isValid = false;
472  data.motorVelocity_isValid = false;
473  data.motorAcceleration_isValid = false;
474  }
475 
476  if (iTorqueControl) {
477  data.torque_isValid = iTorqueControl->getTorques(data.torque.data());
478  } else {
479  data.torque_isValid = false;
480  }
481 
482  if (iPWMControl) {
483  data.pwmDutycycle_isValid = iPWMControl->getDutyCycles(data.pwmDutycycle.data());
484  } else {
485  data.pwmDutycycle_isValid = false;
486  }
487 
488  if (iCurrentControl) {
489  data.current_isValid = iCurrentControl->getCurrents(data.current.data());
490  } else if (iAmplifierControl) {
491  data.current_isValid = iAmplifierControl->getCurrents(data.current.data());
492  } else {
493  data.current_isValid = false;
494  }
495 
496  if (iControlMode) {
497  data.controlMode_isValid = iControlMode->getControlModes(data.controlMode.data());
498  } else {
499  data.controlMode_isValid = false;
500  }
501 
502  if (iInteractionMode) {
503  data.interactionMode_isValid = iInteractionMode->getInteractionModes(reinterpret_cast<yarp::dev::InteractionModeEnum*>(data.interactionMode.data()));
504  } else {
505  data.interactionMode_isValid = false;
506  }
507 
508  extendedOutputStatePort.setEnvelope(averageTime);
509  extendedOutputState_buffer.write();
510 
511  // handle state:o
512  yarp::sig::Vector& v = outputPositionStatePort.prepare();
513  v.resize(subdevice_joints);
514  std::copy(data.jointPosition.begin(), data.jointPosition.end(), v.begin());
515 
516  outputPositionStatePort.setEnvelope(averageTime);
517  outputPositionStatePort.write();
518 }
const yarp::os::LogComponent & CONTROLBOARD()
void run() override
Loop function.
bool open(yarp::os::Searchable &prop) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
bool attach(yarp::dev::PolyDriver *poly) override
Attach to another object.
bool detach() override
Detach the object (you must have first called attach).
void init(yarp::dev::DeviceDriver *x)
Initialization.
virtual bool initialize()
Initialize the internal data.
void init(yarp::dev::DeviceDriver *x)
Initialization.
Interface implemented by all device drivers.
Definition: DeviceDriver.h:35
bool view(T *&x)
Get an interface to the device driver.
Definition: DeviceDriver.h:74
bool close() override
Close the DeviceDriver.
Definition: DeviceDriver.h:61
void attach(yarp::os::TypedReader< yarp::os::Bottle > &source)
Attach this object to a source of messages.
Definition: DeviceDriver.h:199
virtual bool getCurrents(double *vals)=0
virtual bool getControlModes(int *modes)=0
Get the current control mode (multiple joints).
virtual bool getCurrents(double *currs)=0
Get the instantaneous current measurement for all motors.
virtual bool getEncodersTimed(double *encs, double *time)=0
Read the instantaneous acceleration of all axes.
virtual bool getEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all axes.
virtual bool getEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all axes.
virtual bool getInteractionModes(int n_joints, int *joints, yarp::dev::InteractionModeEnum *modes)=0
Get the current interaction mode of the robot for a set of joints, values can be stiff or compliant.
virtual bool getMotorEncoderSpeeds(double *spds)=0
Read the instantaneous speed of all motor encoders.
virtual bool getMotorEncoderAccelerations(double *accs)=0
Read the instantaneous acceleration of all motor encoders.
virtual bool getMotorEncoders(double *encs)=0
Read the position of all motor encoders.
virtual bool getDutyCycles(double *vals)=0
Gets the current dutycycle of the output of the amplifier (i.e.
virtual bool getAxes(int *ax)=0
Get the number of controlled axes.
virtual bool getTorques(double *t)=0
Get the value of the torque for all joints (this is the feedback if you have torque sensors).
A container for a device driver.
Definition: PolyDriver.h:24
yarp::sig::VectorOf< double > motorVelocity
Definition: jointData.h:37
yarp::sig::VectorOf< double > jointAcceleration
Definition: jointData.h:33
yarp::sig::VectorOf< int > controlMode
Definition: jointData.h:47
yarp::sig::VectorOf< int > interactionMode
Definition: jointData.h:49
yarp::sig::VectorOf< double > current
Definition: jointData.h:45
yarp::sig::VectorOf< double > motorAcceleration
Definition: jointData.h:39
yarp::sig::VectorOf< double > motorPosition
Definition: jointData.h:35
yarp::sig::VectorOf< double > pwmDutycycle
Definition: jointData.h:43
yarp::sig::VectorOf< double > torque
Definition: jointData.h:41
yarp::sig::VectorOf< double > jointPosition
Definition: jointData.h:29
yarp::sig::VectorOf< double > jointVelocity
Definition: jointData.h:31
void close() override
Stop port activity.
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void interrupt() override
Interrupt any current reads or writes attached to the port.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
T & prepare()
Access the object which will be transmitted by the next call to yarp::os::BufferedPort::write.
An abstraction for a periodic thread.
bool setPeriod(double period)
Set the (new) period of the thread.
bool isRunning() const
Returns true when the thread is started, false otherwise.
bool start()
Call this to start the thread.
void stop()
Call this to stop the thread, this call blocks until the thread is terminated (and releaseThread() ca...
void attach(Port &port)
Attach this buffer to a particular port.
void write(bool forceStrict=false)
Try to write the last buffer returned by PortWriterBuffer::get.
T & get()
A synonym of PortWriterBuffer::prepare.
void attach(Port &port)
Set the Port to which objects will be written.
void setReader(PortReader &reader) override
Set an external reader for port data.
Definition: Port.cpp:502
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
Definition: Port.cpp:691
void interrupt() override
Interrupt any current reads or writes attached to the port.
Definition: Port.cpp:374
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
Definition: Port.cpp:538
void close() override
Stop port activity.
Definition: Port.cpp:354
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition: Port.cpp:79
A class for storing options and configuration information.
Definition: Property.h:34
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Definition: Property.cpp:1051
std::string toString() const override
Return a standard text representation of the content of the object.
Definition: Property.cpp:1069
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
Definition: Property.cpp:1063
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition: Property.cpp:1015
bool check(const std::string &key) const override
Check if there exists a property of the given name.
Definition: Property.cpp:1041
void unput(const std::string &key)
Remove the association from the given key to a value, if present.
Definition: Property.cpp:1046
A base class for nested structures that can be searched.
Definition: Searchable.h:66
virtual Value & find(const std::string &key) const =0
Gets a value corresponding to a given keyword.
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
virtual std::string toString() const =0
Return a standard text representation of the content of the object.
An abstraction for a time stamp and/or sequence number.
Definition: Stamp.h:22
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
Definition: Stamp.cpp:124
A single value (typically within a Bottle).
Definition: Value.h:45
virtual yarp::conf::float64_t asFloat64() const
Get 64-bit floating point value.
Definition: Value.cpp:222
virtual bool isFloat64() const
Checks if value is a 64-bit floating point number.
Definition: Value.cpp:150
virtual std::string asString() const
Get string value.
Definition: Value.cpp:234
void resize(size_t size) override
Resize the vector.
Definition: Vector.h:222
iterator begin() noexcept
Returns an iterator to the beginning of the VectorOf.
Definition: Vector.h:455
T * data()
Return a pointer to the first element of the vector.
Definition: Vector.h:207
iterator end() noexcept
Returns an iterator to the end of the VectorOf.
Definition: Vector.h:462
#define yCError(component,...)
Definition: LogComponent.h:154
#define yCWarning(component,...)
Definition: LogComponent.h:143
#define yCDebug(component,...)
Definition: LogComponent.h:109
An interface for the device drivers.
An interface to the operating system, including Port based communication.
Signal processing.
Definition: Image.h:22
The main, catch-all namespace for YARP.
Definition: dirs.h:16