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 
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::IJointFault* iJointFault{nullptr};
211  subdevice_ptr->view(iJointFault);
212  if (!iJointFault) {
213  yCWarning(CONTROLBOARD, "Part <%s>: iJointFault interface was not found in subdevice.", partName.c_str());
214  }
215 
216  // yarp::dev::IPidControl* iPidControl{nullptr};
217  subdevice_ptr->view(iPidControl);
218  if (!iPidControl) {
219  yCWarning(CONTROLBOARD, "Part <%s>: IPidControl interface was not found in subdevice.", partName.c_str());
220  }
221 
222  // yarp::dev::IPositionControl* iPositionControl{nullptr};
223  subdevice_ptr->view(iPositionControl);
224  if (!iPositionControl) {
225  yCError(CONTROLBOARD, "Part <%s>: IPositionControl interface was not found in subdevice. Quitting", partName.c_str());
226  return false;
227  }
228 
229  // yarp::dev::IPositionDirect* iPositionDirect{nullptr};
230  subdevice_ptr->view(iPositionDirect);
231  if (!iPositionDirect) {
232  yCWarning(CONTROLBOARD, "Part <%s>: IPositionDirect interface was not found in subdevice.", partName.c_str());
233  }
234 
235  // yarp::dev::IVelocityControl* iVelocityControl{nullptr};
236  subdevice_ptr->view(iVelocityControl);
237  if (!iVelocityControl) {
238  yCError(CONTROLBOARD, "Part <%s>: IVelocityControl interface was not found in subdevice. Quitting", partName.c_str());
239  return false;
240  }
241 
242  // yarp::dev::IEncodersTimed* iEncodersTimed{nullptr};
243  subdevice_ptr->view(iEncodersTimed);
244  if (!iEncodersTimed) {
245  yCError(CONTROLBOARD, "Part <%s>: IEncodersTimed interface was not found in subdevice. Quitting", partName.c_str());
246  return false;
247  }
248 
249  // yarp::dev::IMotor* iMotor{nullptr};
250  subdevice_ptr->view(iMotor);
251  if (!iMotor) {
252  yCWarning(CONTROLBOARD, "Part <%s>: IMotor interface was not found in subdevice.", partName.c_str());
253  }
254 
255  // yarp::dev::IMotorEncoders* iMotorEncoders{nullptr};
256  subdevice_ptr->view(iMotorEncoders);
257  if (!iMotorEncoders) {
258  yCWarning(CONTROLBOARD, "Part <%s>: IMotorEncoders interface was not found in subdevice.", partName.c_str());
259  }
260 
261  // yarp::dev::IAmplifierControl* iAmplifierControl{nullptr};
262  subdevice_ptr->view(iAmplifierControl);
263  if (!iAmplifierControl) {
264  yCWarning(CONTROLBOARD, "Part <%s>: IAmplifierControl interface was not found in subdevice.", partName.c_str());
265  }
266 
267  // yarp::dev::IControlLimits* iControlLimits{nullptr};
268  subdevice_ptr->view(iControlLimits);
269  if (!iControlLimits) {
270  yCWarning(CONTROLBOARD, "Part <%s>: IControlLimits interface was not found in subdevice.", partName.c_str());
271  }
272 
273  // yarp::dev::IControlCalibration* iControlCalibration{nullptr};
274  subdevice_ptr->view(iControlCalibration);
275  if (!iControlCalibration) {
276  yCWarning(CONTROLBOARD, "Part <%s>: IControlCalibration interface was not found in subdevice.", partName.c_str());
277  }
278 
279  // yarp::dev::ITorqueControl* iTorqueControl{nullptr};
280  subdevice_ptr->view(iTorqueControl);
281  if (!iTorqueControl) {
282  yCWarning(CONTROLBOARD, "Part <%s>: ITorqueControl interface was not found in subdevice.", partName.c_str());
283  }
284 
285  // yarp::dev::IImpedanceControl* iImpedanceControl{nullptr};
286  subdevice_ptr->view(iImpedanceControl);
287  if (!iImpedanceControl) {
288  yCWarning(CONTROLBOARD, "Part <%s>: IImpedanceControl interface was not found in subdevice.", partName.c_str());
289  }
290 
291  // yarp::dev::IControlMode* iControlMode{nullptr};
292  subdevice_ptr->view(iControlMode);
293  if (!iControlMode) {
294  yCWarning(CONTROLBOARD, "Part <%s>: IControlMode interface was not found in subdevice.", partName.c_str());
295  }
296 
297  // yarp::dev::IAxisInfo* iAxisInfo{nullptr};
298  subdevice_ptr->view(iAxisInfo);
299  if (!iAxisInfo) {
300  yCWarning(CONTROLBOARD, "Part <%s>: IAxisInfo interface was not found in subdevice.", partName.c_str());
301  }
302 
303  // yarp::dev::IPreciselyTimed* iPreciselyTimed{nullptr};
304  subdevice_ptr->view(iPreciselyTimed);
305  if (!iPreciselyTimed) {
306  yCWarning(CONTROLBOARD, "Part <%s>: IPreciselyTimed interface was not found in subdevice.", partName.c_str());
307  }
308 
309  // yarp::dev::IInteractionMode* iInteractionMode{nullptr};
310  subdevice_ptr->view(iInteractionMode);
311  if (!iInteractionMode) {
312  yCWarning(CONTROLBOARD, "Part <%s>: IInteractionMode interface was not found in subdevice.", partName.c_str());
313  }
314 
315  // yarp::dev::IRemoteVariables* iRemoteVariables{nullptr};
316  subdevice_ptr->view(iRemoteVariables);
317  if (!iRemoteVariables) {
318  yCWarning(CONTROLBOARD, "Part <%s>: IRemoteVariables interface was not found in subdevice.", partName.c_str());
319  }
320 
321  // yarp::dev::IPWMControl* iPWMControl{nullptr};
322  subdevice_ptr->view(iPWMControl);
323  if (!iPWMControl) {
324  yCWarning(CONTROLBOARD, "Part <%s>: IPWMControl interface was not found in subdevice.", partName.c_str());
325  }
326 
327  // yarp::dev::ICurrentControl* iCurrentControl{nullptr};
328  subdevice_ptr->view(iCurrentControl);
329  if (!iCurrentControl) {
330  yCWarning(CONTROLBOARD, "Part <%s>: ICurrentControl interface was not found in subdevice.", partName.c_str());
331  }
332 
333 
334  // Get the number of controlled joints
335  int tmp_axes;
336  if (!iPositionControl->getAxes(&tmp_axes)) {
337  yCError(CONTROLBOARD) << "Part <%s>: Failed to get axes number for subdevice " << partName.c_str();
338  return false;
339  }
340  if (tmp_axes <= 0) {
341  yCError(CONTROLBOARD, "Part <%s>: attached device has an invalid number of joints (%d)", partName.c_str(), tmp_axes);
342  return false;
343  }
344  subdevice_joints = static_cast<size_t>(tmp_axes);
345  times.resize(subdevice_joints);
346 
347  // Initialization
348  streaming_parser.init(subdevice_ptr);
349  streaming_parser.initialize();
350 
351  RPC_parser.init(subdevice_ptr);
352  RPC_parser.initialize();
353 
354  return true;
355 }
356 
357 void ControlBoard_nws_yarp::closeDevice()
358 {
359  // Reset callbacks
360  streaming_parser.reset();
361  RPC_parser.reset();
362 
363  // If the subdevice is owned, close and delete the device
364  if (subdevice_owned) {
365  subdevice_ptr->close();
366  delete subdevice_ptr;
367  }
368  subdevice_ptr = nullptr;
369  subdevice_owned = false;
370  subdevice_joints = 0;
371  subdevice_ready = false;
372 
373  times.clear();
374 
375  // Clear all interfaces
376  iPidControl = nullptr;
377  iPositionControl = nullptr;
378  iPositionDirect = nullptr;
379  iVelocityControl = nullptr;
380  iEncodersTimed = nullptr;
381  iMotor = nullptr;
382  iMotorEncoders = nullptr;
383  iAmplifierControl = nullptr;
384  iControlLimits = nullptr;
385  iControlCalibration = nullptr;
386  iTorqueControl = nullptr;
387  iImpedanceControl = nullptr;
388  iControlMode = nullptr;
389  iAxisInfo = nullptr;
390  iPreciselyTimed = nullptr;
391  iInteractionMode = nullptr;
392  iRemoteVariables = nullptr;
393  iPWMControl = nullptr;
394  iCurrentControl = nullptr;
395  iJointFault = nullptr;
396 }
397 
399 {
400  // Check if we already instantiated a subdevice previously
401  if (subdevice_ready) {
402  return false;
403  }
404 
405  if (!setDevice(poly, false)) {
406  return false;
407  }
408 
409  setPeriod(period);
410  if (!start()) {
411  yCError(CONTROLBOARD) << "Error starting thread";
412  return false;
413  }
414 
415  return true;
416 }
417 
419 {
420  //check if we already instantiated a subdevice previously
421  if (subdevice_owned) {
422  return false;
423  }
424 
425  // Ensure that the device is not running
426  if (isRunning()) {
427  stop();
428  }
429 
430  closeDevice();
431 
432  return true;
433 }
434 
436 {
437  // check we are not overflowing with input messages
438  constexpr int reads_for_warning = 20;
439  if (inputStreamingPort.getPendingReads() >= reads_for_warning) {
440  yCWarning(CONTROLBOARD) << "Number of streaming input messages to be read is " << inputStreamingPort.getPendingReads() << " and can overflow";
441  }
442 
443  // Update the port envelope time by averaging all timestamps
444  time.update(std::accumulate(times.begin(), times.end(), 0.0) / subdevice_joints);
445  yarp::os::Stamp averageTime = time;
446 
447  // handle stateExt first
448  jointData& data = extendedOutputState_buffer.get();
449 
450  data.jointPosition.resize(subdevice_joints);
451  data.jointVelocity.resize(subdevice_joints);
452  data.jointAcceleration.resize(subdevice_joints);
453  data.motorPosition.resize(subdevice_joints);
454  data.motorVelocity.resize(subdevice_joints);
455  data.motorAcceleration.resize(subdevice_joints);
456  data.torque.resize(subdevice_joints);
457  data.pwmDutycycle.resize(subdevice_joints);
458  data.current.resize(subdevice_joints);
459  data.controlMode.resize(subdevice_joints);
460  data.interactionMode.resize(subdevice_joints);
461 
462  // Get data from HW
463  if (iEncodersTimed) {
464  data.jointPosition_isValid = iEncodersTimed->getEncodersTimed(data.jointPosition.data(), times.data());
465  data.jointVelocity_isValid = iEncodersTimed->getEncoderSpeeds(data.jointVelocity.data());
467  } else {
468  data.jointPosition_isValid = false;
469  data.jointVelocity_isValid = false;
470  data.jointAcceleration_isValid = false;
471  }
472 
473  if (iMotorEncoders) {
474  data.motorPosition_isValid = iMotorEncoders->getMotorEncoders(data.motorPosition.data());
475  data.motorVelocity_isValid = iMotorEncoders->getMotorEncoderSpeeds(data.motorVelocity.data());
477  } else {
478  data.motorPosition_isValid = false;
479  data.motorVelocity_isValid = false;
480  data.motorAcceleration_isValid = false;
481  }
482 
483  if (iTorqueControl) {
484  data.torque_isValid = iTorqueControl->getTorques(data.torque.data());
485  } else {
486  data.torque_isValid = false;
487  }
488 
489  if (iPWMControl) {
490  data.pwmDutycycle_isValid = iPWMControl->getDutyCycles(data.pwmDutycycle.data());
491  } else {
492  data.pwmDutycycle_isValid = false;
493  }
494 
495  if (iCurrentControl) {
496  data.current_isValid = iCurrentControl->getCurrents(data.current.data());
497  } else if (iAmplifierControl) {
498  data.current_isValid = iAmplifierControl->getCurrents(data.current.data());
499  } else {
500  data.current_isValid = false;
501  }
502 
503  if (iControlMode) {
504  data.controlMode_isValid = iControlMode->getControlModes(data.controlMode.data());
505  } else {
506  data.controlMode_isValid = false;
507  }
508 
509  if (iInteractionMode) {
510  data.interactionMode_isValid = iInteractionMode->getInteractionModes(reinterpret_cast<yarp::dev::InteractionModeEnum*>(data.interactionMode.data()));
511  } else {
512  data.interactionMode_isValid = false;
513  }
514 
515  extendedOutputStatePort.setEnvelope(averageTime);
516  extendedOutputState_buffer.write();
517 
518  // handle state:o
519  yarp::sig::Vector& v = outputPositionStatePort.prepare();
520  v.resize(subdevice_joints);
521  std::copy(data.jointPosition.begin(), data.jointPosition.end(), v.begin());
522 
523  outputPositionStatePort.setEnvelope(averageTime);
524  outputPositionStatePort.write();
525 }
const yarp::os::LogComponent & CONTROLBOARD()
constexpr double default_period
Definition: FakeOdometry.h:14
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:30
bool view(T *&x)
Get an interface to the device driver.
Definition: DeviceDriver.h:88
bool close() override
Close the DeviceDriver.
Definition: DeviceDriver.h:59
void attach(yarp::os::TypedReader< yarp::os::Bottle > &source)
Attach this object to a source of messages.
Definition: DeviceDriver.h:219
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:23
yarp::sig::VectorOf< double > motorVelocity
Definition: jointData.h:35
yarp::sig::VectorOf< double > jointAcceleration
Definition: jointData.h:31
yarp::sig::VectorOf< int > controlMode
Definition: jointData.h:45
yarp::sig::VectorOf< int > interactionMode
Definition: jointData.h:47
yarp::sig::VectorOf< double > current
Definition: jointData.h:43
yarp::sig::VectorOf< double > motorAcceleration
Definition: jointData.h:37
yarp::sig::VectorOf< double > motorPosition
Definition: jointData.h:33
yarp::sig::VectorOf< double > pwmDutycycle
Definition: jointData.h:41
yarp::sig::VectorOf< double > torque
Definition: jointData.h:39
yarp::sig::VectorOf< double > jointPosition
Definition: jointData.h:27
yarp::sig::VectorOf< double > jointVelocity
Definition: jointData.h:29
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:511
bool removeCallbackLock() override
Remove a lock on callbacks added with setCallbackLock()
Definition: Port.cpp:700
void interrupt() override
Interrupt any current reads or writes attached to the port.
Definition: Port.cpp:383
bool setEnvelope(PortWriter &envelope) override
Set an envelope (e.g., a timestamp) to the next message which will be sent.
Definition: Port.cpp:547
void close() override
Stop port activity.
Definition: Port.cpp:363
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:33
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:63
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:21
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:43
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:220
iterator begin() noexcept
Returns an iterator to the beginning of the VectorOf.
Definition: Vector.h:453
T * data()
Return a pointer to the first element of the vector.
Definition: Vector.h:205
iterator end() noexcept
Returns an iterator to the end of the VectorOf.
Definition: Vector.h:460
#define yCError(component,...)
Definition: LogComponent.h:213
#define yCWarning(component,...)
Definition: LogComponent.h:192
#define yCDebug(component,...)
Definition: LogComponent.h:128
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.
The main, catch-all namespace for YARP.
Definition: dirs.h:16