YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
realsense2Tracking Class Reference

#include </home/runner/work/yarp-documentation/yarp-documentation/yarp/opt-modules/yarp-device-realsense2/src/devices/realsense2/realsense2Tracking.h>

+ Inheritance diagram for realsense2Tracking:

Public Member Functions

 realsense2Tracking ()
 
 ~realsense2Tracking () override=default
 
bool open (yarp::os::Searchable &config) override
 Open the DeviceDriver.
 
bool close () override
 Close the DeviceDriver.
 
size_t getNrOfThreeAxisGyroscopes () const override
 Get the number of three axis gyroscopes exposed by this sensor.
 
yarp::dev::MAS_status getThreeAxisGyroscopeStatus (size_t sens_index) const override
 Get the status of the specified sensor.
 
bool getThreeAxisGyroscopeName (size_t sens_index, std::string &name) const override
 Get the name of the specified sensor.
 
bool getThreeAxisGyroscopeFrameName (size_t sens_index, std::string &frameName) const override
 Get the name of the frame of the specified sensor.
 
bool getThreeAxisGyroscopeMeasure (size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
 Get the last reading of the gyroscope.
 
size_t getNrOfThreeAxisLinearAccelerometers () const override
 Get the number of three axis linear accelerometers exposed by this device.
 
yarp::dev::MAS_status getThreeAxisLinearAccelerometerStatus (size_t sens_index) const override
 Get the status of the specified sensor.
 
bool getThreeAxisLinearAccelerometerName (size_t sens_index, std::string &name) const override
 Get the name of the specified sensor.
 
bool getThreeAxisLinearAccelerometerFrameName (size_t sens_index, std::string &frameName) const override
 Get the name of the frame of the specified sensor.
 
bool getThreeAxisLinearAccelerometerMeasure (size_t sens_index, yarp::sig::Vector &out, double &timestamp) const override
 Get the last reading of the specified sensor.
 
size_t getNrOfOrientationSensors () const override
 Get the number of orientation sensors exposed by this device.
 
yarp::dev::MAS_status getOrientationSensorStatus (size_t sens_index) const override
 Get the status of the specified sensor.
 
bool getOrientationSensorName (size_t sens_index, std::string &name) const override
 Get the name of the specified sensor.
 
bool getOrientationSensorFrameName (size_t sens_index, std::string &frameName) const override
 Get the name of the frame of the specified sensor.
 
bool 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.
 
size_t getNrOfPositionSensors () const override
 Get the number of position sensors exposed by this device.
 
yarp::dev::MAS_status getPositionSensorStatus (size_t sens_index) const override
 Get the status of the specified sensor.
 
bool getPositionSensorName (size_t sens_index, std::string &name) const override
 Get the name of the specified sensor.
 
bool getPositionSensorFrameName (size_t sens_index, std::string &frameName) const override
 Get the name of the frame of the specified sensor.
 
bool 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.
 
int read (yarp::sig::Vector &out) override
 Read a vector from the sensor.
 
int getState (int ch) override
 Check the state value of a given channel.
 
int getChannels () override
 Get the number of channels of the sensor.
 
int calibrateSensor () override
 Calibrates the whole sensor.
 
int calibrateSensor (const yarp::sig::Vector &value) override
 Calibrates the whole sensor, using an vector of calibration values.
 
int calibrateChannel (int ch) override
 Calibrates one single channel.
 
int calibrateChannel (int ch, double value) override
 Calibrates one single channel, using a calibration value.
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriveroperator= (const DeviceDriver &other)=delete
 
DeviceDriveroperator= (DeviceDriver &&other) noexcept=delete
 
virtual ~DeviceDriver ()
 
virtual std::string id () const
 Return the id assigned to the PolyDriver.
 
virtual void setId (const std::string &id)
 Set the id for this device.
 
template<class T >
bool view (T *&x)
 Get an interface to the device driver.
 
virtual DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others.
 
- Public Member Functions inherited from yarp::dev::IThreeAxisGyroscopes
virtual ~IThreeAxisGyroscopes ()
 
- Public Member Functions inherited from yarp::dev::IThreeAxisLinearAccelerometers
virtual ~IThreeAxisLinearAccelerometers ()
 
- Public Member Functions inherited from yarp::dev::IOrientationSensors
virtual ~IOrientationSensors ()
 
- Public Member Functions inherited from yarp::dev::IPositionSensors
virtual ~IPositionSensors ()
 
- Public Member Functions inherited from yarp::dev::IAnalogSensor
virtual ~IAnalogSensor ()
 

Protected Types

enum  timestamp_enumtype {
  yarp_timestamp =0 ,
  rs_timestamp
}
 

Protected Attributes

rs2_vector m_last_gyro
 
rs2_vector m_last_accel
 
rs2_pose m_last_pose
 
std::string m_inertial_sensor_name_prefix
 
const std::string m_accel_sensor_tag = "accelerations_sensor"
 
const std::string m_gyro_sensor_tag = "gyro_sensor"
 
const std::string m_orientation_sensor_tag = "orientation_sensor"
 
const std::string m_position_sensor_tag = "position_sensor"
 
const std::string m_pose_sensor_tag = "pose_sensor"
 
std::string m_gyroFrameName
 
std::string m_accelFrameName
 
std::string m_orientationFrameName
 
std::string m_positionFrameName
 
std::string m_poseFrameName
 
rs2::config m_cfg
 
std::mutex m_mutex
 
rs2::pipeline m_pipeline
 
rs2::pipeline_profile m_profile
 
std::string m_lastError
 
timestamp_enumtype m_timestamp_type
 

Additional Inherited Members

- Public Types inherited from yarp::dev::IAnalogSensor
enum  {
  AS_OK =0 ,
  AS_ERROR =1 ,
  AS_OVF =2 ,
  AS_TIMEOUT =3
}
 

Detailed Description

Definition at line 30 of file realsense2Tracking.h.

Member Enumeration Documentation

◆ timestamp_enumtype

Enumerator
yarp_timestamp 
rs_timestamp 

Definition at line 130 of file realsense2Tracking.h.

Constructor & Destructor Documentation

◆ realsense2Tracking()

realsense2Tracking::realsense2Tracking ( )

Definition at line 150 of file realsense2Tracking.cpp.

◆ ~realsense2Tracking()

realsense2Tracking::~realsense2Tracking ( )
overridedefault

Member Function Documentation

◆ calibrateChannel() [1/2]

int realsense2Tracking::calibrateChannel ( int  ch)
overridevirtual

Calibrates one single channel.

Parameters
chchannel number.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 505 of file realsense2Tracking.cpp.

◆ calibrateChannel() [2/2]

int realsense2Tracking::calibrateChannel ( int  ch,
double  value 
)
overridevirtual

Calibrates one single channel, using a calibration value.

Parameters
chchannel number.
valuecalibration value.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 510 of file realsense2Tracking.cpp.

◆ calibrateSensor() [1/2]

int realsense2Tracking::calibrateSensor ( )
overridevirtual

Calibrates the whole sensor.

Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 495 of file realsense2Tracking.cpp.

◆ calibrateSensor() [2/2]

int realsense2Tracking::calibrateSensor ( const yarp::sig::Vector value)
overridevirtual

Calibrates the whole sensor, using an vector of calibration values.

Parameters
valuea vector of calibration values.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 500 of file realsense2Tracking.cpp.

◆ close()

bool realsense2Tracking::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 223 of file realsense2Tracking.cpp.

◆ getChannels()

int realsense2Tracking::getChannels ( )
overridevirtual

Get the number of channels of the sensor.

Returns
number of channels (0 in case of errors).

Implements yarp::dev::IAnalogSensor.

Definition at line 490 of file realsense2Tracking.cpp.

◆ getNrOfOrientationSensors()

size_t realsense2Tracking::getNrOfOrientationSensors ( ) const
overridevirtual

Get the number of orientation sensors exposed by this device.

Implements yarp::dev::IOrientationSensors.

Definition at line 347 of file realsense2Tracking.cpp.

◆ getNrOfPositionSensors()

size_t realsense2Tracking::getNrOfPositionSensors ( ) const
overridevirtual

Get the number of position sensors exposed by this device.

Implements yarp::dev::IPositionSensors.

Definition at line 408 of file realsense2Tracking.cpp.

◆ getNrOfThreeAxisGyroscopes()

size_t realsense2Tracking::getNrOfThreeAxisGyroscopes ( ) const
overridevirtual

Get the number of three axis gyroscopes exposed by this sensor.

Implements yarp::dev::IThreeAxisGyroscopes.

Definition at line 231 of file realsense2Tracking.cpp.

◆ getNrOfThreeAxisLinearAccelerometers()

size_t realsense2Tracking::getNrOfThreeAxisLinearAccelerometers ( ) const
overridevirtual

Get the number of three axis linear accelerometers exposed by this device.

Implements yarp::dev::IThreeAxisLinearAccelerometers.

Definition at line 290 of file realsense2Tracking.cpp.

◆ getOrientationSensorFrameName()

bool realsense2Tracking::getOrientationSensorFrameName ( size_t  sens_index,
std::string &  frameName 
) const
overridevirtual

Get the name of the frame of the specified sensor.

Note
This is an implementation specific method, that may return the name of the sensor frame in a scenegraph
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IOrientationSensors.

Definition at line 365 of file realsense2Tracking.cpp.

◆ getOrientationSensorMeasureAsRollPitchYaw()

bool realsense2Tracking::getOrientationSensorMeasureAsRollPitchYaw ( size_t  sens_index,
yarp::sig::Vector rpy,
double timestamp 
) const
overridevirtual

Get the last reading of the orientation sensor as roll pitch yaw.

If $ f $ is the lab or surface fixed frame, and $ s $ is the sensor-fixed frame, this methods returns the angles $ r \in [-180, 180] , p \in [-90, 90], y \in [-180, 180]$ such that

\[
{}^f R_s = RotZ\left(\frac{\pi}{180}y\right)*RotY\left(\frac{\pi}{180}p\right)*RotX\left(\frac{\pi}{180}r\right)
\]

with

\[
RotZ(\theta)
 =
 \begin{bmatrix}
     \cos(\theta)      & -\sin(\theta) & 0              \\
     \sin(\theta)      & \cos(\theta)  & 0              \\
     0                 & 0             & 1              \\
 \end{bmatrix}
\]

,

\[
RotY(\theta)
=
 \begin{bmatrix}
     \cos(\theta)      & 0             & \sin(\theta)   \\
     0                 & 1             & 0              \\
     -\sin(\theta)     & 0             & \cos(\theta)   \\
 \end{bmatrix}
\]

and

\[
RotX(\theta)
=
 \begin{bmatrix}
     1 & 0             & 0              \\
     0 & \cos(\theta)  & - \sin(\theta) \\
     0 & \sin(\theta)  & \cos(\theta)   \\
 \end{bmatrix}
\]

where $ {}^f R_s \in \mathbb{R}^{3 \times 3} $ is the rotation that left-multiplied by a 3d column vector expressed in $ s $ it returns it expressed in $ f $ .

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfOrientationSensors()-1).
[out]outThe requested measure. The vector should be 3-dimensional. The measure is expressed in degrees .
[out]timestampThe timestamp of the requested measure, expressed in seconds.
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IOrientationSensors.

Definition at line 373 of file realsense2Tracking.cpp.

◆ getOrientationSensorName()

bool realsense2Tracking::getOrientationSensorName ( size_t  sens_index,
std::string &  name 
) const
overridevirtual

Get the name of the specified sensor.

Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IOrientationSensors.

Definition at line 358 of file realsense2Tracking.cpp.

◆ getOrientationSensorStatus()

yarp::dev::MAS_status realsense2Tracking::getOrientationSensorStatus ( size_t  sens_index) const
overridevirtual

Get the status of the specified sensor.

Implements yarp::dev::IOrientationSensors.

Definition at line 352 of file realsense2Tracking.cpp.

◆ getPositionSensorFrameName()

bool realsense2Tracking::getPositionSensorFrameName ( size_t  sens_index,
std::string &  frameName 
) const
overridevirtual

Get the name of the frame of the specified sensor.

Note
This is an implementation specific method, that may return the name of the sensor frame in a scenegraph
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IPositionSensors.

Definition at line 426 of file realsense2Tracking.cpp.

◆ getPositionSensorMeasure()

bool realsense2Tracking::getPositionSensorMeasure ( size_t  sens_index,
yarp::sig::Vector xyz,
double timestamp 
) const
overridevirtual

Get the last reading of the position sensor as x y z.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfPositionSensors()-1).
[out]outThe requested measure. The vector should be 3-dimensional. The measure is expressed in meters.
[out]timestampThe timestamp of the requested measure, expressed in seconds.
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IPositionSensors.

Definition at line 434 of file realsense2Tracking.cpp.

◆ getPositionSensorName()

bool realsense2Tracking::getPositionSensorName ( size_t  sens_index,
std::string &  name 
) const
overridevirtual

Get the name of the specified sensor.

Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IPositionSensors.

Definition at line 419 of file realsense2Tracking.cpp.

◆ getPositionSensorStatus()

yarp::dev::MAS_status realsense2Tracking::getPositionSensorStatus ( size_t  sens_index) const
overridevirtual

Get the status of the specified sensor.

Implements yarp::dev::IPositionSensors.

Definition at line 413 of file realsense2Tracking.cpp.

◆ getState()

int realsense2Tracking::getState ( int  ch)
overridevirtual

Check the state value of a given channel.

Parameters
chchannel number.
Returns
status.

Implements yarp::dev::IAnalogSensor.

Definition at line 484 of file realsense2Tracking.cpp.

◆ getThreeAxisGyroscopeFrameName()

bool realsense2Tracking::getThreeAxisGyroscopeFrameName ( size_t  sens_index,
std::string &  frameName 
) const
overridevirtual

Get the name of the frame of the specified sensor.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfThreeAxisGyroscopes()-1).
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisGyroscopes.

Definition at line 249 of file realsense2Tracking.cpp.

◆ getThreeAxisGyroscopeMeasure()

bool realsense2Tracking::getThreeAxisGyroscopeMeasure ( size_t  sens_index,
yarp::sig::Vector out,
double timestamp 
) const
overridevirtual

Get the last reading of the gyroscope.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfThreeAxisGyroscopes()-1).
[out]outThe requested measure. The vector should be 3-dimensional. The measure is expressed in degrees/seconds.
[out]timestampThe timestamp of the requested measure, expressed in seconds.
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisGyroscopes.

Definition at line 256 of file realsense2Tracking.cpp.

◆ getThreeAxisGyroscopeName()

bool realsense2Tracking::getThreeAxisGyroscopeName ( size_t  sens_index,
std::string &  name 
) const
overridevirtual

Get the name of the specified sensor.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfThreeAxisGyroscopes()-1).
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisGyroscopes.

Definition at line 242 of file realsense2Tracking.cpp.

◆ getThreeAxisGyroscopeStatus()

yarp::dev::MAS_status realsense2Tracking::getThreeAxisGyroscopeStatus ( size_t  sens_index) const
overridevirtual

Get the status of the specified sensor.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfThreeAxisGyroscopes()-1).

Implements yarp::dev::IThreeAxisGyroscopes.

Definition at line 236 of file realsense2Tracking.cpp.

◆ getThreeAxisLinearAccelerometerFrameName()

bool realsense2Tracking::getThreeAxisLinearAccelerometerFrameName ( size_t  sens_index,
std::string &  frameName 
) const
overridevirtual

Get the name of the frame of the specified sensor.

Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisLinearAccelerometers.

Definition at line 308 of file realsense2Tracking.cpp.

◆ getThreeAxisLinearAccelerometerMeasure()

bool realsense2Tracking::getThreeAxisLinearAccelerometerMeasure ( size_t  sens_index,
yarp::sig::Vector out,
double timestamp 
) const
overridevirtual

Get the last reading of the specified sensor.

Parameters
[in]sens_indexThe index of the specified sensor (should be between 0 and getNrOfThreeAxisLinearAccelerometers()-1).
[out]outThe requested measure. The vector should be 3-dimensional. The measure is expressed in meters^2/seconds.
[out]timestampThe timestamp of the requested measure, expressed in seconds.
Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisLinearAccelerometers.

Definition at line 315 of file realsense2Tracking.cpp.

◆ getThreeAxisLinearAccelerometerName()

bool realsense2Tracking::getThreeAxisLinearAccelerometerName ( size_t  sens_index,
std::string &  name 
) const
overridevirtual

Get the name of the specified sensor.

Returns
false if an error occurred, true otherwise.

Implements yarp::dev::IThreeAxisLinearAccelerometers.

Definition at line 301 of file realsense2Tracking.cpp.

◆ getThreeAxisLinearAccelerometerStatus()

yarp::dev::MAS_status realsense2Tracking::getThreeAxisLinearAccelerometerStatus ( size_t  sens_index) const
overridevirtual

Get the status of the specified sensor.

Implements yarp::dev::IThreeAxisLinearAccelerometers.

Definition at line 295 of file realsense2Tracking.cpp.

◆ open()

bool realsense2Tracking::open ( yarp::os::Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 189 of file realsense2Tracking.cpp.

◆ read()

int realsense2Tracking::read ( yarp::sig::Vector out)
overridevirtual

Read a vector from the sensor.

Parameters
outa vector containing the sensor's last readings.
Returns
AS_OK or return code. AS_TIMEOUT if the sensor timed-out.

Implements yarp::dev::IAnalogSensor.

Definition at line 463 of file realsense2Tracking.cpp.

Member Data Documentation

◆ m_accel_sensor_tag

const std::string realsense2Tracking::m_accel_sensor_tag = "accelerations_sensor"
protected

Definition at line 114 of file realsense2Tracking.h.

◆ m_accelFrameName

std::string realsense2Tracking::m_accelFrameName
protected

Definition at line 120 of file realsense2Tracking.h.

◆ m_cfg

rs2::config realsense2Tracking::m_cfg
protected

Definition at line 125 of file realsense2Tracking.h.

◆ m_gyro_sensor_tag

const std::string realsense2Tracking::m_gyro_sensor_tag = "gyro_sensor"
protected

Definition at line 115 of file realsense2Tracking.h.

◆ m_gyroFrameName

std::string realsense2Tracking::m_gyroFrameName
protected

Definition at line 119 of file realsense2Tracking.h.

◆ m_inertial_sensor_name_prefix

std::string realsense2Tracking::m_inertial_sensor_name_prefix
protected

Definition at line 113 of file realsense2Tracking.h.

◆ m_last_accel

rs2_vector realsense2Tracking::m_last_accel
mutableprotected

Definition at line 109 of file realsense2Tracking.h.

◆ m_last_gyro

rs2_vector realsense2Tracking::m_last_gyro
mutableprotected

Definition at line 108 of file realsense2Tracking.h.

◆ m_last_pose

rs2_pose realsense2Tracking::m_last_pose
mutableprotected

Definition at line 110 of file realsense2Tracking.h.

◆ m_lastError

std::string realsense2Tracking::m_lastError
mutableprotected

Definition at line 129 of file realsense2Tracking.h.

◆ m_mutex

std::mutex realsense2Tracking::m_mutex
mutableprotected

Definition at line 126 of file realsense2Tracking.h.

◆ m_orientation_sensor_tag

const std::string realsense2Tracking::m_orientation_sensor_tag = "orientation_sensor"
protected

Definition at line 116 of file realsense2Tracking.h.

◆ m_orientationFrameName

std::string realsense2Tracking::m_orientationFrameName
protected

Definition at line 121 of file realsense2Tracking.h.

◆ m_pipeline

rs2::pipeline realsense2Tracking::m_pipeline
protected

Definition at line 127 of file realsense2Tracking.h.

◆ m_pose_sensor_tag

const std::string realsense2Tracking::m_pose_sensor_tag = "pose_sensor"
protected

Definition at line 118 of file realsense2Tracking.h.

◆ m_poseFrameName

std::string realsense2Tracking::m_poseFrameName
protected

Definition at line 123 of file realsense2Tracking.h.

◆ m_position_sensor_tag

const std::string realsense2Tracking::m_position_sensor_tag = "position_sensor"
protected

Definition at line 117 of file realsense2Tracking.h.

◆ m_positionFrameName

std::string realsense2Tracking::m_positionFrameName
protected

Definition at line 122 of file realsense2Tracking.h.

◆ m_profile

rs2::pipeline_profile realsense2Tracking::m_profile
protected

Definition at line 128 of file realsense2Tracking.h.

◆ m_timestamp_type

timestamp_enumtype realsense2Tracking::m_timestamp_type
protected

Definition at line 131 of file realsense2Tracking.h.


The documentation for this class was generated from the following files: