Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Sensor Class Reference

Information about an SDF sensor. More...

#include <Sensor.hh>

Public Member Functions

 Sensor ()
 Default constructor. More...
 
void AddPlugin (const Plugin &_plugin)
 Add a plugin to this object. More...
 
AirPressureAirPressureSensor ()
 Get a mutable air pressure sensor, or nullptr if this sensor type is not an AirPressure sensor. More...
 
const AirPressureAirPressureSensor () const
 Get the air pressure sensor, or nullptr if this sensor type is not an AirPressure sensor. More...
 
AirSpeedAirSpeedSensor ()
 Get a mutable air speed sensor, or nullptr if this sensor type is not an AirSpeed sensor. More...
 
const AirSpeedAirSpeedSensor () const
 Get the air speed sensor, or nullptr if this sensor type is not an AirSpeed sensor. More...
 
AltimeterAltimeterSensor ()
 Get a mutable altimeter sensor, or nullptr if this sensor type is not an Altimeter. More...
 
const AltimeterAltimeterSensor () const
 Get the altimeter sensor, or nullptr if this sensor type is not an Altimeter. More...
 
CameraCameraSensor ()
 Get a mutable camera sensor, or nullptr if the sensor does not contain a camera sensor. More...
 
const CameraCameraSensor () const
 Get a pointer to a camera sensor, or nullptr if the sensor does not contain a camera sensor. More...
 
void ClearPlugins ()
 Remove all plugins. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
bool EnableMetrics () const
 Get flag state for enabling performance metrics publication. More...
 
ForceTorqueForceTorqueSensor ()
 Get a mutable force torque sensor, or nullptr if the sensor does not contain a force torque sensor. More...
 
const ForceTorqueForceTorqueSensor () const
 Get a pointer to a force torque sensor, or nullptr if the sensor does not contain a force torque sensor. More...
 
ImuImuSensor ()
 Get a mutable IMU sensor, or nullptr if the sensor does not contain an IMU sensor. More...
 
const ImuImuSensor () const
 Get a pointer to an IMU sensor, or nullptr if the sensor does not contain an IMU sensor. More...
 
LidarLidarSensor ()
 Get a mutable lidar sensor, or nullptr if this sensor type is not a Lidar. More...
 
const LidarLidarSensor () const
 Get the lidar sensor, or nullptr if this sensor type is not a Lidar. More...
 
Errors Load (ElementPtr _sdf)
 Load the sensor based on a element pointer. More...
 
MagnetometerMagnetometerSensor ()
 Get a mutable magnetometer sensor, or nullptr if this sensor type is not a Magnetometer. More...
 
const MagnetometerMagnetometerSensor () const
 Get the magnetometer sensor, or nullptr if this sensor type is not a Magnetometer. More...
 
std::string Name () const
 Get the name of the sensor. More...
 
NavSatNavSatSensor ()
 Get a mutable NAVSAT sensor, or nullptr if the sensor does not contain an NAVSAT sensor. More...
 
const NavSatNavSatSensor () const
 Get a pointer to a NAVSAT sensor, or nullptr if the sensor does not contain an NAVSAT sensor. More...
 
bool operator!= (const Sensor &_sensor) const
 Return true this Sensor object does not contain the same values as the passed in parameter. More...
 
bool operator== (const Sensor &_sensor) const
 Return true if both Sensor objects contain the same values. More...
 
sdf::PluginsPlugins ()
 Get a mutable vector of plugins attached to this object. More...
 
const sdf::PluginsPlugins () const
 Get the plugins attached to this object. More...
 
const std::string & PoseRelativeTo () const
 Get the name of the coordinate frame relative to which this object's pose is expressed. More...
 
const gz::math::Pose3d & RawPose () const
 Get the pose of the sensor. More...
 
sdf::SemanticPose SemanticPose () const
 Get SemanticPose object of this object to aid in resolving poses. More...
 
void SetAirPressureSensor (const AirPressure &_air)
 Set the air pressure sensor. More...
 
void SetAirSpeedSensor (const AirSpeed &_air)
 Set the air pressure sensor. More...
 
void SetAltimeterSensor (const Altimeter &_alt)
 Set the altimeter sensor. More...
 
void SetCameraSensor (const Camera &_cam)
 Set the camera sensor. More...
 
void SetEnableMetrics (bool _enableMetrics)
 Set flag to enable publishing performance metrics. More...
 
void SetForceTorqueSensor (const ForceTorque &_ft)
 Set the force torque sensor. More...
 
void SetImuSensor (const Imu &_imu)
 Set the IMU sensor. More...
 
void SetLidarSensor (const Lidar &_lidar)
 Set the lidar sensor. More...
 
void SetMagnetometerSensor (const Magnetometer &_mag)
 Set the magnetometer sensor. More...
 
void SetName (const std::string &_name)
 Set the name of the sensor. More...
 
void SetNavSatSensor (const NavSat &_navsat)
 Set the NAVSAT sensor. More...
 
void SetPoseRelativeTo (const std::string &_frame)
 Set the name of the coordinate frame relative to which this object's pose is expressed. More...
 
void SetRawPose (const gz::math::Pose3d &_pose)
 Set the pose of the sensor. More...
 
void SetTopic (const std::string &_topic)
 Set the topic on which sensor data should be published. More...
 
void SetType (const SensorType _type)
 Set the sensor type. More...
 
bool SetType (const std::string &_typeStr)
 Set the sensor type from a string. More...
 
void SetUpdateRate (double _hz)
 Set the update rate. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this sensor. More...
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this sensor. More...
 
std::string Topic () const
 Get the topic on which sensor data should be published. More...
 
SensorType Type () const
 Get the sensor type. More...
 
std::string TypeStr () const
 Get the sensor type as a string. More...
 
double UpdateRate () const
 Get the update rate in Hz. More...
 

Detailed Description

Information about an SDF sensor.

Constructor & Destructor Documentation

◆ Sensor()

sdf::SDF_VERSION_NAMESPACE::Sensor::Sensor ( )

Default constructor.

Member Function Documentation

◆ AddPlugin()

void sdf::SDF_VERSION_NAMESPACE::Sensor::AddPlugin ( const Plugin _plugin)

Add a plugin to this object.

Parameters
[in]_pluginPlugin to add.

◆ AirPressureSensor() [1/2]

AirPressure* sdf::SDF_VERSION_NAMESPACE::Sensor::AirPressureSensor ( )

Get a mutable air pressure sensor, or nullptr if this sensor type is not an AirPressure sensor.

Returns
Pointer to the AirPressure sensor, or nullptr if this Sensor is not a AirPressure sensor.
See also
SensorType Type() const

◆ AirPressureSensor() [2/2]

const AirPressure* sdf::SDF_VERSION_NAMESPACE::Sensor::AirPressureSensor ( ) const

Get the air pressure sensor, or nullptr if this sensor type is not an AirPressure sensor.

Returns
Pointer to the AirPressure sensor, or nullptr if this Sensor is not a AirPressure sensor.
See also
SensorType Type() const

◆ AirSpeedSensor() [1/2]

AirSpeed* sdf::SDF_VERSION_NAMESPACE::Sensor::AirSpeedSensor ( )

Get a mutable air speed sensor, or nullptr if this sensor type is not an AirSpeed sensor.

Returns
Pointer to the AirSpeed sensor, or nullptr if this Sensor is not a AirSpeed sensor.
See also
SensorType Type() const

◆ AirSpeedSensor() [2/2]

const AirSpeed* sdf::SDF_VERSION_NAMESPACE::Sensor::AirSpeedSensor ( ) const

Get the air speed sensor, or nullptr if this sensor type is not an AirSpeed sensor.

Returns
Pointer to the AirSpeed sensor, or nullptr if this Sensor is not a AirSpeed sensor.
See also
SensorType Type() const

◆ AltimeterSensor() [1/2]

Altimeter* sdf::SDF_VERSION_NAMESPACE::Sensor::AltimeterSensor ( )

Get a mutable altimeter sensor, or nullptr if this sensor type is not an Altimeter.

Returns
Pointer to the Altimeter sensor, or nullptr if this Sensor is not a Altimeter.
See also
SensorType Type() const

◆ AltimeterSensor() [2/2]

const Altimeter* sdf::SDF_VERSION_NAMESPACE::Sensor::AltimeterSensor ( ) const

Get the altimeter sensor, or nullptr if this sensor type is not an Altimeter.

Returns
Pointer to the Altimeter sensor, or nullptr if this Sensor is not a Altimeter.
See also
SensorType Type() const

◆ CameraSensor() [1/2]

Camera* sdf::SDF_VERSION_NAMESPACE::Sensor::CameraSensor ( )

Get a mutable camera sensor, or nullptr if the sensor does not contain a camera sensor.

Returns
Pointer to the sensor's camera, or nullptr if the sensor is not a camera.
See also
SensorType Type() const

◆ CameraSensor() [2/2]

const Camera* sdf::SDF_VERSION_NAMESPACE::Sensor::CameraSensor ( ) const

Get a pointer to a camera sensor, or nullptr if the sensor does not contain a camera sensor.

Returns
Pointer to the sensor's camera, or nullptr if the sensor is not a camera.
See also
SensorType Type() const

◆ ClearPlugins()

void sdf::SDF_VERSION_NAMESPACE::Sensor::ClearPlugins ( )

Remove all plugins.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Sensor::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ EnableMetrics()

bool sdf::SDF_VERSION_NAMESPACE::Sensor::EnableMetrics ( ) const

Get flag state for enabling performance metrics publication.

Returns
True if performance metrics are enabled, false otherwise.

◆ ForceTorqueSensor() [1/2]

ForceTorque* sdf::SDF_VERSION_NAMESPACE::Sensor::ForceTorqueSensor ( )

Get a mutable force torque sensor, or nullptr if the sensor does not contain a force torque sensor.

Returns
Pointer to the force torque sensor, or nullptr if the sensor is not a force torque sensor.
See also
SensorType Type() const

◆ ForceTorqueSensor() [2/2]

const ForceTorque* sdf::SDF_VERSION_NAMESPACE::Sensor::ForceTorqueSensor ( ) const

Get a pointer to a force torque sensor, or nullptr if the sensor does not contain a force torque sensor.

Returns
Pointer to the force torque sensor, or nullptr if the sensor is not a force torque sensor.
See also
SensorType Type() const

◆ ImuSensor() [1/2]

Imu* sdf::SDF_VERSION_NAMESPACE::Sensor::ImuSensor ( )

Get a mutable IMU sensor, or nullptr if the sensor does not contain an IMU sensor.

Returns
Pointer to the sensor's IMU, or nullptr if the sensor is not an IMU.
See also
SensorType Type() const

◆ ImuSensor() [2/2]

const Imu* sdf::SDF_VERSION_NAMESPACE::Sensor::ImuSensor ( ) const

Get a pointer to an IMU sensor, or nullptr if the sensor does not contain an IMU sensor.

Returns
Pointer to the sensor's IMU, or nullptr if the sensor is not an IMU.
See also
SensorType Type() const

◆ LidarSensor() [1/2]

Lidar* sdf::SDF_VERSION_NAMESPACE::Sensor::LidarSensor ( )

Get a mutable lidar sensor, or nullptr if this sensor type is not a Lidar.

Returns
Pointer to the Lidar sensor, or nullptr if this Sensor is not a Lidar.
See also
SensorType Type() const

◆ LidarSensor() [2/2]

const Lidar* sdf::SDF_VERSION_NAMESPACE::Sensor::LidarSensor ( ) const

Get the lidar sensor, or nullptr if this sensor type is not a Lidar.

Returns
Pointer to the Lidar sensor, or nullptr if this Sensor is not a Lidar.
See also
SensorType Type() const

◆ Load()

Errors sdf::SDF_VERSION_NAMESPACE::Sensor::Load ( ElementPtr  _sdf)

Load the sensor based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ MagnetometerSensor() [1/2]

Magnetometer* sdf::SDF_VERSION_NAMESPACE::Sensor::MagnetometerSensor ( )

Get a mutable magnetometer sensor, or nullptr if this sensor type is not a Magnetometer.

Returns
Pointer to the Magnetometer sensor, or nullptr if this Sensor is not a Magnetometer.
See also
SensorType Type() const

◆ MagnetometerSensor() [2/2]

const Magnetometer* sdf::SDF_VERSION_NAMESPACE::Sensor::MagnetometerSensor ( ) const

Get the magnetometer sensor, or nullptr if this sensor type is not a Magnetometer.

Returns
Pointer to the Magnetometer sensor, or nullptr if this Sensor is not a Magnetometer.
See also
SensorType Type() const

◆ Name()

std::string sdf::SDF_VERSION_NAMESPACE::Sensor::Name ( ) const

Get the name of the sensor.

The name of the sensor should be unique within the scope of a World.

Returns
Name of the sensor.

◆ NavSatSensor() [1/2]

NavSat* sdf::SDF_VERSION_NAMESPACE::Sensor::NavSatSensor ( )

Get a mutable NAVSAT sensor, or nullptr if the sensor does not contain an NAVSAT sensor.

Returns
Pointer to the sensor's NAVSAT, or nullptr if the sensor is not an NAVSAT.
See also
SensorType Type() const

◆ NavSatSensor() [2/2]

const NavSat* sdf::SDF_VERSION_NAMESPACE::Sensor::NavSatSensor ( ) const

Get a pointer to a NAVSAT sensor, or nullptr if the sensor does not contain an NAVSAT sensor.

Returns
Pointer to the sensor's NAVSAT, or nullptr if the sensor is not an NAVSAT.
See also
SensorType Type() const

◆ operator!=()

bool sdf::SDF_VERSION_NAMESPACE::Sensor::operator!= ( const Sensor _sensor) const

Return true this Sensor object does not contain the same values as the passed in parameter.

Parameters
[_in]_sensor Sensor object to compare. \returen True if 'this' != _sensor.

◆ operator==()

bool sdf::SDF_VERSION_NAMESPACE::Sensor::operator== ( const Sensor _sensor) const

Return true if both Sensor objects contain the same values.

Parameters
[_in]_sensor Sensor object to compare. \returen True if 'this' == _sensor.

◆ Plugins() [1/2]

sdf::Plugins& sdf::SDF_VERSION_NAMESPACE::Sensor::Plugins ( )

Get a mutable vector of plugins attached to this object.

Returns
A vector of Plugin, which will be empty if there are no plugins.

◆ Plugins() [2/2]

const sdf::Plugins& sdf::SDF_VERSION_NAMESPACE::Sensor::Plugins ( ) const

Get the plugins attached to this object.

Returns
A vector of Plugin, which will be empty if there are no plugins.

◆ PoseRelativeTo()

const std::string& sdf::SDF_VERSION_NAMESPACE::Sensor::PoseRelativeTo ( ) const

Get the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent link/joint coordinate frame.

Returns
The name of the pose relative-to frame.

◆ RawPose()

const gz::math::Pose3d& sdf::SDF_VERSION_NAMESPACE::Sensor::RawPose ( ) const

Get the pose of the sensor.

This is the pose of the sensor as specified in SDF (<sensor> <pose> ... </pose></sensor>), and is typically used to express the position and rotation of a sensor in a global coordinate frame.

Returns
The pose of the sensor.

◆ SemanticPose()

sdf::SemanticPose sdf::SDF_VERSION_NAMESPACE::Sensor::SemanticPose ( ) const

Get SemanticPose object of this object to aid in resolving poses.

Returns
SemanticPose object for this link.

◆ SetAirPressureSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetAirPressureSensor ( const AirPressure _air)

Set the air pressure sensor.

Parameters
[in]_airThe air pressure sensor.

◆ SetAirSpeedSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetAirSpeedSensor ( const AirSpeed _air)

Set the air pressure sensor.

Parameters
[in]_airThe air pressure sensor.

◆ SetAltimeterSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetAltimeterSensor ( const Altimeter _alt)

Set the altimeter sensor.

Parameters
[in]_altThe altimeter sensor.

◆ SetCameraSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetCameraSensor ( const Camera _cam)

Set the camera sensor.

Parameters
[in]_camThe camera sensor.

◆ SetEnableMetrics()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetEnableMetrics ( bool  _enableMetrics)

Set flag to enable publishing performance metrics.

Parameters
[in]_enableMetricsTrue to enable.

◆ SetForceTorqueSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetForceTorqueSensor ( const ForceTorque _ft)

Set the force torque sensor.

Parameters
[in]_ftThe force torque sensor.

◆ SetImuSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetImuSensor ( const Imu _imu)

Set the IMU sensor.

Parameters
[in]_imuThe IMU sensor.

◆ SetLidarSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetLidarSensor ( const Lidar _lidar)

Set the lidar sensor.

Parameters
[in]_lidarThe lidar sensor.

◆ SetMagnetometerSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetMagnetometerSensor ( const Magnetometer _mag)

Set the magnetometer sensor.

Parameters
[in]_magThe magnetometer sensor.

◆ SetName()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetName ( const std::string &  _name)

Set the name of the sensor.

The name of the sensor should be unique within the scope of a World.

Parameters
[in]_nameName of the sensor.

◆ SetNavSatSensor()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetNavSatSensor ( const NavSat _navsat)

Set the NAVSAT sensor.

Parameters
[in]_navsatThe NAVSAT sensor.

◆ SetPoseRelativeTo()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetPoseRelativeTo ( const std::string &  _frame)

Set the name of the coordinate frame relative to which this object's pose is expressed.

An empty value indicates that the frame is relative to the parent link/joint coordinate frame.

Parameters
[in]_frameThe name of the pose relative-to frame.

◆ SetRawPose()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetRawPose ( const gz::math::Pose3d &  _pose)

Set the pose of the sensor.

See also
const gz::math::Pose3d &RawPose() const
Parameters
[in]_poseThe new sensor pose.

◆ SetTopic()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetTopic ( const std::string &  _topic)

Set the topic on which sensor data should be published.

Parameters
[in]_topicTopic for this sensor's data.

◆ SetType() [1/2]

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetType ( const SensorType  _type)

Set the sensor type.

Parameters
[in]_typeThe sensor type.

◆ SetType() [2/2]

bool sdf::SDF_VERSION_NAMESPACE::Sensor::SetType ( const std::string &  _typeStr)

Set the sensor type from a string.

Parameters
[in]_typeStrThe sensor type. A valid parameter should equal one of the enum value name in the SensorType enum. For example, "altimeter" or "camera".
Returns
True if the _typeStr parameter matched a known sensor type. False if the sensor type could not be set.

◆ SetUpdateRate()

void sdf::SDF_VERSION_NAMESPACE::Sensor::SetUpdateRate ( double  _hz)

Set the update rate.

This is The frequency at which the sensor data is generated. If left unspecified (0.0), the sensor will generate data every cycle.

Parameters
[in]_rateThe update rate in Hz.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Sensor::ToElement ( ) const

Create and return an SDF element filled with data from this sensor.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated sensor values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Sensor::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this sensor.

Note that parameter passing functionality is not captured with this function.

Parameters
[in]_errorsVector of errors.
Returns
SDF element pointer with updated sensor values.

◆ Topic()

std::string sdf::SDF_VERSION_NAMESPACE::Sensor::Topic ( ) const

Get the topic on which sensor data should be published.

Returns
Topic for this sensor's data.

◆ Type()

SensorType sdf::SDF_VERSION_NAMESPACE::Sensor::Type ( ) const

Get the sensor type.

Returns
The sensor type.

◆ TypeStr()

std::string sdf::SDF_VERSION_NAMESPACE::Sensor::TypeStr ( ) const

Get the sensor type as a string.

Returns
The sensor type as a string.

◆ UpdateRate()

double sdf::SDF_VERSION_NAMESPACE::Sensor::UpdateRate ( ) const

Get the update rate in Hz.

This is The frequency at which the sensor data is generated. If left unspecified (0.0), the sensor will generate data every cycle.

Returns
The update rate in Hz.

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