YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
MultipleAnalogSensorsClient.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
7
10
12
13namespace {
14YARP_LOG_COMPONENT(MULTIPLEANALOGSENSORSCLIENT, "yarp.device.multipleanalogsensorsclient")
15}
16
17using namespace yarp::dev;
18
26
28{
30 {
31 double now = yarp::os::Time::now();
33 {
35 "No data received in the last %lf seconds, timeout enabled.",
38 }
39 }
40}
41
43{
44 if (!parseParams(config)) { return false; }
45
46 m_streamingPort.timeoutInSeconds = m_timeout;
47
48 std::string localRPCPortName = m_local + "/rpc:i";
49 std::string localStreamingPortName = m_local + "/measures:i";
50 std::string remoteRPCPortName = m_remote + "/rpc:o";
51 std::string remoteStreamingPortName = m_remote + "/measures:o";
52
53 // TODO(traversaro) : as soon as the method for checking port names validity
54 // are available in YARP ( https://github.com/robotology/yarp/pull/1508 ) add some checks
55
56 // Open ports
57 bool ok = m_rpcPort.open(localRPCPortName);
58 if (!ok)
59 {
60 yCError(MULTIPLEANALOGSENSORSCLIENT,
61 "Failure to open the port %s.",
62 localRPCPortName.c_str());
63 close();
64 return false;
65 }
66
67 ok = m_streamingPort.open(localStreamingPortName);
68 m_streamingPort.useCallback();
69 if (!ok)
70 {
71 yCError(MULTIPLEANALOGSENSORSCLIENT,
72 "Failure to open the port %s.",
73 localStreamingPortName.c_str());
74 close();
75 return false;
76 }
77
78 // Connect ports
80 // RPC port needs to be tcp, therefore no carrier option is added here
81 ok = yarp::os::Network::connect(localRPCPortName, remoteRPCPortName);
82 if (!ok) {
83 yCError(MULTIPLEANALOGSENSORSCLIENT,
84 "Failure connecting port %s to %s.",
85 localRPCPortName.c_str(),
86 remoteRPCPortName.c_str());
87 yCError(MULTIPLEANALOGSENSORSCLIENT, "Check that the specified MultipleAnalogSensorsServer is up.");
88 close();
89 return false;
90 }
91
92 ok = yarp::os::Network::connect(remoteStreamingPortName, localStreamingPortName, m_carrier);
93 if (!ok) {
94 yCError(MULTIPLEANALOGSENSORSCLIENT,
95 "Failure connecting port %s to %s.",
96 remoteStreamingPortName.c_str(),
97 localStreamingPortName.c_str());
98 yCError(MULTIPLEANALOGSENSORSCLIENT, "Check that the specified MultipleAnalogSensorsServer is up.");
99 close();
100 return false;
101 }
102
103 // Once the connection is active, we just the metadata only once
104 ok = m_RPCInterface.yarp().attachAsClient(m_rpcPort);
105 if (!ok) {
106 yCError(MULTIPLEANALOGSENSORSCLIENT, "Failure opening Thrift-based RPC interface.");
107 return false;
108 }
109
110 // TODO(traversaro): there is a limitation on the thrift-generated
111 // YARP structures related to how to get connection errors during the call
112 // If this is ever solved at YARP level, we should properly handle errors
113 // here
114 m_sensorsMetadata = m_RPCInterface.getMetadata();
115
116 }
117
118 yCDebug(MULTIPLEANALOGSENSORSCLIENT,"Open complete");
119 return true;
120}
121
123{
124 m_streamingPort.close();
125 m_rpcPort.close();
126
127 yCDebug(MULTIPLEANALOGSENSORSCLIENT, "Close complete");
128 return true;
129}
130
131size_t MultipleAnalogSensorsClient::genericGetNrOfSensors(const std::vector<SensorMetadata>& metadataVector,
132 const yarp::dev::SensorMeasurements& measurementsVector) const
133{
135 return metadataVector.size();
136 } else {
137 std::lock_guard<std::mutex> guard(m_streamingPort.dataMutex);
138 m_streamingPort.updateTimeoutStatus();
139 if (m_streamingPort.status == yarp::dev::MAS_OK) {
140 return measurementsVector.measurements.size();
141 } else {
142 return 0;
143 }
144 }
145}
146
147yarp::dev::MAS_status MultipleAnalogSensorsClient::genericGetStatus() const
148{
149 std::lock_guard<std::mutex> guard(m_streamingPort.dataMutex);
150 m_streamingPort.updateTimeoutStatus();
151 return m_streamingPort.status;
152}
153
154ReturnValue MultipleAnalogSensorsClient::genericGetName(const std::vector<SensorMetadata>& metadataVector, const std::string& tag,
155 size_t sens_index, std::string& name) const
156{
158 yCError(MULTIPLEANALOGSENSORSCLIENT,
159 "Missing metadata, the device has been configured with the option"
160 "externalConnection set to true.");
162 }
163 if (sens_index >= metadataVector.size())
164 {
165 yCError(MULTIPLEANALOGSENSORSCLIENT,
166 "No sensor of type %s with index %lu (nr of sensors: %lu).",
167 tag.c_str(),
168 sens_index,
169 metadataVector.size());
171 }
172
173 name = metadataVector[sens_index].name;
174 return ReturnValue_ok;
175}
176
177ReturnValue MultipleAnalogSensorsClient::genericGetFrameName(const std::vector<SensorMetadata>& metadataVector, const std::string& tag,
178 size_t sens_index, std::string& frameName) const
179{
181 yCError(MULTIPLEANALOGSENSORSCLIENT,
182 "Missing metadata, the device has been configured with the option"
183 "externalConnection set to true.");
185 }
186 if (sens_index >= metadataVector.size())
187 {
188 yCError(MULTIPLEANALOGSENSORSCLIENT,
189 "No sensor of type %s with index %lu (nr of sensors: %lu).",
190 tag.c_str(),
191 sens_index,
192 metadataVector.size());
194 }
195
196 frameName = metadataVector[sens_index].frameName;
197 return ReturnValue_ok;
198}
199
200ReturnValue MultipleAnalogSensorsClient::genericGetMeasure(const std::vector<SensorMetadata>& metadataVector, const std::string& tag,
201 const yarp::dev::SensorMeasurements& measurementsVector,
202 size_t sens_index, yarp::sig::Vector& out, double& timestamp) const
203{
204
205 std::lock_guard<std::mutex> guard(m_streamingPort.dataMutex);
206 m_streamingPort.updateTimeoutStatus();
207 if (m_streamingPort.status != yarp::dev::MAS_OK)
208 {
209 yCError(MULTIPLEANALOGSENSORSCLIENT,
210 "Sensor of type %s with index %lu has non-MAS_OK status.",
211 tag.c_str(),
212 sens_index);
214 }
215
216 if (m_streamingPort.status != (sens_index >= measurementsVector.measurements.size()))
217 {
218 yCError(MULTIPLEANALOGSENSORSCLIENT,
219 "No sensor of type %s with index %lu (nr of sensors: %lu).",
220 tag.c_str(),
221 sens_index,
222 metadataVector.size());
224 }
225
227 assert(metadataVector.size() == measurementsVector.measurements.size());
228 }
229
230 timestamp = measurementsVector.measurements[sens_index].timestamp;
231 out = measurementsVector.measurements[sens_index].measurement;
232
233 return ReturnValue_ok;
234}
235
236size_t MultipleAnalogSensorsClient::genericGetSize(const std::vector<SensorMetadata>& metadataVector,
237 const std::string& tag, const yarp::dev::SensorMeasurements& measurementsVector, size_t sens_index) const
238{
239 std::lock_guard<std::mutex> guard(m_streamingPort.dataMutex);
240 if (m_streamingPort.status != yarp::dev::MAS_OK)
241 {
242 yCError(MULTIPLEANALOGSENSORSCLIENT, "No data received, no information on the size of the specified sensor.");
243 return 0;
244 }
245
246
247 if (sens_index >= measurementsVector.measurements.size())
248 {
249 yCError(MULTIPLEANALOGSENSORSCLIENT,
250 "No sensor of type %s with index %lu (nr of sensors: %lu).",
251 tag.c_str(),
252 sens_index,
253 metadataVector.size());
254 return 0;
255 }
256
257 return measurementsVector.measurements[sens_index].measurement.size();
258}
259
260/*
261All the sensor specific methods (excluding the IOrientationSensor and the ISkinPatches) are just
262an instantiation of the following template (note: we avoid code generation for the sake of readability):
263
264{{SensorTag}} : ThreeAxisGyroscopes, ThreeAxisLinearAccelerometers, etc
265{{SensorSingular}} : ThreeAxisGyroscope, ThreeAxisLinearAccelerometer, etc
266
267size_t MultipleAnalogSensorsClient::getNrOf{{SensorTag}}() const
268{
269 return genericGetNrOfSensors(m_sensorsMetadata.{{SensorTag}});
270}
271
272MAS_status MultipleAnalogSensorsClient::get{{SensorSingular}}Status(size_t sens_index) const
273{
274 return genericGetStatus();
275}
276
277bool MultipleAnalogSensorsClient::get{{SensorSingular}}Name(size_t sens_index, std::string& name) const
278{
279 return genericGetName(m_sensorsMetadata.{{SensorTag}}, "{{SensorTag}}", sens_index, name);
280}
281
282bool MultipleAnalogSensorsClient::get{{SensorSingular}}Measure(size_t sens_index, yarp::sig::Vector& out, double& timestamp) const
283{
284 return genericGetMeasure(m_sensorsMetadata.{{SensorTag}}, "{{SensorTag}}",
285 m_streamingPort.receivedData.{{SensorTag}}, sens_index, out, timestamp);
286}
287
288For the sensors (EncoderArray and SkinPatch) of which the measurements can change size, we also have:
289size_t MultipleAnalogSensorsClient::get{{SensorSingular}}Size(size_t sens_index) const
290{
291 return genericGetSize({{SensorTag}}, sens_index, m_i{{SensorTag}}, &I{{SensorTag}}::get{{SensorTag}}Size);
292}
293
294*/
295
297{
298 num = genericGetNrOfSensors(m_sensorsMetadata.ThreeAxisGyroscopes,
299 m_streamingPort.receivedData.ThreeAxisGyroscopes);
300 return ReturnValue_ok;
301}
302
304{
305 return genericGetStatus();
306}
307
309{
310 return genericGetName(m_sensorsMetadata.ThreeAxisGyroscopes, "ThreeAxisGyroscopes", sens_index, name);
311}
312
313ReturnValue MultipleAnalogSensorsClient::getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const
314{
315 return genericGetFrameName(m_sensorsMetadata.ThreeAxisGyroscopes, "ThreeAxisGyroscopes", sens_index, frameName);
316}
317
319{
320 return genericGetMeasure(m_sensorsMetadata.ThreeAxisGyroscopes, "ThreeAxisGyroscopes",
321 m_streamingPort.receivedData.ThreeAxisGyroscopes, sens_index, out, timestamp);
322}
323
325{
326 num = genericGetNrOfSensors(m_sensorsMetadata.ThreeAxisLinearAccelerometers,
328 return ReturnValue_ok;
329}
330
332{
333 return genericGetStatus();
334}
335
337{
338 return genericGetName(m_sensorsMetadata.ThreeAxisLinearAccelerometers, "ThreeAxisLinearAccelerometers", sens_index, name);
339}
340
342{
343 return genericGetFrameName(m_sensorsMetadata.ThreeAxisLinearAccelerometers, "ThreeAxisLinearAccelerometers", sens_index, frameName);
344}
345
347{
348 return genericGetMeasure(m_sensorsMetadata.ThreeAxisLinearAccelerometers, "ThreeAxisLinearAccelerometers",
349 m_streamingPort.receivedData.ThreeAxisLinearAccelerometers, sens_index, out, timestamp);
350}
351
353{
354 num = genericGetNrOfSensors(m_sensorsMetadata.ThreeAxisAngularAccelerometers,
356 return ReturnValue_ok;
357}
358
360{
361 return genericGetStatus();
362}
363
365{
366 return genericGetName(m_sensorsMetadata.ThreeAxisAngularAccelerometers, "ThreeAxisAngularAccelerometers", sens_index, name);
367}
368
370{
371 return genericGetFrameName(m_sensorsMetadata.ThreeAxisAngularAccelerometers, "ThreeAxisAngularAccelerometers", sens_index, frameName);
372}
373
375{
376 return genericGetMeasure(m_sensorsMetadata.ThreeAxisAngularAccelerometers, "ThreeAxisAngularAccelerometers",
377 m_streamingPort.receivedData.ThreeAxisAngularAccelerometers, sens_index, out, timestamp);
378}
379
381{
382 num = genericGetNrOfSensors(m_sensorsMetadata.ThreeAxisMagnetometers,
383 m_streamingPort.receivedData.ThreeAxisMagnetometers);
384 return ReturnValue_ok;
385}
386
388{
389 return genericGetStatus();
390}
391
393{
394 return genericGetName(m_sensorsMetadata.ThreeAxisMagnetometers, "ThreeAxisMagnetometers", sens_index, name);
395}
396
398{
399 return genericGetFrameName(m_sensorsMetadata.ThreeAxisMagnetometers, "ThreeAxisMagnetometers", sens_index, frameName);
400}
401
403{
404 return genericGetMeasure(m_sensorsMetadata.ThreeAxisMagnetometers, "ThreeAxisMagnetometers",
405 m_streamingPort.receivedData.ThreeAxisMagnetometers, sens_index, out, timestamp);
406}
407
409{
410 num = genericGetNrOfSensors(m_sensorsMetadata.OrientationSensors,
411 m_streamingPort.receivedData.OrientationSensors);
412 return ReturnValue_ok;
413}
414
416{
417 return genericGetStatus();
418}
419
421{
422 return genericGetName(m_sensorsMetadata.OrientationSensors, "OrientationSensors", sens_index, name);
423}
424
425ReturnValue MultipleAnalogSensorsClient::getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const
426{
427 return genericGetFrameName(m_sensorsMetadata.OrientationSensors, "OrientationSensors", sens_index, frameName);
428}
429
431{
432 return genericGetMeasure(m_sensorsMetadata.OrientationSensors, "OrientationSensors",
433 m_streamingPort.receivedData.OrientationSensors, sens_index, out, timestamp);
434}
435
437{
438 num = genericGetNrOfSensors(m_sensorsMetadata.PositionSensors,
439 m_streamingPort.receivedData.PositionSensors);
440 return ReturnValue_ok;
441}
442
444{
445 return genericGetStatus();
446}
447
448ReturnValue MultipleAnalogSensorsClient::getPositionSensorName(size_t sens_index, std::string& name) const
449{
450 return genericGetName(m_sensorsMetadata.PositionSensors, "PositionSensors", sens_index, name);
451}
452
453ReturnValue MultipleAnalogSensorsClient::getPositionSensorFrameName(size_t sens_index, std::string& frameName) const
454{
455 return genericGetFrameName(m_sensorsMetadata.PositionSensors, "PositionSensors", sens_index, frameName);
456}
457
459{
460 return genericGetMeasure(m_sensorsMetadata.PositionSensors, "PositionSensors", m_streamingPort.receivedData.PositionSensors, sens_index, out, timestamp);
461}
462
464{
465 num = genericGetNrOfSensors(m_sensorsMetadata.LinearVelocitySensors,
466 m_streamingPort.receivedData.LinearVelocitySensors);
467 return ReturnValue_ok;
468}
469
471{
472 return genericGetStatus();
473}
474
476{
477 return genericGetName(m_sensorsMetadata.LinearVelocitySensors, "LinearVelocitySensors", sens_index, name);
478}
479
481{
482 return genericGetFrameName(m_sensorsMetadata.LinearVelocitySensors, "LinearVelocitySensors", sens_index, frameName);
483}
484
486{
487 return genericGetMeasure(m_sensorsMetadata.LinearVelocitySensors, "LinearVelocitySensors", m_streamingPort.receivedData.LinearVelocitySensors, sens_index, out, timestamp);
488}
489
491{
492 num = genericGetNrOfSensors(m_sensorsMetadata.TemperatureSensors,
493 m_streamingPort.receivedData.TemperatureSensors);
494 return ReturnValue_ok;
495}
496
498{
499 return genericGetStatus();
500}
501
503{
504 return genericGetName(m_sensorsMetadata.TemperatureSensors, "TemperatureSensors", sens_index, name);
505}
506
507ReturnValue MultipleAnalogSensorsClient::getTemperatureSensorFrameName(size_t sens_index, std::string &frameName) const
508{
509 return genericGetFrameName(m_sensorsMetadata.TemperatureSensors, "TemperatureSensors", sens_index, frameName);
510}
511
513{
514 return genericGetMeasure(m_sensorsMetadata.TemperatureSensors, "TemperatureSensors",
515 m_streamingPort.receivedData.TemperatureSensors, sens_index, out, timestamp);
516}
517
518ReturnValue MultipleAnalogSensorsClient::getTemperatureSensorMeasure(size_t sens_index, double& out, double& timestamp) const
519{
520 yarp::sig::Vector dummy(1);
521 ReturnValue ok = this->getTemperatureSensorMeasure(sens_index, dummy, timestamp);
522 out = dummy[0];
523 return ok;
524}
525
527{
528 num = genericGetNrOfSensors(m_sensorsMetadata.SixAxisForceTorqueSensors,
530 return ReturnValue_ok;
531}
532
534{
535 return genericGetStatus();
536}
537
539{
540 return genericGetName(m_sensorsMetadata.SixAxisForceTorqueSensors, "SixAxisForceTorqueSensors", sens_index, name);
541}
542
544{
545 return genericGetFrameName(m_sensorsMetadata.SixAxisForceTorqueSensors, "SixAxisForceTorqueSensors", sens_index, frameName);
546}
547
549{
550 return genericGetMeasure(m_sensorsMetadata.SixAxisForceTorqueSensors, "SixAxisForceTorqueSensors",
551 m_streamingPort.receivedData.SixAxisForceTorqueSensors, sens_index, out, timestamp);
552}
553
555{
556 num = genericGetNrOfSensors(m_sensorsMetadata.ContactLoadCellArrays,
557 m_streamingPort.receivedData.ContactLoadCellArrays);
558 return ReturnValue_ok;
559}
560
562{
563 return genericGetStatus();
564}
565
567{
568 return genericGetName(m_sensorsMetadata.ContactLoadCellArrays, "ContactLoadCellArrays", sens_index, name);
569}
570
572{
573 return genericGetMeasure(m_sensorsMetadata.ContactLoadCellArrays, "ContactLoadCellArrays",
574 m_streamingPort.receivedData.ContactLoadCellArrays, sens_index, out, timestamp);
575}
576
578{
579 return genericGetSize(m_sensorsMetadata.ContactLoadCellArrays, "ContactLoadCellArrays",
580 m_streamingPort.receivedData.ContactLoadCellArrays, sens_index);
581}
582
584{
585 num = genericGetNrOfSensors(m_sensorsMetadata.EncoderArrays,
586 m_streamingPort.receivedData.EncoderArrays);
587 return ReturnValue_ok;
588}
589
591{
592 return genericGetStatus();
593}
594
595ReturnValue MultipleAnalogSensorsClient::getEncoderArrayName(size_t sens_index, std::string& name) const
596{
597 return genericGetName(m_sensorsMetadata.EncoderArrays, "EncoderArrays", sens_index, name);
598}
599
601{
602 return genericGetMeasure(m_sensorsMetadata.EncoderArrays, "EncoderArrays",
603 m_streamingPort.receivedData.EncoderArrays, sens_index, out, timestamp);
604}
605
607{
608 return genericGetSize(m_sensorsMetadata.EncoderArrays, "EncoderArrays",
609 m_streamingPort.receivedData.EncoderArrays, sens_index);
610}
611
613{
614 num = genericGetNrOfSensors(m_sensorsMetadata.SkinPatches,
615 m_streamingPort.receivedData.SkinPatches);
616 return ReturnValue_ok;
617}
618
620{
621 return genericGetStatus();
622}
623
624ReturnValue MultipleAnalogSensorsClient::getSkinPatchName(size_t sens_index, std::string& name) const
625{
626 return genericGetName(m_sensorsMetadata.SkinPatches, "SkinPatches", sens_index, name);
627}
628
630{
631 return genericGetMeasure(m_sensorsMetadata.SkinPatches, "SkinPatches",
632 m_streamingPort.receivedData.SkinPatches, sens_index, out, timestamp);
633}
634
636{
637 return genericGetSize(m_sensorsMetadata.SkinPatches, "SkinPatches",
638 m_streamingPort.receivedData.SkinPatches, sens_index);
639}
#define ReturnValue_ok
Definition ReturnValue.h:82
#define ReturnValue_error_method_failed
Definition ReturnValue.h:87
#define ReturnValue_error_not_ready
Definition ReturnValue.h:88
#define ReturnValue_error_input_out_of_bounds
Definition ReturnValue.h:89
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
yarp::dev::MAS_status getContactLoadCellArrayStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::MAS_status getPositionSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getThreeAxisGyroscopeMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the gyroscope.
yarp::dev::ReturnValue getOrientationSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getTemperatureSensorMeasure(size_t sens_index, double &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getThreeAxisGyroscopeName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::MAS_status getThreeAxisMagnetometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getNrOfThreeAxisMagnetometers(size_t &num) const override
Get the number of magnetometers exposed by this device.
yarp::dev::MAS_status getThreeAxisAngularAccelerometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::MAS_status getSixAxisForceTorqueSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getEncoderArrayMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getSixAxisForceTorqueSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getPositionSensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const override
Get the last reading of the position sensor as x y z.
yarp::dev::ReturnValue getTemperatureSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getOrientationSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getLinearVelocitySensorMeasure(size_t sens_index, yarp::sig::Vector &xyz, double &timestamp) const override
Get the last reading of the linear velocity sensor as x y z.
yarp::dev::ReturnValue getThreeAxisAngularAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getNrOfThreeAxisGyroscopes(size_t &num) const override
Get the number of three axis gyroscopes exposed by this sensor.
yarp::dev::ReturnValue getNrOfSixAxisForceTorqueSensors(size_t &num) const override
Get the number of six axis force torque sensors exposed by this device.
yarp::dev::ReturnValue getNrOfEncoderArrays(size_t &num) const override
Get the number of encoder arrays exposed by this device.
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::MAS_status getSkinPatchStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getSkinPatchName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getNrOfTemperatureSensors(size_t &num) const override
Get the number of temperature sensors exposed by this device.
yarp::dev::ReturnValue getThreeAxisAngularAccelerometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
size_t getEncoderArraySize(size_t sens_index) const override
Get the size of the specified encoder array.
yarp::dev::ReturnValue getThreeAxisMagnetometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getLinearVelocitySensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::MAS_status getThreeAxisGyroscopeStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getSixAxisForceTorqueSensorFrameName(size_t sens_index, std::string &frame) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getPositionSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getNrOfContactLoadCellArrays(size_t &num) const override
Get the number of contact load cell array exposed by this device.
yarp::dev::ReturnValue getNrOfOrientationSensors(size_t &num) const override
Get the number of orientation sensors exposed by this device.
yarp::dev::ReturnValue getTemperatureSensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getThreeAxisAngularAccelerometerFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
size_t getContactLoadCellArraySize(size_t sens_index) const override
Get the size of the specified contact load cell array.
yarp::dev::ReturnValue getSixAxisForceTorqueSensorMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
size_t getSkinPatchSize(size_t sens_index) const override
Get the size of the specified skin patch.
yarp::dev::MAS_status getLinearVelocitySensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getEncoderArrayName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getNrOfLinearVelocitySensors(size_t &num) const override
Get the number of linear velocity sensors exposed by this device.
yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::MAS_status getOrientationSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getThreeAxisMagnetometerName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getNrOfThreeAxisLinearAccelerometers(size_t &num) const override
Get the number of three axis linear accelerometers exposed by this device.
yarp::dev::ReturnValue getNrOfPositionSensors(size_t &num) const override
Get the number of position sensors exposed by this device.
yarp::dev::ReturnValue getSkinPatchMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::MAS_status getEncoderArrayStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getContactLoadCellArrayName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
yarp::dev::ReturnValue getNrOfThreeAxisAngularAccelerometers(size_t &num) const override
Get the number of three axis angular accelerometers exposed by this device.
yarp::dev::ReturnValue getThreeAxisGyroscopeFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getNrOfSkinPatches(size_t &num) const override
Get the number of skin patches exposed by this device.
yarp::dev::MAS_status getTemperatureSensorStatus(size_t sens_index) const override
Get the status of the specified sensor.
yarp::dev::ReturnValue getLinearVelocitySensorFrameName(size_t sens_index, std::string &frameName) const override
Get the name of the frame of the specified sensor.
yarp::dev::ReturnValue getThreeAxisMagnetometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getContactLoadCellArrayMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getThreeAxisLinearAccelerometerMeasure(size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
Get the last reading of the specified sensor.
yarp::dev::ReturnValue getOrientationSensorMeasureAsRollPitchYaw(size_t sens_index, yarp::sig::Vector &rpy, double &timestamp) const override
Get the last reading of the orientation sensor as roll pitch yaw.
yarp::dev::ReturnValue getPositionSensorName(size_t sens_index, std::string &name) const override
Get the name of the specified sensor.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
virtual SensorRPCData getMetadata()
Read the sensor metadata necessary to configure the MultipleAnalogSensorsClient device.
std::vector< SensorMetadata > SkinPatches
std::vector< SensorMetadata > ContactLoadCellArrays
std::vector< SensorMetadata > ThreeAxisAngularAccelerometers
std::vector< SensorMetadata > EncoderArrays
std::vector< SensorMetadata > PositionSensors
std::vector< SensorMetadata > ThreeAxisGyroscopes
std::vector< SensorMetadata > ThreeAxisLinearAccelerometers
std::vector< SensorMetadata > LinearVelocitySensors
std::vector< SensorMetadata > ThreeAxisMagnetometers
std::vector< SensorMetadata > OrientationSensors
std::vector< SensorMetadata > SixAxisForceTorqueSensors
std::vector< SensorMetadata > TemperatureSensors
yarp::dev::SensorStreamingData receivedData
void onRead(yarp::dev::SensorStreamingData &v) override
std::vector< SensorMeasurementData > measurements
SensorMeasurementsData ThreeAxisGyroscopes
SensorMeasurementsData OrientationSensors
SensorMeasurementsData PositionSensors
SensorMeasurementsData SkinPatches
SensorMeasurementsData LinearVelocitySensors
SensorMeasurementsData ThreeAxisMagnetometers
SensorMeasurementsData SixAxisForceTorqueSensors
SensorMeasurementsData ContactLoadCellArrays
SensorMeasurementsData TemperatureSensors
SensorMeasurementsData ThreeAxisLinearAccelerometers
SensorMeasurementsData EncoderArrays
SensorMeasurementsData ThreeAxisAngularAccelerometers
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
Definition Network.cpp:784
void close() override
Stop port activity.
Definition Port.cpp:330
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
Definition Port.cpp:79
A base class for nested structures that can be searched.
Definition Searchable.h:31
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
Definition Wire.h:28
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.
@ MAS_TIMEOUT
The sensor is read through the network, and the latest measurement was received before an implementat...
@ MAS_OK
The sensor is working correctly.
double now()
Return the current time in seconds, relative to an arbitrary starting point.
Definition Time.cpp:121