Helios++
Helios software for LiDAR simulations
FullWaveformPulseRunnable Class Reference

Concrete implementation of abstract pulse runnable to compute full waveform pulses. More...

#include <FullWaveformPulseRunnable.h>

Inheritance diagram for FullWaveformPulseRunnable:
Collaboration diagram for FullWaveformPulseRunnable:

Public Member Functions

 FullWaveformPulseRunnable (std::shared_ptr< Scanner > scanner, SimulatedPulse const &pulse)
 Base constructor for full waveform pulse runnable. More...
 
void operator() () override
 Full waveform pulse runnable void functor. It is necessary due to compatibility reasons. More...
 
void operator() (std::vector< std::vector< double >> &apMatrix, RandomnessGenerator< double > &randGen, RandomnessGenerator< double > &randGen2, NoiseSource< double > &intersectionHandlingNoiseSource) override
 Full waveform pulse runnable functor. More...
 
- Public Member Functions inherited from AbstractPulseRunnable
 AbstractPulseRunnable (std::shared_ptr< Scanner > const scanner, SimulatedPulse const &pulse)
 Base constructor for pulse runnables. 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...
 

Static Public Attributes

static const double eps = 0.001
 Decimal precision constant for FullWaveformPulseRunnable computations.
 

Private Member Functions

void initialize () override
 Initialize pending attributes of the full waveform pulse runnable before doing further computations. This implies calling the AbstractPulseRunnable::initialize method. More...
 
void computeSubrays (vector< double > const &tMinMax, NoiseSource< double > &intersectionHandlingNoiseSource, std::map< double, double > &reflections, vector< RaySceneIntersection > &intersects)
 Perform ray casting to find intersections. More...
 
void handleSubray (vector< double > const &tMinMax, int const circleStep, double const circleStep_rad, Rotation &r1, double const divergenceAngle, NoiseSource< double > &intersectionHandlingNoiseSource, std::map< double, double > &reflections, vector< RaySceneIntersection > &intersects)
 Handle sub-rays along the circle. More...
 
void digestIntersections (std::vector< std::vector< double >> &apMatrix, RandomnessGenerator< double > &randGen, RandomnessGenerator< double > &randGen2, glm::dvec3 &beamDir, std::map< double, double > &reflections, vector< RaySceneIntersection > &intersects)
 Digest intersections found through ray casting. More...
 
void findMaxMinHitDistances (std::map< double, double > &reflections, double &minHitDist_m, double &maxHitDist_m)
 Find min and max hit distances in meters. More...
 
bool initializeFullWaveform (double const minHitDist_m, double const maxHitDist_m, double &minHitTime_ns, double &maxHitTime_ns, double &nsPerBin, double &distanceThreshold, int &peakIntensityIndex, int &numFullwaveBins)
 Initialize full waveform While the vector is not strictly initialized in this function, necessary variables are computed here. More...
 
void populateFullWaveform (std::map< double, double > const &reflections, std::vector< double > &fullwave, double const distanceThreshold, double const minHitTime_ns, double const nsPerBin, int const peakIntensityIndex)
 Populate a previously initialized full waveform vector. More...
 
void digestFullWaveform (std::vector< Measurement > &pointsMeasurement, int &numReturns, std::vector< std::vector< double >> &apMatrix, std::vector< double > const &fullwave, vector< RaySceneIntersection > const &intersects, glm::dvec3 const &beamDir, double const nsPerBin, int const numFullwaveBins, int const peakIntensityIndex, double const minHitTime_ns)
 Digest a previously populated full waveform vector, generating measurements. More...
 
void exportOutput (std::vector< double > &fullwave, int const numReturns, std::vector< Measurement > &pointsMeasurement, glm::dvec3 const &beamDir, double const minHitTime_ns, double const maxHitTime_ns, RandomnessGenerator< double > &randGen, RandomnessGenerator< double > &randGen2)
 Export measurements and full waveform data. More...
 
virtual shared_ptr< RaySceneIntersectionfindIntersection (vector< double > const &tMinMax, glm::dvec3 const &o, glm::dvec3 const &v) const
 Find the intersection between the scene and given ray, if any. More...
 
bool detectPeak (int const i, int const win_size, vector< double > const &fullwave)
 Detect full waveform peaks.
 
void captureFullWave (std::vector< double > &fullwave, int const fullwaveIndex, double const min_time, double const max_time, glm::dvec3 const &beamOrigin, glm::dvec3 const &beamDir, double const gpstime, bool const fullWaveNoise, RandomnessGenerator< double > &rg2)
 Capture full wave. More...
 

Private Attributes

std::shared_ptr< FullWaveformPulseDetectorfwDetector = nullptr
 Full waveform pulse detector used to handle pulse computation.
 

Additional Inherited Members

- Public Attributes inherited from AbstractPulseRunnable
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

Concrete implementation of abstract pulse runnable to compute full waveform pulses.

See also
AbstractPulseRunnable

Constructor & Destructor Documentation

◆ FullWaveformPulseRunnable()

FullWaveformPulseRunnable::FullWaveformPulseRunnable ( std::shared_ptr< Scanner scanner,
SimulatedPulse const &  pulse 
)
inline

Base constructor for full waveform pulse runnable.

See also
AbstractPulseRunnable::AbstractPulseRunnable( std::shared_ptr<AbstractDetector>, SimulatedPulse const &)
SimulatedPulse

Member Function Documentation

◆ captureFullWave()

void FullWaveformPulseRunnable::captureFullWave ( std::vector< double > &  fullwave,
int const  fullwaveIndex,
double const  min_time,
double const  max_time,
glm::dvec3 const &  beamOrigin,
glm::dvec3 const &  beamDir,
double const  gpstime,
bool const  fullWaveNoise,
RandomnessGenerator< double > &  rg2 
)
private

Capture full wave.

Parameters
fullwaveFull wave vector
fullwaveIndexFull wave index
min_timeMinimum hit time (nanoseconds)
max_timeMaximum hit time (nanoseconds)
beamOriginBeam origin in absolute coordinates
beamDirBeam director vector
gpstimeCurrent GPS time (nanoseconds)
fullWaveNoiseflag to specify if noise must be added to the full wave (true) or not (false)
rg2Randomness generator to be used to add noise to the full wave if requested

◆ computeSubrays()

void FullWaveformPulseRunnable::computeSubrays ( vector< double > const &  tMinMax,
NoiseSource< double > &  intersectionHandlingNoiseSource,
std::map< double, double > &  reflections,
vector< RaySceneIntersection > &  intersects 
)
private

Perform ray casting to find intersections.

Parameters
[in]tMinMaxMinimum and maximum time to intersection with respect to the axis aligned bounding box that bounds the scene
[out]reflectionsWhere reflections must be stored when a hit is registered
[out]intersectsWhere intersections must be stored when a hit is registered
See also
FullWaveformPulseRunnable::handleSubray

◆ digestFullWaveform()

void FullWaveformPulseRunnable::digestFullWaveform ( std::vector< Measurement > &  pointsMeasurement,
int &  numReturns,
std::vector< std::vector< double >> &  apMatrix,
std::vector< double > const &  fullwave,
vector< RaySceneIntersection > const &  intersects,
glm::dvec3 const &  beamDir,
double const  nsPerBin,
int const  numFullwaveBins,
int const  peakIntensityIndex,
double const  minHitTime_ns 
)
private

Digest a previously populated full waveform vector, generating measurements.

Parameters
[out]pointsMeasurementWhere generated measurements will be stored
[out]numReturnsNumber of returns will be stored here
fullwaveFull waveform vector to be digested
See also
FullWaveformPulseRunnable::digestIntersections
FullWaveformPulseRunnable::populateFullWaveform
Measurement

◆ digestIntersections()

void FullWaveformPulseRunnable::digestIntersections ( std::vector< std::vector< double >> &  apMatrix,
RandomnessGenerator< double > &  randGen,
RandomnessGenerator< double > &  randGen2,
glm::dvec3 &  beamDir,
std::map< double, double > &  reflections,
vector< RaySceneIntersection > &  intersects 
)
private

Digest intersections found through ray casting.

Parameters
[in]beamDirBeam normalized director vector
[out]reflectionsWhere reflections must be stored when a hit is registered
[out]intersectsWhere intersections must be stored when a hit is registered
See also
FullWaveformPulseRunnable::computeSubrays
FullWaveformPulseRunnable::findMaxMinHitDistances
FullWaveformPulseRunnable::initializeFullWaveform
FullWaveformPulseRunnable::populateFullWaveform
FullWaveformPulseRunnable::digestFullWaveform
FullWaveformPulseRunnable::exportOutput

◆ exportOutput()

void FullWaveformPulseRunnable::exportOutput ( std::vector< double > &  fullwave,
int const  numReturns,
std::vector< Measurement > &  pointsMeasurement,
glm::dvec3 const &  beamDir,
double const  minHitTime_ns,
double const  maxHitTime_ns,
RandomnessGenerator< double > &  randGen,
RandomnessGenerator< double > &  randGen2 
)
private

Export measurements and full waveform data.

Parameters
[in]fullwaveFull waveform data to export
[in]pointsMeasurementPoint cloud data to export
See also
FullWaveformPulseRunnable::digestIntersections

◆ findIntersection()

shared_ptr< RaySceneIntersection > FullWaveformPulseRunnable::findIntersection ( vector< double > const &  tMinMax,
glm::dvec3 const &  o,
glm::dvec3 const &  v 
) const
privatevirtual

Find the intersection between the scene and given ray, if any.

Parameters
[in]tMinMaxMinimum and maximum time to intersection with respect to the axis aligned bounding box that bounds the scene
oThe ray origin
vThe ray director vector
Returns
Intersection between the scene and given ray

Reimplemented in DynFullWaveformPulseRunnable.

◆ findMaxMinHitDistances()

void FullWaveformPulseRunnable::findMaxMinHitDistances ( std::map< double, double > &  reflections,
double &  minHitDist_m,
double &  maxHitDist_m 
)
private

Find min and max hit distances in meters.

Parameters
[out]minHitDist_mMin hit distance will be stored here
[out]maxHitDist_mMax hit distance will be stored here
See also
FullWaveformPulseRunnable::digestIntersections

◆ handleSubray()

void FullWaveformPulseRunnable::handleSubray ( vector< double > const &  tMinMax,
int const  circleStep,
double const  circleStep_rad,
Rotation r1,
double const  divergenceAngle,
NoiseSource< double > &  intersectionHandlingNoiseSource,
std::map< double, double > &  reflections,
vector< RaySceneIntersection > &  intersects 
)
private

Handle sub-rays along the circle.

Parameters
[in]tMinMaxMinimum and maximum time to intersection with respect to the axis aligned bounding box that bounds the scene
[in]circleStepThe iteration along the circle
[in]circleStep_radAngle in radians corresponding to the iteration
[in]r1Sub-beam rotation into divergence step
[in]divergenceAngleSubray divergence angle in radians
See also
FullWaveformPulseRunnable::computeSubrays

◆ initialize()

void FullWaveformPulseRunnable::initialize ( )
overrideprivatevirtual

Initialize pending attributes of the full waveform pulse runnable before doing further computations. This implies calling the AbstractPulseRunnable::initialize method.

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

See also
AbstractPulseRunnable::initialize

Reimplemented from AbstractPulseRunnable.

◆ initializeFullWaveform()

bool FullWaveformPulseRunnable::initializeFullWaveform ( double const  minHitDist_m,
double const  maxHitDist_m,
double &  minHitTime_ns,
double &  maxHitTime_ns,
double &  nsPerBin,
double &  distanceThreshold,
int &  peakIntensityIndex,
int &  numFullwaveBins 
)
private

Initialize full waveform While the vector is not strictly initialized in this function, necessary variables are computed here.

Parameters
[out]nsPerBinThe size of each bin in nano seconds
[out]distanceThresholdLimit distance threshold
[out]peakIntensityIndexIndex of intensity peak
[out]numFullwaveBinsHow many bins are necessary to discretize the full waveform
Returns
True if it is possible to initialize the full waveform, false otherwise.
See also
FullWaveformPulseRunnable::digestIntersections

◆ operator()() [1/2]

void FullWaveformPulseRunnable::operator() ( )
inlineoverridevirtual

Full waveform pulse runnable void functor. It is necessary due to compatibility reasons.

See also
AbstractPulseRunnable::operator()

Implements PulseTask.

◆ operator()() [2/2]

void FullWaveformPulseRunnable::operator() ( std::vector< std::vector< double >> &  apMatrix,
RandomnessGenerator< double > &  randGen,
RandomnessGenerator< double > &  randGen2,
NoiseSource< double > &  intersectionHandlingNoiseSource 
)
overridevirtual

Full waveform pulse runnable functor.

Parameters
apMatrixReference to matrix to be used to compute Marquardt fitter
randGenA randomness generator
randGen2Another randomness generator
intersectionHandlingNoiseSourceNoise source to be used at intersection handling if necessary
See also
AbstractPulseRunnable::operator()()

Implements PulseTask.

◆ populateFullWaveform()

void FullWaveformPulseRunnable::populateFullWaveform ( std::map< double, double > const &  reflections,
std::vector< double > &  fullwave,
double const  distanceThreshold,
double const  minHitTime_ns,
double const  nsPerBin,
int const  peakIntensityIndex 
)
private

Populate a previously initialized full waveform vector.

Parameters
[out]fullwaveFull waveform vector to be populated
See also
FullWaveformPulseRunnable::digestIntersections
FullWaveformPulseRunnable::initializeFullWaveform

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