YARP
Yet Another Robot Platform
MultipleAnalogSensorsServer.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #include "SensorStreamingData.h"
11 
13 
14 #include <yarp/os/Log.h>
15 #include <yarp/os/LogComponent.h>
16 #include <yarp/os/Property.h>
18 
19 
20 namespace {
21 YARP_LOG_COMPONENT(MULTIPLEANALOGSENSORSSERVER, "yarp.device.multipleanalogsensorsserver")
22 }
23 
25  PeriodicThread(0.02)
26 {
27 }
28 
30 
32 {
33  if (!config.check("name"))
34  {
35  yCError(MULTIPLEANALOGSENSORSSERVER, "Missing name parameter, exiting.");
36  return false;
37  }
38 
39  if (!config.check("period"))
40  {
41  yCError(MULTIPLEANALOGSENSORSSERVER, "Missing period parameter, exiting.");
42  return false;
43  }
44 
45  if (!config.find("period").isInt32())
46  {
47  yCError(MULTIPLEANALOGSENSORSSERVER, "Period parameter is present but it is not an integer, exiting.");
48  return false;
49  }
50 
51  m_periodInS = config.find("period").asInt32() / 1000.0;
52 
53  if (m_periodInS <= 0)
54  {
55  yCError(MULTIPLEANALOGSENSORSSERVER,
56  "Period parameter is present (%f) but it is not a positive integer, exiting.",
57  m_periodInS);
58  return false;
59  }
60 
61  std::string name = config.find("name").asString();
62 
63  // Reserve a fair amount of elements
64  // It would be great if yarp::sig::Vector had a reserve method
65  m_buffer.resize(100);
66  m_buffer.resize(0);
67 
68  // TODO(traversaro) Add port name validation when ready,
69  // see https://github.com/robotology/yarp/pull/1508
70  m_RPCPortName = name + "/rpc:o";
71  m_streamingPortName = name + "/measures:o";
72 
73  if (config.check("subdevice"))
74  {
75  std::string subdeviceName = config.find("subdevice").asString();
76 
77  yarp::os::Property driverConfig;
78  driverConfig.fromString(config.toString());
79  driverConfig.setMonitor(config.getMonitor(), subdeviceName.c_str()); // pass on any monitoring
80  driverConfig.put("device", subdeviceName);
81 
82  if (!m_subdevice.open(driverConfig))
83  {
84  yCError(MULTIPLEANALOGSENSORSSERVER, "Opening subdevice failed.");
85  return false;
86  }
87 
88  yarp::dev::PolyDriverList driverList;
89  driverList.push(&m_subdevice, subdeviceName.c_str());
90 
91  if (!attachAll(driverList))
92  {
93  yCError(MULTIPLEANALOGSENSORSSERVER, "Attaching subdevice failed.");
94  return false;
95  }
96 
97  yCInfo(MULTIPLEANALOGSENSORSSERVER,
98  "Subdevice \"%s\" successfully configured and attached.",
99  subdeviceName.c_str());
100  m_isDeviceOwned = true;
101  }
102 
103  return true;
104 }
105 
107 {
108  bool ok = this->detachAll();
109 
110  if (m_isDeviceOwned)
111  {
112  ok &= m_subdevice.close();
113  m_isDeviceOwned = false;
114  }
115 
116  return ok;
117 }
118 
119 // Note: as soon as we support only C++17, we can switch to using std::invoke
120 // See https://isocpp.org/wiki/faq/pointers-to-members#fnptr-vs-memfnptr-types
121 #define MAS_CALL_MEMBER_FN(object, ptrToMember) ((*object).*(ptrToMember))
122 
123 template<typename Interface>
124 bool MultipleAnalogSensorsServer::populateSensorsMetadata(Interface * wrappedDeviceInterface,
125  std::vector<SensorMetadata>& metadataVector, const std::string& tag,
126  size_t (Interface::*getNrOfSensorsMethodPtr)() const,
127  bool (Interface::*getNameMethodPtr)(size_t, std::string&) const,
128  bool (Interface::*getFrameNameMethodPtr)(size_t, std::string&) const)
129 {
130  if (wrappedDeviceInterface)
131  {
132  size_t nrOfSensors = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNrOfSensorsMethodPtr)();
133  metadataVector.resize(nrOfSensors);
134  for (size_t i=0; i < nrOfSensors; i++)
135  {
136  std::string sensorName;
137  bool ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNameMethodPtr)(i, sensorName);
138  if (!ok)
139  {
140  yCError(MULTIPLEANALOGSENSORSSERVER,
141  "Failure in reading name of sensor of type %s at index %zu.",
142  tag.c_str(),
143  i);
144  return false;
145  }
146  std::string frameName;
147  ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getFrameNameMethodPtr)(i, frameName);
148  if (!ok)
149  {
150  yCError(MULTIPLEANALOGSENSORSSERVER,
151  "Failure in reading frame name of sensor of type %s at index %zu.",
152  tag.c_str(),
153  i);
154  return false;
155  }
156 
157  metadataVector[i].name = sensorName;
158  metadataVector[i].frameName = frameName;
159  metadataVector[i].additionalMetadata = "";
160  }
161 
162  }
163  else
164  {
165  metadataVector.resize(0);
166  }
167  return true;
168 }
169 
170 template<typename Interface>
171 bool MultipleAnalogSensorsServer::populateSensorsMetadataNoFrameName(Interface * wrappedDeviceInterface,
172  std::vector<SensorMetadata>& metadataVector, const std::string& tag,
173  size_t (Interface::*getNrOfSensorsMethodPtr)() const,
174  bool (Interface::*getNameMethodPtr)(size_t, std::string&) const)
175 {
176  if (wrappedDeviceInterface)
177  {
178  size_t nrOfSensors = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNrOfSensorsMethodPtr)();
179  metadataVector.resize(nrOfSensors);
180  for (size_t i=0; i < nrOfSensors; i++)
181  {
182  std::string sensorName;
183  bool ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNameMethodPtr)(i, sensorName);
184  if (!ok)
185  {
186  yCError(MULTIPLEANALOGSENSORSSERVER,
187  "Failure in reading name of sensor of type %s at index %zu.",
188  tag.c_str(),
189  i);
190  return false;
191  }
192 
193  metadataVector[i].name = sensorName;
194  metadataVector[i].frameName = "";
195  metadataVector[i].additionalMetadata = "";
196  }
197 
198  }
199  else
200  {
201  metadataVector.resize(0);
202  }
203  return true;
204 }
205 
206 
207 bool MultipleAnalogSensorsServer::populateAllSensorsMetadata()
208 {
209  bool ok = true;
210  ok = ok && populateSensorsMetadata(m_iThreeAxisGyroscopes, m_sensorMetadata.ThreeAxisGyroscopes, "ThreeAxisGyroscopes",
214  ok = ok && populateSensorsMetadata(m_iThreeAxisLinearAccelerometers, m_sensorMetadata.ThreeAxisLinearAccelerometers, "ThreeAxisLinearAccelerometers",
218  ok = ok && populateSensorsMetadata(m_iThreeAxisMagnetometers, m_sensorMetadata.ThreeAxisMagnetometers, "ThreeAxisMagnetometers",
222  ok = ok && populateSensorsMetadata(m_iPositionSensors, m_sensorMetadata.PositionSensors, "PositionSensors",
226  ok = ok && populateSensorsMetadata(m_iOrientationSensors, m_sensorMetadata.OrientationSensors, "OrientationSensors",
230  ok = ok && populateSensorsMetadata(m_iTemperatureSensors, m_sensorMetadata.TemperatureSensors, "TemperatureSensors",
234  ok = ok && populateSensorsMetadata(m_iSixAxisForceTorqueSensors, m_sensorMetadata.SixAxisForceTorqueSensors, "SixAxisForceTorqueSensors",
238  ok = ok && populateSensorsMetadataNoFrameName(m_iContactLoadCellArrays, m_sensorMetadata.ContactLoadCellArrays, "ContactLoadCellArrays",
241  ok = ok && populateSensorsMetadataNoFrameName(m_iEncoderArrays, m_sensorMetadata.EncoderArrays, "EncoderArrays",
244  ok = ok && populateSensorsMetadataNoFrameName(m_iSkinPatches, m_sensorMetadata.SkinPatches, "ISkinPatches",
247 
248  return ok;
249 }
250 
252 {
253  // Attach the device
254  if (p.size() > 1)
255  {
256  yCError(MULTIPLEANALOGSENSORSSERVER,
257  "This device only supports exposing a "
258  "single MultipleAnalogSensors device on YARP ports, but %d devices have been passed in attachAll.",
259  p.size());
260  yCError(MULTIPLEANALOGSENSORSSERVER,
261  "Please use the multipleanalogsensorsremapper device to combine several device in a new device.");
262  close();
263  return false;
264  }
265 
266  if (p.size() == 0)
267  {
268  yCError(MULTIPLEANALOGSENSORSSERVER, "No device passed to attachAll, please pass a device to expose on YARP ports.");
269  close();
270  return false;
271  }
272 
273  yarp::dev::PolyDriver* poly = p[0]->poly;
274 
275  if (!poly)
276  {
277  yCError(MULTIPLEANALOGSENSORSSERVER, "Null pointer passed to attachAll.");
278  close();
279  return false;
280  }
281 
282  // View all the interfaces
283  poly->view(m_iThreeAxisGyroscopes);
284  poly->view(m_iThreeAxisLinearAccelerometers);
285  poly->view(m_iThreeAxisMagnetometers);
286  poly->view(m_iPositionSensors);
287  poly->view(m_iOrientationSensors);
288  poly->view(m_iTemperatureSensors);
289  poly->view(m_iSixAxisForceTorqueSensors);
290  poly->view(m_iContactLoadCellArrays);
291  poly->view(m_iEncoderArrays);
292  poly->view(m_iSkinPatches);
293 
294 
295  // Populate the RPC data to be served on the RPC port
296  bool ok = populateAllSensorsMetadata();
297 
298  if(!ok)
299  {
300  close();
301  return false;
302  }
303 
304  // Attach was successful, open the ports
305  ok = m_streamingPort.open(m_streamingPortName);
306  if (!ok)
307  {
308  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in opening port named %s.", m_streamingPortName.c_str());
309  close();
310  return false;
311  }
312 
313  ok = this->yarp().attachAsServer(m_rpcPort);
314  if (!ok)
315  {
316  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in attaching RPC port to thrift RPC interface.");
317  close();
318  return false;
319  }
320 
321  ok = m_rpcPort.open(m_RPCPortName);
322  if (!ok)
323  {
324  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in opening port named %s.", m_RPCPortName.c_str());
325  close();
326  return false;
327  }
328 
329  // Set rate period
330  ok = this->setPeriod(m_periodInS);
331  ok = ok && this->start();
332  if (!ok)
333  {
334  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in starting thread.");
335  close();
336  return false;
337  }
338 
339  return true;
340 }
341 
343 {
344  // Stop the thread on detach
345  if (this->isRunning())
346  {
347  this->stop();
348  }
349 
350  m_rpcPort.close();
351  m_streamingPort.close();
352 
353  return true;
354 }
355 
357 {
358  return m_sensorMetadata;
359 }
360 
361 template<typename Interface>
362 bool MultipleAnalogSensorsServer::genericStreamData(Interface* wrappedDeviceInterface,
363  const std::vector< SensorMetadata >& metadataVector,
364  std::vector< SensorMeasurement >& streamingDataVector,
365  yarp::dev::MAS_status (Interface::*getStatusMethodPtr)(size_t) const,
366  bool (Interface::*getMeasureMethodPtr)(size_t, yarp::sig::Vector&, double&) const)
367 {
368  if (wrappedDeviceInterface)
369  {
370  size_t nrOfSensors = metadataVector.size();
371  streamingDataVector.resize(nrOfSensors);
372  for (size_t i=0; i < nrOfSensors; i++)
373  {
374  yarp::sig::Vector& outputBuffer = streamingDataVector[i].measurement;
375  double& outputTimestamp = streamingDataVector[i].timestamp;
376  // TODO(traversaro): resize the buffer to the correct size
377  MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getMeasureMethodPtr)(i, outputBuffer, outputTimestamp);
378  yarp::dev::MAS_status status = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getStatusMethodPtr)(i);
379  if (status != yarp::dev::MAS_OK)
380  {
381  yCError(MULTIPLEANALOGSENSORSSERVER,
382  "Failure in reading data from sensor %s, no data will be sent on the port.",
383  m_sensorMetadata.ThreeAxisGyroscopes[i].name.c_str());
384  return false;
385  }
386  }
387  }
388 
389  return true;
390 }
391 
392 
394 {
395  SensorStreamingData& streamingData = m_streamingPort.prepare();
396 
397  bool ok = true;
398 
399  ok = ok && genericStreamData(m_iThreeAxisGyroscopes, m_sensorMetadata.ThreeAxisGyroscopes,
400  streamingData.ThreeAxisGyroscopes.measurements,
403 
404  ok = ok && genericStreamData(m_iThreeAxisLinearAccelerometers, m_sensorMetadata.ThreeAxisLinearAccelerometers,
408 
409  ok = ok && genericStreamData(m_iThreeAxisMagnetometers, m_sensorMetadata.ThreeAxisMagnetometers,
410  streamingData.ThreeAxisMagnetometers.measurements,
413 
414  ok = ok && genericStreamData(m_iPositionSensors, m_sensorMetadata.PositionSensors,
415  streamingData.PositionSensors.measurements,
418 
419  ok = ok && genericStreamData(m_iOrientationSensors, m_sensorMetadata.OrientationSensors,
420  streamingData.OrientationSensors.measurements,
423 
424  ok = ok && genericStreamData(m_iTemperatureSensors, m_sensorMetadata.TemperatureSensors,
425  streamingData.TemperatureSensors.measurements,
428 
429  ok = ok && genericStreamData(m_iSixAxisForceTorqueSensors, m_sensorMetadata.SixAxisForceTorqueSensors,
433 
434  ok = ok && genericStreamData(m_iContactLoadCellArrays, m_sensorMetadata.ContactLoadCellArrays,
435  streamingData.ContactLoadCellArrays.measurements,
438 
439  ok = ok && genericStreamData(m_iEncoderArrays, m_sensorMetadata.EncoderArrays,
440  streamingData.EncoderArrays.measurements,
443 
444  ok = ok && genericStreamData(m_iSkinPatches, m_sensorMetadata.SkinPatches,
445  streamingData.SkinPatches.measurements,
448 
449  if (ok)
450  {
451  m_stamp.update();
452  m_streamingPort.setEnvelope(m_stamp);
453  m_streamingPort.write();
454  }
455  else
456  {
457  m_streamingPort.unprepare();
458  }
459 }
460 
462 {
463  return;
464 }
#define MAS_CALL_MEMBER_FN(object, ptrToMember)
bool detachAll() override
Detach the object (you must have first called attach).
SensorRPCData getMetadata() override
Read the sensor metadata necessary to configure the MultipleAnalogSensorsClient device.
void run() override
Loop function.
void threadRelease() override
Release method.
bool close() override
Close the DeviceDriver.
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
bool attachAll(const yarp::dev::PolyDriverList &p) override
Attach to a list of objects.
std::vector< SensorMeasurement > measurements
std::vector< SensorMetadata > SkinPatches
Definition: SensorRPCData.h:34
std::vector< SensorMetadata > ContactLoadCellArrays
Definition: SensorRPCData.h:32
std::vector< SensorMetadata > EncoderArrays
Definition: SensorRPCData.h:33
std::vector< SensorMetadata > PositionSensors
Definition: SensorRPCData.h:35
std::vector< SensorMetadata > ThreeAxisGyroscopes
Definition: SensorRPCData.h:26
std::vector< SensorMetadata > ThreeAxisLinearAccelerometers
Definition: SensorRPCData.h:27
std::vector< SensorMetadata > ThreeAxisMagnetometers
Definition: SensorRPCData.h:28
std::vector< SensorMetadata > OrientationSensors
Definition: SensorRPCData.h:29
std::vector< SensorMetadata > SixAxisForceTorqueSensors
Definition: SensorRPCData.h:31
std::vector< SensorMetadata > TemperatureSensors
Definition: SensorRPCData.h:30
SensorMeasurements EncoderArrays
SensorMeasurements ThreeAxisLinearAccelerometers
SensorMeasurements PositionSensors
SensorMeasurements OrientationSensors
SensorMeasurements ThreeAxisMagnetometers
SensorMeasurements ThreeAxisGyroscopes
SensorMeasurements SixAxisForceTorqueSensors
SensorMeasurements SkinPatches
SensorMeasurements ContactLoadCellArrays
SensorMeasurements TemperatureSensors
bool view(T *&x)
Get an interface to the device driver.
Definition: DeviceDriver.h:77
virtual yarp::dev::MAS_status getContactLoadCellArrayStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getContactLoadCellArrayName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual bool getContactLoadCellArrayMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual size_t getNrOfContactLoadCellArrays() const =0
Get the number of contact load cell array exposed by this device.
virtual bool getEncoderArrayMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual size_t getNrOfEncoderArrays() const =0
Get the number of encoder arrays exposed by this device.
virtual yarp::dev::MAS_status getEncoderArrayStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getEncoderArrayName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual bool getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getOrientationSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfOrientationSensors() const =0
Get the number of orientation sensors exposed by this device.
virtual bool getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const =0
Get the last reading of the orientation sensor as roll pitch yaw.
virtual bool getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const =0
Get the last reading of the position sensor as x y z.
virtual bool getPositionSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfPositionSensors() const =0
Get the number of position sensors exposed by this device.
virtual yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getPositionSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual bool getSixAxisForceTorqueSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual size_t getNrOfSixAxisForceTorqueSensors() const =0
Get the number of six axis force torque sensors exposed by this device.
virtual yarp::dev::MAS_status getSixAxisForceTorqueSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getSixAxisForceTorqueSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual bool getSixAxisForceTorqueSensorMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual bool getSkinPatchName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfSkinPatches() const =0
Get the number of skin patches exposed by this device.
virtual yarp::dev::MAS_status getSkinPatchStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getSkinPatchMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual bool getTemperatureSensorFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual bool getTemperatureSensorName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual yarp::dev::MAS_status getTemperatureSensorStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getTemperatureSensorMeasure(size_t sens_index, double &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual size_t getNrOfTemperatureSensors() const =0
Get the number of temperature sensors exposed by this device.
virtual yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfThreeAxisGyroscopes() const =0
Get the number of three axis gyroscopes exposed by this sensor.
virtual bool getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual bool getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the gyroscope.
virtual bool getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfThreeAxisLinearAccelerometers() const =0
Get the number of three axis linear accelerometers exposed by this device.
virtual bool getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
virtual yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual bool getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const =0
Get the name of the specified sensor.
virtual size_t getNrOfThreeAxisMagnetometers() const =0
Get the number of magnetometers exposed by this device.
virtual yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const =0
Get the status of the specified sensor.
virtual bool getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const =0
Get the name of the frame of the specified sensor.
virtual bool getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const =0
Get the last reading of the specified sensor.
void push(PolyDriver *p, const char *k)
A container for a device driver.
Definition: PolyDriver.h:27
bool close() override
Close the DeviceDriver.
Definition: PolyDriver.cpp:176
bool open(const std::string &txt)
Construct and configure a device by its common name.
Definition: PolyDriver.cpp:143
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 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.
bool unprepare()
Give the last prepared object back to YARP without writing it.
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 close() override
Stop port activity.
Definition: Port.cpp:357
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition: Port.cpp:82
A class for storing options and configuration information.
Definition: Property.h:37
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
Definition: Property.cpp:1046
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
Definition: Property.cpp:998
A base class for nested structures that can be searched.
Definition: Searchable.h:69
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.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
Definition: Stamp.cpp:113
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:207
virtual bool isInt32() const
Checks if value is a 32-bit integer.
Definition: Value.cpp:135
virtual std::string asString() const
Get string value.
Definition: Value.cpp:237
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
Definition: Wire.h:34
void resize(size_t size) override
Resize the vector.
Definition: Vector.h:254
#define yCInfo(component,...)
Definition: LogComponent.h:135
#define yCError(component,...)
Definition: LogComponent.h:157
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:80
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_OK
The sensor is working correctly.