Privacy
An open-source, flexible 3D physical simulation framework
mars::interfaces::SensorManagerInterface Class Referenceabstract

"SensorManagerInterface" declares the interfaces for all sensor operations that are used for the communication between the simulation modules. More...

#include <SensorManagerInterface.h>

Public Member Functions

virtual ~SensorManagerInterface ()
 Destructor. More...
 
virtual void getListSensors (std::vector< core_objects_exchange > *sensorList) const =0
 Add a sensor to the simulation. More...
 
virtual const BaseSensorgetFullSensor (unsigned long index) const =0
 Gives information about core exchange data for camera sensors. More...
 
virtual unsigned long getSensorID (std::string name) const =0
 
virtual void removeSensor (unsigned long index)=0
 Removes a sensor from the simulation. More...
 
virtual BaseSensorgetSimSensor (unsigned long index) const =0
 This function returns the SimSensor object for a given index. More...
 
virtual int getSensorData (unsigned long id, sReal **data) const =0
 This function returns the GridSensor object for a given index. More...
 
virtual int getSensorCount () const =0
 Returns the number of sensors that are currently present in the simulation. More...
 
virtual void clearAllSensors (bool clear_all=false)=0
 Destroys all sensors in the simulation. More...
 
virtual void reloadSensors (void)=0
 This function reloads all sensors from a temporary sensor pool. More...
 
virtual BaseSensorcreateAndAddSensor (configmaps::ConfigMap *config, bool reload=true)=0
 Adds an sensor to the known sensors list. More...
 
virtual BaseSensorcreateAndAddSensor (const std::string &type_name, BaseConfig *config, bool reload=false)=0
 

Detailed Description

"SensorManagerInterface" declares the interfaces for all sensor operations that are used for the communication between the simulation modules.

The class defines only pure virtual functions that are implemented within the simulation and can be used everywhere by accessing this interface via the ControlCenter class.

It is very important to assure the serialization between the threads to have the desired results. Currently the verified use of the functions is only guaranteed by calling it within the main thread (update callback from gui_thread).

Definition at line 64 of file SensorManagerInterface.h.

Constructor & Destructor Documentation

◆ ~SensorManagerInterface()

virtual mars::interfaces::SensorManagerInterface::~SensorManagerInterface ( )
inlinevirtual

Destructor.

Definition at line 70 of file SensorManagerInterface.h.

Member Function Documentation

◆ clearAllSensors()

virtual void mars::interfaces::SensorManagerInterface::clearAllSensors ( bool  clear_all = false)
pure virtual

Destroys all sensors in the simulation.

The clear_all flag indicates if the reload sensors should be destroyed as well. If set to false they are left intact.

Parameters
clear_allIndicates if the reload sensors should be destroyed as well. If set to false they are left intact.

Implemented in mars::sim::SensorManager.

◆ createAndAddSensor() [1/2]

virtual BaseSensor* mars::interfaces::SensorManagerInterface::createAndAddSensor ( configmaps::ConfigMap config,
bool  reload = true 
)
pure virtual

Adds an sensor to the known sensors list.

Implemented in mars::sim::SensorManager.

◆ createAndAddSensor() [2/2]

virtual BaseSensor* mars::interfaces::SensorManagerInterface::createAndAddSensor ( const std::string &  type_name,
BaseConfig config,
bool  reload = false 
)
pure virtual

Implemented in mars::sim::SensorManager.

◆ getFullSensor()

virtual const BaseSensor* mars::interfaces::SensorManagerInterface::getFullSensor ( unsigned long  index) const
pure virtual

Gives information about core exchange data for camera sensors.

Parameters
cameraListA pointer to a vector that is filled with a core_objects_exchange struct for every camera sensor. The vector is cleared in the beginning of this function. Gives all information of a certain sensor.
indexThe unique id of the sensor to get information for.
Returns
A pointer to the sensorStruct of the sensor with the given id.

Implemented in mars::sim::SensorManager.

◆ getListSensors()

virtual void mars::interfaces::SensorManagerInterface::getListSensors ( std::vector< core_objects_exchange > *  sensorList) const
pure virtual

Add a sensor to the simulation.

Parameters
sensorSA pointer to the sensorStruct that defines the new sensor.
reloadUsed internally by the simulation. The default value is false. If this param is set to true the new sensor will not be reloaded after a reset of the simulation.
Returns
The unique id of the newly added sensor. Gives information about core exchange data for sensors.
Parameters
sensorListA pointer to a vector that is filled with a core_objects_exchange struct for every sensor. The vector is cleared in the beginning of this function.

Implemented in mars::sim::SensorManager.

◆ getSensorCount()

virtual int mars::interfaces::SensorManagerInterface::getSensorCount ( ) const
pure virtual

Returns the number of sensors that are currently present in the simulation.

Returns
The number of all sensors.

Implemented in mars::sim::SensorManager.

◆ getSensorData()

virtual int mars::interfaces::SensorManagerInterface::getSensorData ( unsigned long  id,
sReal **  data 
) const
pure virtual

This function returns the GridSensor object for a given index.

Parameters
nameThe index of the sensor to get the core sensor object.
Returns
Returns a pointer to the corresponding sensor object. This function provides the CameraSensor object for a given index.
Parameters
csThe cameraStruct of the sensor.
indexThe index of the sensor to get the cameraStruct
Returns
Returns 1 if the sensor is found, 0 otherwise.virtual int getCameraSensor(cameraStruct *cs, int index) const = 0; This function provides the sensor data for a given index.
Parameters
dataThe sensor data of the sensor.
indexThe index of the sensor to get the data

Implemented in mars::sim::SensorManager.

◆ getSensorID()

virtual unsigned long mars::interfaces::SensorManagerInterface::getSensorID ( std::string  name) const
pure virtual

Implemented in mars::sim::SensorManager.

◆ getSimSensor()

virtual BaseSensor* mars::interfaces::SensorManagerInterface::getSimSensor ( unsigned long  index) const
pure virtual

This function returns the SimSensor object for a given index.

Parameters
nameThe index of the sensor to get the core sensor object.
Returns
Returns a pointer to the corresponding sensor object.

Implemented in mars::sim::SensorManager.

◆ reloadSensors()

virtual void mars::interfaces::SensorManagerInterface::reloadSensors ( void  )
pure virtual

This function reloads all sensors from a temporary sensor pool.

All sensors that have been added with reload value as true are added back to the simulation again with a reload value of true.

Implemented in mars::sim::SensorManager.

◆ removeSensor()

virtual void mars::interfaces::SensorManagerInterface::removeSensor ( unsigned long  index)
pure virtual

Removes a sensor from the simulation.

Parameters
indexThe unique id of the sensor to remove form the simulation.

Implemented in mars::sim::SensorManager.


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