Gazebo Sensors

API Reference

3.6.0
Manager Class Reference

Loads and runs sensors. More...

#include <Manager.hh>

Public Member Functions

 Manager ()
 constructor More...
 
virtual ~Manager ()
 destructor More...
 
void AddPluginPaths (const std::string &_path)
 Adds colon delimited paths sensor plugins may be. More...
 
SensorId CreateSensor (const sdf::Sensor &_sdf)
 Create a sensor from SDF without a known sensor type. More...
 
template<typename T >
T * CreateSensor (sdf::ElementPtr _sdf)
 Create a sensor from SDF with a known sensor type. More...
 
SensorId CreateSensor (sdf::ElementPtr _sdf)
 Create a sensor from SDF without a known sensor type. More...
 
template<typename T >
T * CreateSensor (sdf::Sensor _sdf)
 Create a sensor from SDF with a known sensor type. More...
 
bool Init ()
 Initialize the sensor library without rendering or physics. More...
 
bool Remove (const SensorId _id)
 Remove a sensor by ID. More...
 
void RunOnce (const gz::common::Time &_time, bool _force=false)
 Run the sensor generation one step. More...
 
SensorSensor (SensorId _id)
 Get an instance of a loaded sensor by sensor id. More...
 

Detailed Description

Loads and runs sensors.

This class is responsible for loading and running sensors, and providing sensors with common environments to generat data from.

The primary interface through which to load a sensor is LoadSensor(). This takes an sdf element pointer that should be configured with everything the sensor will need. Custom sensors configuration must be in the <plugin> tag of the sdf::Element. The manager will dynamically load the sensor library and update it.

Remarks
This class is not thread safe.

Constructor & Destructor Documentation

◆ Manager()

Manager ( )

constructor

◆ ~Manager()

virtual ~Manager ( )
virtual

destructor

Member Function Documentation

◆ AddPluginPaths()

void AddPluginPaths ( const std::string _path)

Adds colon delimited paths sensor plugins may be.

◆ CreateSensor() [1/4]

SensorId CreateSensor ( const sdf::Sensor &  _sdf)

Create a sensor from SDF without a known sensor type.

This creates sensors by looking at the given sdf element. Sensors created with this API offer an ignition-transport interface. If you need a direct C++ interface to the data, you must get the sensor pointer and cast to the correct type.

A <sensor> tag may have multiple <plugin> tags. A SensorId will be returned for each plugin that is described in SDF. If there are no <plugin> tags then one of the plugins shipped with this library will be loaded. For example, a <sensor> tag with <camera> but no <plugin> will load a CameraSensor from ignition-sensors-camera.

See also
Sensor()
Parameters
[in]_sdfSDF sensor DOM object
Returns
A sensor id that refers to the created sensor. NO_SENSOR is returned on erro.

◆ CreateSensor() [2/4]

T* CreateSensor ( sdf::ElementPtr  _sdf)
inline

Create a sensor from SDF with a known sensor type.

This creates sensors by looking at the given sdf element. Sensors created with this API offer an ignition-transport interface. If you need a direct C++ interface to the data, you must get the sensor pointer and cast to the correct type.

A <sensor> tag may have multiple <plugin> tags. A SensorId will be returned for each plugin that is described in SDF. If there are no <plugin> tags then one of the plugins shipped with this library will be loaded. For example, a <sensor> tag with <camera> but no <plugin> will load a CameraSensor from ignition-sensors-camera.

See also
Sensor()
Parameters
[in]_sdfpointer to the sdf element
Returns
A pointer to the created sensor. nullptr returned on error.

References Manager::CreateSensor(), std::endl(), ignition::sensors::NO_SENSOR, and Manager::Sensor().

◆ CreateSensor() [3/4]

SensorId CreateSensor ( sdf::ElementPtr  _sdf)

Create a sensor from SDF without a known sensor type.

This creates sensors by looking at the given sdf element. Sensors created with this API offer an ignition-transport interface. If you need a direct C++ interface to the data, you must get the sensor pointer and cast to the correct type.

A <sensor> tag may have multiple <plugin> tags. A SensorId will be returned for each plugin that is described in SDF. If there are no <plugin> tags then one of the plugins shipped with this library will be loaded. For example, a <sensor> tag with <camera> but no <plugin> will load a CameraSensor from ignition-sensors-camera.

See also
Sensor()
Parameters
[in]_sdfpointer to the sdf element
Returns
A sensor id that refers to the created sensor. NO_SENSOR is returned on erro.

◆ CreateSensor() [4/4]

T* CreateSensor ( sdf::Sensor  _sdf)
inline

Create a sensor from SDF with a known sensor type.

This creates sensors by looking at the given sdf element. Sensors created with this API offer an ignition-transport interface. If you need a direct C++ interface to the data, you must get the sensor pointer and cast to the correct type.

A <sensor> tag may have multiple <plugin> tags. A SensorId will be returned for each plugin that is described in SDF. If there are no <plugin> tags then one of the plugins shipped with this library will be loaded. For example, a <sensor> tag with <camera> but no <plugin> will load a CameraSensor from ignition-sensors-camera.

See also
Sensor()
Parameters
[in]_sdfpointer to the sdf element
Returns
A pointer to the created sensor. nullptr returned on error.

References ignition::sensors::NO_SENSOR, and Manager::Sensor().

Referenced by Manager::CreateSensor().

◆ Init()

bool Init ( )

Initialize the sensor library without rendering or physics.

Returns
True if successfully initialized, false if not

◆ Remove()

bool Remove ( const SensorId  _id)

Remove a sensor by ID.

Parameters
[in]_sensorIdID of the sensor to remove
Returns
True if the sensor exists and removed.

◆ RunOnce()

void RunOnce ( const gz::common::Time &  _time,
bool  _force = false 
)

Run the sensor generation one step.

Parameters
_timeThe current simulated time
_forceIf true, all sensors are forced to update. Otherwise a sensor will update based on it's Hz rate.

◆ Sensor()

Sensor* Sensor ( SensorId  _id)

Get an instance of a loaded sensor by sensor id.

Parameters
[in]_idIdenitifier of the sensor.
Returns
Pointer to the sensor, nullptr on error.

Referenced by Manager::CreateSensor().


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