Helios++
Helios software for LiDAR simulations
AbstractPulseRunnable Class Reference

Base abstract class for pulse runnables. More...

#include <AbstractPulseRunnable.h>

Inheritance diagram for AbstractPulseRunnable:
Collaboration diagram for AbstractPulseRunnable:

Public Member Functions

 AbstractPulseRunnable (std::shared_ptr< Scanner > const scanner, SimulatedPulse const &pulse)
 Base constructor for pulse runnables. More...
 
virtual void initialize ()
 Initialize pending attributes of the abstract pulse runnable before doing further computations. More...
 
void capturePoint (Measurement &m, RandomnessGenerator< double > &rg, std::vector< Measurement > *allMeasurements, std::mutex *allMeasurementsMutex, std::vector< Measurement > *cycleMeasurements, std::mutex *cycleMeasurementsMutex)
 Capture point if proceed and write it. More...
 
void applyMeasurementErrorDirectly (RandomnessGenerator< double > &rg, double &distance, glm::dvec3 &beamOrigin, glm::dvec3 &beamDirection)
 Apply error to received measurement. More...
 
void applyMeasurementErrorFromExpr (RandomnessGenerator< double > &rg, double &distance, glm::dvec3 &beamOrigin, glm::dvec3 &beamDirection)
 Apply error to received measurement. More...
 
- Public Member Functions inherited from PulseTask
virtual void operator() ()=0
 Pulse task void functor. It is necessary due to compatibility reasons.
 
virtual void operator() (std::vector< std::vector< double >> &apMatrix, RandomnessGenerator< double > &randGen, RandomnessGenerator< double > &randGen2, NoiseSource< double > &intersectionHandlingNoiseSource)=0
 Pulse task runnable functor. More...
 

Public Attributes

std::shared_ptr< Scannerscanner = nullptr
 Scanner used to simulate the pulse.
 
std::shared_ptr< AbstractDetectordetector = nullptr
 Detector used to simulate pulse.
 
SimulatedPulse pulse
 The definition of the pulse to be simulated.
 
Scenescene
 Reference to the scene that is being scanned.
 
std::function< void(RandomnessGenerator< double > &rg, double &distance, glm::dvec3 &beamOrigin, glm::dvec3 &beamDirection)> applyMeasurementError
 Function to apply error to received measurement. More...
 

Detailed Description

Base abstract class for pulse runnables.

Constructor & Destructor Documentation

◆ AbstractPulseRunnable()

AbstractPulseRunnable::AbstractPulseRunnable ( std::shared_ptr< Scanner > const  scanner,
SimulatedPulse const &  pulse 
)

Base constructor for pulse runnables.

See also
AbstractPulseRunnable::scanner
AbstractPulseRunnable::pulse
SimulatedPulse

Member Function Documentation

◆ applyMeasurementErrorDirectly()

void AbstractPulseRunnable::applyMeasurementErrorDirectly ( RandomnessGenerator< double > &  rg,
double &  distance,
glm::dvec3 &  beamOrigin,
glm::dvec3 &  beamDirection 
)

Apply error to received measurement.

Let \(y\) be the distance with error, \(x\) be the clean distance, and \(\mathcal{N} = \mathcal{N}(\mu=0, \sigma=d_{\mathrm{acc}})\) be a normal distribution with mean 0 and standard deviation equal to the device accuracy ( \(d_{\mathrm{acc}}\)). But then, the distance with error can be determined as follows:

\[ y = x + \mathcal{N} \]

Parameters
rgRandomnessGenerator to be used to apply error to the measure directly from a normal distribution
distanceReference to the distance where error shall be applied
beamOriginReference to the beam originWaypoint where error shall be applied @bream beamDirection Reference to the beam direction where error shall be applied
See also
AbstractPulseRunnable::applyMeasurementError
AbstractPulseRunnable::applyMeasurementErrorFromExpr

◆ applyMeasurementErrorFromExpr()

void AbstractPulseRunnable::applyMeasurementErrorFromExpr ( RandomnessGenerator< double > &  rg,
double &  distance,
glm::dvec3 &  beamOrigin,
glm::dvec3 &  beamDirection 
)

Apply error to received measurement.

Let \(y\) be the distance with error, \(x\) be the clean distance, and \(\mathcal{N} = \mathcal{N}(\mu=0, \sigma=d_{\mathrm{acc}})\) be a normal distribution with mean \(0\) and standard deviation equal to the device accuracy ( \(d_{\mathrm{acc}}\)). But then, the distance with error can be determined as follows:

\[ y = x + \mathcal{N} f(x) \]

In the above equation, \(f(x)\) is a given expression. For instance, it is possible to define a distance dependent error in parts per million \(d_{ppm}\):

\[ \begin{split} y = &\; x + \frac{\mathcal{N}}{d_\mathrm{acc}} \left( d_{\mathrm{acc}} + x d_{\mathrm{ppm}} 10^{-6} \right) \\ = &\; x + \mathcal{N} \left( 1 + d_{\mathrm{acc}}^{-1} x d_{\mathrm{ppm}} 10^{-6} \right) \end{split} \]

More concretely, for the above expression:

\[ f(x) = 1 + \frac{x d_{\mathrm{ppm}} 10^{-6}}{d_{\mathrm{acc}}} \]

For example, let us assume \(d_{\mathrm{acc}} = 0.05\) and \(d_{ppm} = 30\). The expression string representing this would be (note \(t\) must be used as the variable when using UnivarExprTreeNode):

"1 + (t*30*10^(-6))/0.05"

Simplifying to use less operations (more efficient):

"1 + t*0.0006"

Both expressions define the function:

\[ f(x) = 1 + \frac{x \times 30 \times 10^{-6}}{0.05} \]

Continuing the previous example, it is possible to transform the noise to a standard normal distribution with mean \(0\) and standard deviation \(1\) using:

"1/0.05"

Or equivalently:

"20"

The above expression corresponds to the function:

\[ f(x) = \frac{1}{d_{\mathrm{acc}}} \]

Parameters
rgRandomnessGenerator to be used to apply error to the measure from a given univariate expression where \(t\) is the clean distance in the expression such that \(t = x\).
distanceReference to the distance where error shall be applied
beamOriginReference to the beam originWaypoint where error shall be applied
beamDirectionReference to the beam direction where error shall be applied
See also
AbstractPulseRunnable::applyMeasurementError
AbstractPulseRunnable::applyMeasurementErrorDirectly
UnivarExprTreeNode
UnivarExprTreeStringFactory

◆ capturePoint()

void AbstractPulseRunnable::capturePoint ( Measurement m,
RandomnessGenerator< double > &  rg,
std::vector< Measurement > *  allMeasurements,
std::mutex *  allMeasurementsMutex,
std::vector< Measurement > *  cycleMeasurements,
std::mutex *  cycleMeasurementsMutex 
)

Capture point if proceed and write it.

Parameters
mMeasurement
rgRandomness generator
allMeasurementsVector of all measurements to store captured point if requested
allMeasurementsMutexMutex to handle concurrent access to vector of all measurements
cycleMeasurementsVector of current cycle measurements to store captured point if requested
cycleMeasurementsMutexMutex to handle concurrent access to vector of current cycle measurements

◆ initialize()

void AbstractPulseRunnable::initialize ( )
virtual

Initialize pending attributes of the abstract pulse runnable before doing further computations.

NOTE that this method alleviates the burden of the sequential thread by supporting deferred initialization whenever possible.

Reimplemented in FullWaveformPulseRunnable.

Member Data Documentation

◆ applyMeasurementError

std::function<void( RandomnessGenerator<double> &rg, double &distance, glm::dvec3 &beamOrigin, glm::dvec3 &beamDirection )> AbstractPulseRunnable::applyMeasurementError

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