##

SensorManager Class Reference
Sensors

Class to manage and update all sensors. More...

`#include <sensors/sensors.hh>`

Inherits SingletonT< SensorManager >.

## Public Member Functions

std::string | CreateSensor (sdf::ElementPtr _elem, const std::string &_worldName, const std::string &_parentName, uint32_t _parentId)
| Add a sensor from an SDF element. More...
void | Fini ()
| Finalize all the sensors. More...
SensorPtr | GetSensor (const std::string &_name) const
| Get a sensor. More...
Sensor_V | GetSensors () const
| Get all the sensors. More...
void | GetSensorTypes (std::vector< std::string > &_types) const
| Get all the sensor types. More...
void | Init ()
| Init all the sensors. More...
void | OnCreateSensor (sdf::ElementPtr _elem, const std::string &_worldName, const std::string &_parentName, const uint32_t _parentId)
| Add a sensor from an SDF element. More...
void | RemoveSensor (const std::string &_name)
| Remove a sensor. More...
void | RemoveSensors ()
| Remove all sensors. More...
void | ResetLastUpdateTimes ()
| Reset last update times in all sensors. More...
bool | Running () const
| Get whether there's at least one sensor container running. More...
void | RunThreads ()
| Run sensor updates in separate threads. More...
bool | SensorsInitialized ()
| True if SensorManager::initSensors queue is empty i.e. More...
void | Stop ()
| Stop the run thread. More...
void | Update (bool _force=false)
| Update all the sensors. More...

## Static Public Member Functions

static SensorManager * | Instance ()
| Get an instance of the singleton. More...

## Detailed Description

Class to manage and update all sensors.

## Member Function Documentation

## CreateSensor()

std::string CreateSensor | ( | sdf::ElementPtr | _elem,
|  | const std::string & | _worldName,
|  | const std::string & | _parentName,
|  | uint32_t | _parentId
| ) |  |

Add a sensor from an SDF element.

This function will also Load and Init the sensor.

Parameters

  [in] | _elem | The SDF element that describes the sensor
  [in] | _worldName | Name of the world in which to create the sensor
  [in] | _parentName | The name of the parent link which the sensor is attached to.

Returns
  The name of the sensor

## Fini()

void Fini | ( |  | ) |

Finalize all the sensors.

## GetSensor()

SensorPtr GetSensor | ( | const std::string & | _name | ) | const

Get a sensor.

Parameters

  [in] | _name | The name of a sensor to find.

Returns
  A pointer to the sensor. nullptr if not found.

## GetSensors()

Sensor_V GetSensors | ( |  | ) | const

Get all the sensors.

Returns
  Vector of all the sensors.

## GetSensorTypes()

void GetSensorTypes | ( | std::vector< std::string > & | _types | ) | const

Get all the sensor types.

Parameters

  [out] | All | the sensor types.

## Init()

void Init | ( |  | ) |

Init all the sensors.

## Instance()

static SensorManager * Instance | ( |  | ) |

inline static inherited

Get an instance of the singleton.

## OnCreateSensor()

void OnCreateSensor | ( | sdf::ElementPtr | _elem,
|  | const std::string & | _worldName,
|  | const std::string & | _parentName,
|  | const uint32_t | _parentId
| ) |  |

Add a sensor from an SDF element.

This function will also Load and Init the sensor.

Parameters

  [in] | _elem | The SDF element that describes the sensor
  [in] | _worldName | Name of the world in which to create the sensor
  [in] | _parentName | The name of the parent link which the sensor is attached to.
  [in] | _parentId | Unique id of the sensor to create.

## RemoveSensor()

void RemoveSensor | ( | const std::string & | _name | ) |

Remove a sensor.

Parameters

  [in] | _name | The name of the sensor to remove.

## RemoveSensors()

void RemoveSensors | ( |  | ) |

Remove all sensors.

## ResetLastUpdateTimes()

void ResetLastUpdateTimes | ( |  | ) |

Reset last update times in all sensors.

## Running()

bool Running | ( |  | ) | const

Get whether there's at least one sensor container running.

Returns
  True if running.

## RunThreads()

void RunThreads | ( |  | ) |

Run sensor updates in separate threads.

This will only run non-image based sensor updates.

## SensorsInitialized()

bool SensorsInitialized | ( |  | ) |

True if SensorManager::initSensors queue is empty i.e.

all sensors managed by SensorManager have been initialized

## Stop()

void Stop | ( |  | ) |

Stop the run thread.

## Update()

void Update | ( | bool | _force = `false` | ) |

Update all the sensors.

Checks to see if any sensor need to be initialized first, then updates all sensors once.

Parameters

  [in] | _force | True force update, false if not

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

- SensorManager.hh