YARP
Yet Another Robot Platform
MultipleAnalogSensorsServer.cpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #include "SensorStreamingData.h"
8 
10 
11 #include <yarp/os/Log.h>
12 #include <yarp/os/LogComponent.h>
13 #include <yarp/os/Property.h>
15 
16 
17 namespace {
18 YARP_LOG_COMPONENT(MULTIPLEANALOGSENSORSSERVER, "yarp.device.multipleanalogsensorsserver")
19 }
20 
22  PeriodicThread(0.02)
23 {
24 }
25 
27 
29 {
30  if (!config.check("name"))
31  {
32  yCError(MULTIPLEANALOGSENSORSSERVER, "Missing name parameter, exiting.");
33  return false;
34  }
35 
36  if (!config.check("period"))
37  {
38  yCError(MULTIPLEANALOGSENSORSSERVER, "Missing period parameter, exiting.");
39  return false;
40  }
41 
42  if (!config.find("period").isInt32())
43  {
44  yCError(MULTIPLEANALOGSENSORSSERVER, "Period parameter is present but it is not an integer, exiting.");
45  return false;
46  }
47 
48  m_periodInS = config.find("period").asInt32() / 1000.0;
49 
50  if (m_periodInS <= 0)
51  {
52  yCError(MULTIPLEANALOGSENSORSSERVER,
53  "Period parameter is present (%f) but it is not a positive integer, exiting.",
54  m_periodInS);
55  return false;
56  }
57 
58  std::string name = config.find("name").asString();
59 
60  // Reserve a fair amount of elements
61  // It would be great if yarp::sig::Vector had a reserve method
62  m_buffer.resize(100);
63  m_buffer.resize(0);
64 
65  // TODO(traversaro) Add port name validation when ready,
66  // see https://github.com/robotology/yarp/pull/1508
67  m_RPCPortName = name + "/rpc:o";
68  m_streamingPortName = name + "/measures:o";
69 
70  if (config.check("subdevice"))
71  {
72  std::string subdeviceName = config.find("subdevice").asString();
73 
74  yarp::os::Property driverConfig;
75  driverConfig.fromString(config.toString());
76  driverConfig.setMonitor(config.getMonitor(), subdeviceName.c_str()); // pass on any monitoring
77  driverConfig.put("device", subdeviceName);
78 
79  if (!m_subdevice.open(driverConfig))
80  {
81  yCError(MULTIPLEANALOGSENSORSSERVER, "Opening subdevice failed.");
82  return false;
83  }
84 
85  yarp::dev::PolyDriverList driverList;
86  driverList.push(&m_subdevice, subdeviceName.c_str());
87 
88  if (!attachAll(driverList))
89  {
90  yCError(MULTIPLEANALOGSENSORSSERVER, "Attaching subdevice failed.");
91  return false;
92  }
93 
94  yCInfo(MULTIPLEANALOGSENSORSSERVER,
95  "Subdevice \"%s\" successfully configured and attached.",
96  subdeviceName.c_str());
97  m_isDeviceOwned = true;
98  }
99 
100  return true;
101 }
102 
104 {
105  bool ok = this->detachAll();
106 
107  if (m_isDeviceOwned)
108  {
109  ok &= m_subdevice.close();
110  m_isDeviceOwned = false;
111  }
112 
113  return ok;
114 }
115 
116 // Note: as soon as we support only C++17, we can switch to using std::invoke
117 // See https://isocpp.org/wiki/faq/pointers-to-members#fnptr-vs-memfnptr-types
118 #define MAS_CALL_MEMBER_FN(object, ptrToMember) ((*object).*(ptrToMember))
119 
120 template<typename Interface>
121 bool MultipleAnalogSensorsServer::populateSensorsMetadata(Interface * wrappedDeviceInterface,
122  std::vector<SensorMetadata>& metadataVector, const std::string& tag,
123  size_t (Interface::*getNrOfSensorsMethodPtr)() const,
124  bool (Interface::*getNameMethodPtr)(size_t, std::string&) const,
125  bool (Interface::*getFrameNameMethodPtr)(size_t, std::string&) const)
126 {
127  if (wrappedDeviceInterface)
128  {
129  size_t nrOfSensors = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNrOfSensorsMethodPtr)();
130  metadataVector.resize(nrOfSensors);
131  for (size_t i=0; i < nrOfSensors; i++)
132  {
133  std::string sensorName;
134  bool ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNameMethodPtr)(i, sensorName);
135  if (!ok)
136  {
137  yCError(MULTIPLEANALOGSENSORSSERVER,
138  "Failure in reading name of sensor of type %s at index %zu.",
139  tag.c_str(),
140  i);
141  return false;
142  }
143  std::string frameName;
144  ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getFrameNameMethodPtr)(i, frameName);
145  if (!ok)
146  {
147  yCError(MULTIPLEANALOGSENSORSSERVER,
148  "Failure in reading frame name of sensor of type %s at index %zu.",
149  tag.c_str(),
150  i);
151  return false;
152  }
153 
154  metadataVector[i].name = sensorName;
155  metadataVector[i].frameName = frameName;
156  metadataVector[i].additionalMetadata = "";
157  }
158 
159  }
160  else
161  {
162  metadataVector.resize(0);
163  }
164  return true;
165 }
166 
167 template<typename Interface>
168 bool MultipleAnalogSensorsServer::populateSensorsMetadataNoFrameName(Interface * wrappedDeviceInterface,
169  std::vector<SensorMetadata>& metadataVector, const std::string& tag,
170  size_t (Interface::*getNrOfSensorsMethodPtr)() const,
171  bool (Interface::*getNameMethodPtr)(size_t, std::string&) const)
172 {
173  if (wrappedDeviceInterface)
174  {
175  size_t nrOfSensors = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNrOfSensorsMethodPtr)();
176  metadataVector.resize(nrOfSensors);
177  for (size_t i=0; i < nrOfSensors; i++)
178  {
179  std::string sensorName;
180  bool ok = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getNameMethodPtr)(i, sensorName);
181  if (!ok)
182  {
183  yCError(MULTIPLEANALOGSENSORSSERVER,
184  "Failure in reading name of sensor of type %s at index %zu.",
185  tag.c_str(),
186  i);
187  return false;
188  }
189 
190  metadataVector[i].name = sensorName;
191  metadataVector[i].frameName = "";
192  metadataVector[i].additionalMetadata = "";
193  }
194 
195  }
196  else
197  {
198  metadataVector.resize(0);
199  }
200  return true;
201 }
202 
203 
204 bool MultipleAnalogSensorsServer::populateAllSensorsMetadata()
205 {
206  bool ok = true;
207  ok = ok && populateSensorsMetadata(m_iThreeAxisGyroscopes, m_sensorMetadata.ThreeAxisGyroscopes, "ThreeAxisGyroscopes",
211  ok = ok && populateSensorsMetadata(m_iThreeAxisLinearAccelerometers, m_sensorMetadata.ThreeAxisLinearAccelerometers, "ThreeAxisLinearAccelerometers",
215  ok = ok && populateSensorsMetadata(m_iThreeAxisMagnetometers, m_sensorMetadata.ThreeAxisMagnetometers, "ThreeAxisMagnetometers",
219  ok = ok && populateSensorsMetadata(m_iPositionSensors, m_sensorMetadata.PositionSensors, "PositionSensors",
223  ok = ok && populateSensorsMetadata(m_iOrientationSensors, m_sensorMetadata.OrientationSensors, "OrientationSensors",
227  ok = ok && populateSensorsMetadata(m_iTemperatureSensors, m_sensorMetadata.TemperatureSensors, "TemperatureSensors",
231  ok = ok && populateSensorsMetadata(m_iSixAxisForceTorqueSensors, m_sensorMetadata.SixAxisForceTorqueSensors, "SixAxisForceTorqueSensors",
235  ok = ok && populateSensorsMetadataNoFrameName(m_iContactLoadCellArrays, m_sensorMetadata.ContactLoadCellArrays, "ContactLoadCellArrays",
238  ok = ok && populateSensorsMetadataNoFrameName(m_iEncoderArrays, m_sensorMetadata.EncoderArrays, "EncoderArrays",
241  ok = ok && populateSensorsMetadataNoFrameName(m_iSkinPatches, m_sensorMetadata.SkinPatches, "ISkinPatches",
244 
245  return ok;
246 }
247 
249 {
250  // Attach the device
251  if (p.size() > 1)
252  {
253  yCError(MULTIPLEANALOGSENSORSSERVER,
254  "This device only supports exposing a "
255  "single MultipleAnalogSensors device on YARP ports, but %d devices have been passed in attachAll.",
256  p.size());
257  yCError(MULTIPLEANALOGSENSORSSERVER,
258  "Please use the multipleanalogsensorsremapper device to combine several device in a new device.");
259  close();
260  return false;
261  }
262 
263  if (p.size() == 0)
264  {
265  yCError(MULTIPLEANALOGSENSORSSERVER, "No device passed to attachAll, please pass a device to expose on YARP ports.");
266  close();
267  return false;
268  }
269 
270  yarp::dev::PolyDriver* poly = p[0]->poly;
271 
272  if (!poly)
273  {
274  yCError(MULTIPLEANALOGSENSORSSERVER, "Null pointer passed to attachAll.");
275  close();
276  return false;
277  }
278 
279  // View all the interfaces
280  poly->view(m_iThreeAxisGyroscopes);
281  poly->view(m_iThreeAxisLinearAccelerometers);
282  poly->view(m_iThreeAxisMagnetometers);
283  poly->view(m_iPositionSensors);
284  poly->view(m_iOrientationSensors);
285  poly->view(m_iTemperatureSensors);
286  poly->view(m_iSixAxisForceTorqueSensors);
287  poly->view(m_iContactLoadCellArrays);
288  poly->view(m_iEncoderArrays);
289  poly->view(m_iSkinPatches);
290 
291 
292  // Populate the RPC data to be served on the RPC port
293  bool ok = populateAllSensorsMetadata();
294 
295  if(!ok)
296  {
297  close();
298  return false;
299  }
300 
301  // Attach was successful, open the ports
302  ok = m_streamingPort.open(m_streamingPortName);
303  if (!ok)
304  {
305  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in opening port named %s.", m_streamingPortName.c_str());
306  close();
307  return false;
308  }
309 
310  ok = this->yarp().attachAsServer(m_rpcPort);
311  if (!ok)
312  {
313  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in attaching RPC port to thrift RPC interface.");
314  close();
315  return false;
316  }
317 
318  ok = m_rpcPort.open(m_RPCPortName);
319  if (!ok)
320  {
321  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in opening port named %s.", m_RPCPortName.c_str());
322  close();
323  return false;
324  }
325 
326  // Set rate period
327  ok = this->setPeriod(m_periodInS);
328  ok = ok && this->start();
329  if (!ok)
330  {
331  yCError(MULTIPLEANALOGSENSORSSERVER, "Failure in starting thread.");
332  close();
333  return false;
334  }
335 
336  return true;
337 }
338 
340 {
341  // Stop the thread on detach
342  if (this->isRunning())
343  {
344  this->stop();
345  }
346 
347  m_rpcPort.close();
348  m_streamingPort.close();
349 
350  return true;
351 }
352 
354 {
355  return m_sensorMetadata;
356 }
357 
358 template<typename Interface>
359 bool MultipleAnalogSensorsServer::genericStreamData(Interface* wrappedDeviceInterface,
360  const std::vector< SensorMetadata >& metadataVector,
361  std::vector< SensorMeasurement >& streamingDataVector,
362  yarp::dev::MAS_status (Interface::*getStatusMethodPtr)(size_t) const,
363  bool (Interface::*getMeasureMethodPtr)(size_t, yarp::sig::Vector&, double&) const)
364 {
365  if (wrappedDeviceInterface)
366  {
367  size_t nrOfSensors = metadataVector.size();
368  streamingDataVector.resize(nrOfSensors);
369  for (size_t i=0; i < nrOfSensors; i++)
370  {
371  yarp::sig::Vector& outputBuffer = streamingDataVector[i].measurement;
372  double& outputTimestamp = streamingDataVector[i].timestamp;
373  // TODO(traversaro): resize the buffer to the correct size
374  MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getMeasureMethodPtr)(i, outputBuffer, outputTimestamp);
375  yarp::dev::MAS_status status = MAS_CALL_MEMBER_FN(wrappedDeviceInterface, getStatusMethodPtr)(i);
376  if (status != yarp::dev::MAS_OK)
377  {
378  yCError(MULTIPLEANALOGSENSORSSERVER,
379  "Failure in reading data from sensor %s, no data will be sent on the port.",
380  m_sensorMetadata.ThreeAxisGyroscopes[i].name.c_str());
381  return false;
382  }
383  }
384  }
385 
386  return true;
387 }
388 
389 
391 {
392  SensorStreamingData& streamingData = m_streamingPort.prepare();
393 
394  bool ok = true;
395 
396  ok = ok && genericStreamData(m_iThreeAxisGyroscopes, m_sensorMetadata.ThreeAxisGyroscopes,
397  streamingData.ThreeAxisGyroscopes.measurements,
400 
401  ok = ok && genericStreamData(m_iThreeAxisLinearAccelerometers, m_sensorMetadata.ThreeAxisLinearAccelerometers,
405 
406  ok = ok && genericStreamData(m_iThreeAxisMagnetometers, m_sensorMetadata.ThreeAxisMagnetometers,
407  streamingData.ThreeAxisMagnetometers.measurements,
410 
411  ok = ok && genericStreamData(m_iPositionSensors, m_sensorMetadata.PositionSensors,
412  streamingData.PositionSensors.measurements,
415 
416  ok = ok && genericStreamData(m_iOrientationSensors, m_sensorMetadata.OrientationSensors,
417  streamingData.OrientationSensors.measurements,
420 
421  ok = ok && genericStreamData(m_iTemperatureSensors, m_sensorMetadata.TemperatureSensors,
422  streamingData.TemperatureSensors.measurements,
425 
426  ok = ok && genericStreamData(m_iSixAxisForceTorqueSensors, m_sensorMetadata.SixAxisForceTorqueSensors,
430 
431  ok = ok && genericStreamData(m_iContactLoadCellArrays, m_sensorMetadata.ContactLoadCellArrays,
432  streamingData.ContactLoadCellArrays.measurements,
435 
436  ok = ok && genericStreamData(m_iEncoderArrays, m_sensorMetadata.EncoderArrays,
437  streamingData.EncoderArrays.measurements,
440 
441  ok = ok && genericStreamData(m_iSkinPatches, m_sensorMetadata.SkinPatches,
442  streamingData.SkinPatches.measurements,
445 
446  if (ok)
447  {
448  m_stamp.update();
449  m_streamingPort.setEnvelope(m_stamp);
450  m_streamingPort.write();
451  }
452  else
453  {
454  m_streamingPort.unprepare();
455  }
456 }
457 
459 {
460  return;
461 }
#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:31
std::vector< SensorMetadata > ContactLoadCellArrays
Definition: SensorRPCData.h:29
std::vector< SensorMetadata > EncoderArrays
Definition: SensorRPCData.h:30
std::vector< SensorMetadata > PositionSensors
Definition: SensorRPCData.h:32
std::vector< SensorMetadata > ThreeAxisGyroscopes
Definition: SensorRPCData.h:23
std::vector< SensorMetadata > ThreeAxisLinearAccelerometers
Definition: SensorRPCData.h:24
std::vector< SensorMetadata > ThreeAxisMagnetometers
Definition: SensorRPCData.h:25
std::vector< SensorMetadata > OrientationSensors
Definition: SensorRPCData.h:26
std::vector< SensorMetadata > SixAxisForceTorqueSensors
Definition: SensorRPCData.h:28
std::vector< SensorMetadata > TemperatureSensors
Definition: SensorRPCData.h:27
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:74
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:24
bool close() override
Close the DeviceDriver.
Definition: PolyDriver.cpp:173
bool open(const std::string &txt)
Construct and configure a device by its common name.
Definition: PolyDriver.cpp:140
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: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
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
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.
void update()
Set the timestamp to the current time, and increment the sequence number (wrapping to 0 if the sequen...
Definition: Stamp.cpp:124
virtual std::int32_t asInt32() const
Get 32-bit integer value.
Definition: Value.cpp:204
virtual bool isInt32() const
Checks if value is a 32-bit integer.
Definition: Value.cpp:132
virtual std::string asString() const
Get string value.
Definition: Value.cpp:234
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
Definition: Wire.h:29
void resize(size_t size) override
Resize the vector.
Definition: Vector.h:222
#define yCInfo(component,...)
Definition: LogComponent.h:132
#define yCError(component,...)
Definition: LogComponent.h:154
#define YARP_LOG_COMPONENT(name,...)
Definition: LogComponent.h:77
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_OK
The sensor is working correctly.