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>
16
17// 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 bool populateAllSensorsMetadata();
67 template<typename Interface>
68 bool populateSensorsMetadata(Interface * wrappedDeviceInterface,
69 std::vector<SensorMetadata>& metadataVector, const std::string& tag,
70 size_t (Interface::*getNrOfSensorsMethodPtr)() const,
71 bool (Interface::*getNameMethodPtr)(size_t, std::string&) const,
72 bool (Interface::*getFrameNameMethodPtr)(size_t, std::string&) const);
73 template<typename Interface>
74 bool populateSensorsMetadataNoFrameName(Interface * wrappedDeviceInterface,
75 std::vector<SensorMetadata>& metadataVector, const std::string& tag,
76 size_t (Interface::*getNrOfSensorsMethodPtr)() const,
77 bool (Interface::*getNameMethodPtr)(size_t, std::string&) const);
78
79
80 // Helper methods to resize measure buffers
81 template<typename Interface>
82 bool resizeMeasureVectors(Interface* wrappedDeviceInterface,
83 const std::vector< SensorMetadata >& metadataVector,
84 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
85 size_t (Interface::*getMeasureSizePtr)(size_t) const);
86 template<typename Interface>
87 bool resizeMeasureVectors(Interface* wrappedDeviceInterface,
88 const std::vector< SensorMetadata >& metadataVector,
89 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
90 size_t measureSize);
91 bool resizeAllMeasureVectors( yarp::dev::SensorStreamingData& streamingData);
92
93
94 // Helper method used to copy the sensor measure to the measure buffers
95 template<typename Interface>
96 bool genericStreamData(Interface* wrappedDeviceInterface,
97 const std::vector< SensorMetadata >& metadataVector,
98 std::vector< typename yarp::dev::SensorMeasurement >& streamingDataVector,
99 yarp::dev::MAS_status (Interface::*getStatusMethodPtr)(size_t) const,
100 bool (Interface::*getMeasureMethodPtr)(size_t, yarp::sig::Vector&, double&) const,
101 const char* sensorType);
102
103
104public:
107
108 /* DevideDriver methods */
109 bool open(yarp::os::Searchable &params) override;
110 bool close() override;
111
112 /* IWrapper methods */
113 bool attach(yarp::dev::PolyDriver* p) override;
114 bool detach() override;
115
116 /* RateThread methods */
117 void threadRelease() override;
118 void run() override;
119
120 /* MultipleAnalogSensorsMetadata */
121 SensorRPCData getMetadata() override;
122};
123
124#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:21
MAS_status
Status of a given analog sensor exposed by a multiple analog sensors interface.