![]() |
An open-source, flexible 3D physical simulation framework
|
"SensorManager" imlements the interfaces for all sensor operations that are used for the communication between the simulation modules. More...
#include <SensorManager.h>
Public Member Functions | |
SensorManager (interfaces::ControlCenter *c) | |
Constructor. More... | |
virtual | ~SensorManager () |
Destructor. More... | |
virtual void | getListSensors (std::vector< interfaces::core_objects_exchange > *sensorList) const |
Add a sensor to the simulation. More... | |
virtual const interfaces::BaseSensor * | getFullSensor (unsigned long index) const |
Gives information about core exchange data for camera sensors. More... | |
virtual void | removeSensor (unsigned long index) |
Removes a sensor from the simulation. More... | |
virtual interfaces::BaseSensor * | getSimSensor (unsigned long index) const |
This function returns the SimSensor object for a given index. More... | |
unsigned long | getSensorID (std::string name) const |
virtual int | getSensorData (unsigned long id, interfaces::sReal **data) const |
This function provides the sensor data for a given index. More... | |
virtual int | getSensorCount (void) const |
Returns the number of sensors that are currently present in the simulation. More... | |
virtual void | clearAllSensors (bool clear_all=false) |
Destroys all sensors in the simulation. More... | |
virtual void | reloadSensors (void) |
This function reloads all sensors from a temporary sensor pool. More... | |
void | addSensorType (const std::string &name, interfaces::BaseSensor *(*func)(interfaces::ControlCenter *, interfaces::BaseConfig *)) |
void | addMarsParser (const std::string, interfaces::BaseConfig *(*)(interfaces::ControlCenter *, configmaps::ConfigMap *)) |
virtual interfaces::BaseSensor * | createAndAddSensor (configmaps::ConfigMap *config, bool reload=true) |
Adds an sensor to the known sensors list. More... | |
virtual interfaces::BaseSensor * | createAndAddSensor (const std::string &type_name, interfaces::BaseConfig *config, bool reload=false) |
![]() | |
virtual | ~SensorManagerInterface () |
Destructor. More... | |
Private Attributes | |
unsigned long | next_sensor_id |
the id of the next sensor added to the simulation More... | |
std::map< unsigned long, interfaces::BaseSensor * > | simSensors |
a containter for all sensors currently present in the simulation More... | |
std::vector< SensorReloadHelper > | simSensorsReload |
a containter for all sensors that are loaded after a reset of the simulation More... | |
interfaces::ControlCenter * | control |
a pointer to the control center More... | |
utils::Mutex | iMutex |
a mutex fot the sensor containters More... | |
std::map< const std::string, interfaces::BaseSensor *(*)(interfaces::ControlCenter *, interfaces::BaseConfig *)> | availableSensors |
std::map< const std::string, interfaces::BaseConfig *(*)(interfaces::ControlCenter *, configmaps::ConfigMap *)> | marsParser |
"SensorManager" imlements the interfaces for all sensor operations that are used for the communication between the simulation modules.
gui_thread
). Definition at line 69 of file SensorManager.h.
mars::sim::SensorManager::SensorManager | ( | interfaces::ControlCenter * | c | ) |
Constructor.
c | The pointer to the ControlCenter of the simulation. |
Definition at line 78 of file SensorManager.cpp.
|
inlinevirtual |
Destructor.
Definition at line 82 of file SensorManager.h.
void mars::sim::SensorManager::addMarsParser | ( | const std::string | , |
interfaces::BaseConfig * | *)(interfaces::ControlCenter *, configmaps::ConfigMap * | ||
) |
Definition at line 293 of file SensorManager.cpp.
void mars::sim::SensorManager::addSensorType | ( | const std::string & | name, |
interfaces::BaseSensor *(*)(interfaces::ControlCenter *, interfaces::BaseConfig *) | func | ||
) |
Definition at line 298 of file SensorManager.cpp.
|
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.
clear_all | Indicates if the reload sensors should be destroyed as well. If set to false they are left intact. |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 260 of file SensorManager.cpp.
|
virtual |
Adds an sensor to the known sensors list.
Implements mars::interfaces::SensorManagerInterface.
Definition at line 335 of file SensorManager.cpp.
|
virtual |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 302 of file SensorManager.cpp.
|
virtual |
Gives information about core exchange data for camera sensors.
Gives all information of a certain sensor.
cameraList | A 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. |
index | The unique id of the sensor to get information for. |
index | The unique id of the sensor to get information for. |
std::runtime_error | if a motor with the given index does not exist. |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 156 of file SensorManager.cpp.
|
virtual |
Add a sensor to the simulation.
Gives information about core exchange data for sensors.
sensorS | A pointer to the BaseSensor that defines the new sensor. |
reload | Used 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. |
sensorList | A 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. |
sensorList | A 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. |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 136 of file SensorManager.cpp.
|
virtual |
Returns the number of sensors that are currently present in the simulation.
Implements mars::interfaces::SensorManagerInterface.
Definition at line 245 of file SensorManager.cpp.
|
virtual |
This function provides the sensor data for a given index.
data | The sensor data of the sensor. |
index | The index of the sensor to get the data |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 227 of file SensorManager.cpp.
|
virtual |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 170 of file SensorManager.cpp.
|
virtual |
This function returns the SimSensor object for a given index.
name | The index of the sensor to get the core sensor object. |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 210 of file SensorManager.cpp.
|
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
.
Implements mars::interfaces::SensorManagerInterface.
Definition at line 280 of file SensorManager.cpp.
|
virtual |
Removes a sensor from the simulation.
index | The unique id of the sensor to remove form the simulation. |
Implements mars::interfaces::SensorManagerInterface.
Definition at line 187 of file SensorManager.cpp.
|
private |
Definition at line 231 of file SensorManager.h.
|
private |
a pointer to the control center
Definition at line 224 of file SensorManager.h.
|
mutableprivate |
a mutex fot the sensor containters
Definition at line 227 of file SensorManager.h.
|
private |
Definition at line 234 of file SensorManager.h.
|
private |
the id of the next sensor added to the simulation
Definition at line 214 of file SensorManager.h.
|
private |
a containter for all sensors currently present in the simulation
Definition at line 217 of file SensorManager.h.
|
private |
a containter for all sensors that are loaded after a reset of the simulation
Definition at line 220 of file SensorManager.h.