Gazebo Sensors

API Reference

6.8.1
SensorFactory Class Reference

A factory class for creating sensors This class instantiates sensor objects based on the sensor type and makes sure they're initialized correctly. More...

#include <SensorFactory.hh>

Public Member Functions

 SensorFactory ()
 Constructor. More...
 
 ~SensorFactory ()
 Destructor. More...
 
void AddPluginPaths (const std::string &_path)
 Add additional path to search for sensor plugins. More...
 
template<typename SensorType >
std::unique_ptr< SensorType > CreateSensor (const sdf::Sensor &_sdf)
 Create a sensor from a SDF DOM object with a known sensor type. More...
 
std::unique_ptr< SensorCreateSensor (const sdf::Sensor &_sdf)
 Create a sensor from an SDF Sensor DOM object without a known sensor type. More...
 
template<typename SensorType >
std::unique_ptr< SensorType > CreateSensor (sdf::ElementPtr _sdf)
 Create a sensor from an SDF element with a known sensor type. More...
 
std::unique_ptr< SensorCreateSensor (sdf::ElementPtr _sdf)
 Create a sensor from SDF without a known sensor type. More...
 

Detailed Description

A factory class for creating sensors This class instantiates sensor objects based on the sensor type and makes sure they're initialized correctly.

Constructor & Destructor Documentation

◆ SensorFactory()

Constructor.

◆ ~SensorFactory()

Destructor.

Member Function Documentation

◆ AddPluginPaths()

void AddPluginPaths ( const std::string _path)

Add additional path to search for sensor plugins.

Parameters
[in]_pathSearch path
Deprecated:
Sensor plugins aren't supported anymore.

◆ CreateSensor() [1/4]

std::unique_ptr<SensorType> CreateSensor ( const sdf::Sensor &  _sdf)
inline

Create a sensor from a SDF DOM object with a known sensor type.

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

See also
Sensor()
Parameters
[in]_sdfSDF Sensor DOM object.
Template Parameters
SensorTypeSensor type
Returns
A pointer to the created sensor. Null returned on error.

References std::endl().

Referenced by Manager::CreateSensor().

◆ CreateSensor() [2/4]

std::unique_ptr<Sensor> CreateSensor ( const sdf::Sensor &  _sdf)

Create a sensor from an SDF Sensor DOM object without a known sensor type.

This creates sensors by looking at the given SDF Sensor DOM object. 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.

See also
Sensor()
Parameters
[in]_sdfSDF Sensor DOM object.
Returns
A sensor id that refers to the created sensor. Null is is returned on error.
Deprecated:
Sensor registration is deprecated, so it's necessary to provide the specific sensor type to create it. Use the templated CreateSensor function.

◆ CreateSensor() [3/4]

std::unique_ptr<SensorType> CreateSensor ( sdf::ElementPtr  _sdf)
inline

Create a sensor from an SDF element with a known sensor type.

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

References std::endl().

◆ CreateSensor() [4/4]

std::unique_ptr<Sensor> 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 gz-transport interface. If you need a direct C++ interface to the data, you must get the sensor pointer and cast to the correct type.

See also
Sensor()
Parameters
[in]_sdfpointer to the sdf element
Returns
Null, as the function is deprecated.
Deprecated:
Sensor registration is deprecated, so it's necessary to provide the specific sensor type to create it. Use the templated CreateSensor function.

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