![]() |
SLProject
4.3.020
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
|
#include <SENSSimulator.h>
Public Member Functions | |
| SENSSimulator (const std::string &simDirName) | |
| ctor, transfer directory containing sensor data that was recorded with SENSRecorder More... | |
| ~SENSSimulator () | |
| SENSSimulatedGps * | getGpsSensorPtr () |
| get sensor pointer of simulated gps sensor and use it like a normal sensor (valid if not null) More... | |
| SENSSimulatedOrientation * | getOrientationSensorPtr () |
| get sensor pointer of simulated orientation sensor and use it like a normal sensor (valid if not null) More... | |
| SENSSimulatedCamera * | getCameraSensorPtr () |
| get sensor pointer of simulated camera sensor and use it like a normal sensor (valid if not null) More... | |
| bool | isRunning () const |
| indicates if simulator is currently running More... | |
| bool | getSimulatorErrors (std::vector< std::string > &errorMsgs) |
| void | pause () |
| pause simulation time More... | |
| bool | isPaused () |
| void | resume () |
| resume simulation time More... | |
| SENSTimePt | now () |
| reset simulation time More... | |
| SENSMicroseconds | passedTime () |
| get passed simulation time More... | |
Private Member Functions | |
| template<typename T > | |
| T * | getActiveSensor () |
| void | onStart () |
| callback called from SENSSimulated when the simulated sensor was started More... | |
| void | onSensorSimStopped () |
| callback called from SENSSimulated when the simulated sensor was stopped More... | |
| void | loadGpsData (const std::string &dirName, std::vector< std::pair< SENSTimePt, SENSGps::Location >> &data) |
| load data from file and instantiate sensor if valid More... | |
| void | loadOrientationData (const std::string &dirName, std::vector< std::pair< SENSTimePt, SENSOrientation::Quat >> &data) |
| load data from file and instantiate sensor if valid More... | |
| void | loadCameraData (const std::string &dirName, std::vector< std::pair< SENSTimePt, int >> &data, std::string &videoFileName, SENSCameraConfig &cameraConfig) |
| load data from file and instantiate sensor if valid More... | |
Private Attributes | |
| std::vector< std::unique_ptr< SENSSimulatedBase > > | _activeSensors |
| list of currently activated sensors. Which sensors are activated depends on the content of simulation directory More... | |
| std::unique_ptr< SENSSimClock > | _clock |
| std::atomic_bool | _running {false} |
| flags if simulator is currently running More... | |
SENSSimulator This class is owner of SENSSimulated sensor instances. It loads special sensor data from input simulation directory transferred during construction. Depending on if the directory content is valid, a SENSSimulated implementation is instantiated and initialized with loaded sensor data. You can get a sensor pointer to a simulated sensor by calling the getter get..SensorPtr() method and use it like the real sensor, as it implements the original sensor interface. The SENSSimulator is maintainer of the current simulation time. Simulated sensor values are selected depending on this time. The idea is to provide sensor data exactly as it was recorded. ATTENTION: Simulation time starts, as soon as one simulated sensor was started and is resetted when all simulated sensors are stopped.
Definition at line 23 of file SENSSimulator.h.
| SENSSimulator::SENSSimulator | ( | const std::string & | simDirName | ) |
ctor, transfer directory containing sensor data that was recorded with SENSRecorder
Definition at line 67 of file SENSSimulator.cpp.
| SENSSimulator::~SENSSimulator | ( | ) |
Definition at line 3 of file SENSSimulator.cpp.
|
inlineprivate |
Definition at line 53 of file SENSSimulator.h.
|
inline |
get sensor pointer of simulated camera sensor and use it like a normal sensor (valid if not null)
Definition at line 35 of file SENSSimulator.h.
|
inline |
get sensor pointer of simulated gps sensor and use it like a normal sensor (valid if not null)
Definition at line 31 of file SENSSimulator.h.
|
inline |
get sensor pointer of simulated orientation sensor and use it like a normal sensor (valid if not null)
Definition at line 33 of file SENSSimulator.h.
| bool SENSSimulator::getSimulatorErrors | ( | std::vector< std::string > & | errorMsgs | ) |
Definition at line 7 of file SENSSimulator.cpp.
| bool SENSSimulator::isPaused | ( | ) |
Definition at line 26 of file SENSSimulator.cpp.
|
inline |
indicates if simulator is currently running
Definition at line 37 of file SENSSimulator.h.
|
private |
load data from file and instantiate sensor if valid
Definition at line 259 of file SENSSimulator.cpp.
|
private |
load data from file and instantiate sensor if valid
Definition at line 185 of file SENSSimulator.cpp.
|
private |
load data from file and instantiate sensor if valid
Definition at line 222 of file SENSSimulator.cpp.
| SENSTimePt SENSSimulator::now | ( | ) |
reset simulation time
Definition at line 48 of file SENSSimulator.cpp.
|
private |
callback called from SENSSimulated when the simulated sensor was stopped
Definition at line 155 of file SENSSimulator.cpp.
|
private |
callback called from SENSSimulated when the simulated sensor was started
Definition at line 145 of file SENSSimulator.cpp.
| SENSMicroseconds SENSSimulator::passedTime | ( | ) |
get passed simulation time
Definition at line 40 of file SENSSimulator.cpp.
| void SENSSimulator::pause | ( | ) |
pause simulation time
Definition at line 20 of file SENSSimulator.cpp.
| void SENSSimulator::resume | ( | ) |
resume simulation time
Definition at line 34 of file SENSSimulator.cpp.
|
private |
list of currently activated sensors. Which sensors are activated depends on the content of simulation directory
Definition at line 78 of file SENSSimulator.h.
|
private |
Definition at line 80 of file SENSSimulator.h.
|
private |
flags if simulator is currently running
Definition at line 82 of file SENSSimulator.h.