YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
MultipleAnalogSensorsServer.h
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
7#ifndef YARP_DEV_MULTIPLEANALOGSENSORSSERVER_MULTIPLEANALOGSENSORSSERVER_H
8#define YARP_DEV_MULTIPLEANALOGSENSORSSERVER_MULTIPLEANALOGSENSORSSERVER_H
9
11#include <yarp/os/Stamp.h>
13#include <yarp/dev/PolyDriver.h>
17
18// Thrift-generated classes
21
23
40{
41 double m_periodInS{0.01};
42 yarp::os::Stamp m_stamp;
43 std::string m_streamingPortName;
44 std::string m_RPCPortName;
46 yarp::os::Port m_rpcPort;
47 // Generic vector buffer
48 yarp::sig::Vector m_buffer;
49
50 // Interface of the wrapped device
51 yarp::dev::IThreeAxisGyroscopes* m_iThreeAxisGyroscopes{nullptr};
52 yarp::dev::IThreeAxisLinearAccelerometers* m_iThreeAxisLinearAccelerometers{nullptr};
53 yarp::dev::IThreeAxisAngularAccelerometers* m_iThreeAxisAngularAccelerometers{nullptr};
54 yarp::dev::IThreeAxisMagnetometers* m_iThreeAxisMagnetometers{nullptr};
55 yarp::dev::IPositionSensors* m_iPositionSensors{nullptr};
56 yarp::dev::ILinearVelocitySensors* m_iLinearVelocitySensors{nullptr};
57 yarp::dev::IOrientationSensors* m_iOrientationSensors{nullptr};
58 yarp::dev::ITemperatureSensors* m_iTemperatureSensors{nullptr};
59 yarp::dev::ISixAxisForceTorqueSensors* m_iSixAxisForceTorqueSensors{nullptr};
60 yarp::dev::IContactLoadCellArrays* m_iContactLoadCellArrays{nullptr};
61 yarp::dev::IEncoderArrays* m_iEncoderArrays{nullptr};
62 yarp::dev::ISkinPatches* m_iSkinPatches{nullptr};
63
64 // Metadata to be server via the RPC port
65 SensorRPCData m_sensorMetadata;
66 yarp::dev::ReturnValue populateAllSensorsMetadata();
67
68 template<typename Interface>
69 yarp::dev::ReturnValue populateSensorsMetadata(Interface * wrappedDeviceInterface,
70 std::vector<SensorMetadata>& metadataVector, const std::string& tag,
71 yarp::dev::ReturnValue (Interface::*getNrOfSensorsMethodPtr)(size_t&) const,
72 yarp::dev::ReturnValue (Interface::*getNameMethodPtr)(size_t, std::string&) const,
73 yarp::dev::ReturnValue (Interface::*getFrameNameMethodPtr)(size_t, std::string&) const);
74 template<typename Interface>
75 yarp::dev::ReturnValue populateSensorsMetadataNoFrameName(Interface * wrappedDeviceInterface,
76 std::vector<SensorMetadata>& metadataVector, const std::string& tag,
77 yarp::dev::ReturnValue (Interface::*getNrOfSensorsMethodPtr)(size_t&) const,
78 yarp::dev::ReturnValue (Interface::*getNameMethodPtr)(size_t, std::string&) const);
79
80
81 // Helper methods to resize measure buffers
82 template<typename Interface>
83 bool resizeMeasureVectors(Interface* wrappedDeviceInterface,
84 const std::vector< SensorMetadata >& metadataVector,
85 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
86 size_t (Interface::*getMeasureSizePtr)(size_t) const);
87 template<typename Interface>
88 bool resizeMeasureVectors(Interface* wrappedDeviceInterface,
89 const std::vector< SensorMetadata >& metadataVector,
90 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
91 size_t measureSize);
92 bool resizeAllMeasureVectors( yarp::dev::SensorStreamingData& streamingData);
93
94
95 // Helper method used to copy the sensor measure to the measure buffers
96 template<typename Interface>
97 bool genericStreamData(Interface* wrappedDeviceInterface,
98 const std::vector< SensorMetadata >& metadataVector,
99 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
100 yarp::dev::MAS_status (Interface::*getStatusMethodPtr)(size_t) const,
101 yarp::dev::ReturnValue (Interface::*getMeasureMethodPtr)(size_t, yarp::sig::Vector&, double&) const,
102 const char* sensorType);
103
104
105public:
108
109 /* DevideDriver methods */
110 bool open(yarp::os::Searchable &params) override;
111 bool close() override;
112
113 /* IWrapper methods */
114 bool attach(yarp::dev::PolyDriver* p) override;
115 bool detach() override;
116
117 /* RateThread methods */
118 void threadRelease() override;
119 void run() override;
120
121 /* MultipleAnalogSensorsMetadata */
122 SensorRPCData getMetadata() override;
123};
124
125#endif
This class is the parameters parser for class MultipleAnalogSensorsServer.
multipleanalogsensorsserver: The server side of the MultipleAnalogSensorsClient, useful to expose dev...
bool detach() override
Detach the object (you must have first called attach).
SensorRPCData getMetadata() override
Read the sensor metadata necessary to configure the MultipleAnalogSensorsClient device.
void threadRelease() override
Release method.
bool close() override
Close the DeviceDriver.
bool attach(yarp::dev::PolyDriver *p) override
Attach to another object.
bool open(yarp::os::Searchable &params) override
Open the DeviceDriver.
Interface implemented by all device drivers.
Device interface to one or multiple contact load cell arrays.
Device interface to one or multiple arrays of encoders.
Device interface to one or multiple orientation sensors, such as IMUs with on board estimation algori...
Device interface to one or multiple position sensors, such as UWB localization sensors.
Device interface to one or multiple six axis force torque sensor.
Device interface to one or more groups (patches) of tactile sensors (skin).
Device interface to one or multiple temperature sensors.
Device interface to one or multiple three axis gyroscopes.
Device interface to one or multiple three axis linear accelerometers.
Device interface to one or multiple three axis magnetometers.
A container for a device driver.
Definition PolyDriver.h:23
Helper interface for an object that can wrap/or "attach" to a single other device.
A mini-server for performing network communication in the background.
An abstraction for a periodic thread.
A mini-server for network communication.
Definition Port.h:46
A base class for nested structures that can be searched.
Definition Searchable.h:31
An abstraction for a time stamp and/or sequence number.
Definition Stamp.h:18
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.