SLProject  4.3.020
A platform independent 3D computer graphics framework for desktop OS, Android, iOS and online in web browsers
SENSSimulatedOrientation Class Reference

#include <SENSSimulated.h>

Inheritance diagram for SENSSimulatedOrientation:
[legend]

Public Member Functions

 ~SENSSimulatedOrientation ()
 
bool start () override
 
void stop () override
 
- Public Member Functions inherited from SENSOrientation
virtual ~SENSOrientation ()
 
Quat getOrientation () const
 
bool isRunning ()
 
void registerListener (SENSOrientationListener *listener)
 
void unregisterListener (SENSOrientationListener *listener)
 
- Public Member Functions inherited from SENSSimulated< SENSOrientation::Quat >
virtual ~SENSSimulated ()
 
- Public Member Functions inherited from SENSSimulatedBase
virtual ~SENSSimulatedBase ()
 

Private Member Functions

 SENSSimulatedOrientation (StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSOrientation::Quat >> &&data, const SENSSimClock &clock)
 
void feedSensorData (const int counter) override
 feed new sensor data to sensor More...
 

Friends

class SENSSimulator
 

Additional Inherited Members

- Protected Types inherited from SENSSimulated< SENSOrientation::Quat >
using StartSimCB = std::function< void(void)>
 
using SensorSimStoppedCB = std::function< void(void)>
 
- Protected Member Functions inherited from SENSOrientation
void setOrientation (Quat orientation)
 
- Protected Member Functions inherited from SENSSimulated< SENSOrientation::Quat >
 SENSSimulated (const std::string name, StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSOrientation::Quat >> &&data, const SENSSimClock &clock)
 
void startSim ()
 start the sensor simulation thread More...
 
void stopSim ()
 stop the sensor simulation thread More...
 
bool getErrorMsg (std::string &msg) override
 get error msg (valid if function returns true) More...
 
bool isThreadRunning () const override
 indicates if simulation thread is running More...
 
virtual void prepareSensorData (const int counter)
 
virtual void onLatencyProblem (int &counter)
 special treatment when there is latency (e.g. when feeding camera frames from cv::videocapture updating the frame pos may take ages) More...
 
- Protected Attributes inherited from SENSOrientation
bool _running = false
 
- Protected Attributes inherited from SENSSimulated< SENSOrientation::Quat >
std::vector< std::pair< SENSTimePt, SENSOrientation::Quat > > _data
 
SensorSimStoppedCB _sensorSimStoppedCB
 
StartSimCB _startSimCB
 
std::thread _thread
 
std::condition_variable _condVar
 
std::mutex _mutex
 
bool _stop
 
SENSTimePt _commonSimStartTimePt
 
bool _threadIsRunning
 
const SENSSimClock_clock
 
std::string _name
 
std::mutex _msgMutex
 
std::string _errorMsg
 

Detailed Description

SENSSimulatedOrientation SENSSimulated implementation for Orientation sensor simulation. Implements the SENSOrientation interface to make it a full orientation sensor and the SENSSimulated interface for the sensor simulation backend.

Definition at line 133 of file SENSSimulated.h.

Constructor & Destructor Documentation

◆ ~SENSSimulatedOrientation()

SENSSimulatedOrientation::~SENSSimulatedOrientation ( )

Definition at line 195 of file SENSSimulated.cpp.

196 {
197  stop();
198 }

◆ SENSSimulatedOrientation()

SENSSimulatedOrientation::SENSSimulatedOrientation ( StartSimCB  startSimCB,
SensorSimStoppedCB  sensorSimStoppedCB,
std::vector< std::pair< SENSTimePt, SENSOrientation::Quat >> &&  data,
const SENSSimClock clock 
)
private

Definition at line 220 of file SENSSimulated.cpp.

224  : SENSSimulated("orientation", startSimCB, sensorSimStoppedCB, std::move(data), clock)
225 {
226 }
SENSSimulated(const std::string name, StartSimCB startSimCB, SensorSimStoppedCB sensorSimStoppedCB, std::vector< std::pair< SENSTimePt, SENSOrientation::Quat >> &&data, const SENSSimClock &clock)

Member Function Documentation

◆ feedSensorData()

void SENSSimulatedOrientation::feedSensorData ( const int  counter)
overrideprivatevirtual

feed new sensor data to sensor

Implements SENSSimulated< SENSOrientation::Quat >.

Definition at line 228 of file SENSSimulated.cpp.

229 {
230  setOrientation(_data[counter].second);
231 }
void setOrientation(Quat orientation)
std::vector< std::pair< SENSTimePt, SENSOrientation::Quat > > _data
Definition: SENSSimulated.h:79

◆ start()

bool SENSSimulatedOrientation::start ( )
overridevirtual

Implements SENSOrientation.

Definition at line 200 of file SENSSimulated.cpp.

201 {
202  if (!_running)
203  {
204  startSim();
205  _running = true;
206  }
207 
208  return _running;
209 }
void startSim()
start the sensor simulation thread

◆ stop()

void SENSSimulatedOrientation::stop ( )
overridevirtual

Implements SENSOrientation.

Definition at line 211 of file SENSSimulated.cpp.

212 {
213  if (_running)
214  {
215  stopSim();
216  _running = false;
217  }
218 }
void stopSim()
stop the sensor simulation thread

Friends And Related Function Documentation

◆ SENSSimulator

friend class SENSSimulator
friend

Definition at line 136 of file SENSSimulated.h.


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