Helios++
Helios software for LiDAR simulations
HelicopterPlatform Class Reference

Class representing a helicopter platform. More...

#include <HelicopterPlatform.h>

Inheritance diagram for HelicopterPlatform:
Collaboration diagram for HelicopterPlatform:

Public Member Functions

 HelicopterPlatform ()=default
 Default helicopter platform constructor.
 
std::shared_ptr< Platformclone () override
 
void _clone (std::shared_ptr< Platform > p) override
 
void prepareSimulation (int simFrequency_hz) override
 
void initLegManual () override
 
void initLeg () override
 
bool waypointReached () override
 
void updateStaticCache () override
 
void computeTurnDistanceThreshold ()
 Compute the distance threshold with respect to expected turn.
 
void computeNonSmoothSlowdownDist ()
 Compute the slowdown distance. This is necessary when using the slowdown mode with no smooth turn. Otherwise, the helicopter will stop before arriving to destination. More...
 
void setHeadingRad (double rad) override
 
double getHeadingRad () override
 
glm::dvec3 & getSpeedXyByReference ()
 Obtain xy speed vector by reference. More...
 
RotationgetRotationByReference ()
 Obtain rotation assistance r by reference. More...
 
Rotation getDirectionalAttitude () override
 Directional attitude for HelicopterPlatform considers only the XY direction. More...
 
glm::dvec3 getCurrentDirection () override
 
bool canStopAndTurn () const override
 
void doControlStep (int simFrequency_hz) override
 Control step for simple phyisics platform simulation. More...
 
double computeLiftSinkRate ()
 Compute the lift/sink rate. More...
 
void computeXYSpeed (int simFrequency_hz)
 Compute the speed through XY and its impact on pitch.
 
void computeEngineForce (double zForceTarget)
 Compute the engine force.
 
void computeRotationAngles (int simFrequency_hz)
 Compute rotation angles (roll, pitch, yaw) More...
 
void computeAlignmentAngles ()
 Compute the rotation angles for alignment process. More...
 
void computeTurningAngles ()
 Compute the rotation angles for turning process. More...
 
void rotate (double roll, double pitch, double yaw)
 Rotate helicopter. More...
 
void handleRoute (int simFrequency_hz)
 Determine remaining iterations and start turning mode if necessary.
 
double computeSlowdownStep (double const speedMagnitude) const
 Compute speed magnitude after a slowdown step. More...
 
double computeSpeedupStep (double const speedMagnitude) const
 Compute speed magnitude after a speedup step. More...
 
- Public Member Functions inherited from SimplePhysicsPlatform
 SimplePhysicsPlatform ()=default
 Simple physics platform default constructor.
 
std::shared_ptr< Platformclone () override
 
void _clone (std::shared_ptr< Platform > p) override
 
void prepareSimulation (int simFrequency_hz) override
 
void prepareLeg (int const simFrequency_hz) override
 
void doPhysicsStep (int simFrequency_hz)
 Phyisics step for simple phyisics platform simulation. More...
 
void doSimStep (int simFrequency_hz) override
 
void configureStepMagnitude (int const simFrequency_hz)
 Configure the step magnitude for current moverPerSec and given simulation frequency. More...
 
void checkSpeedLimit ()
 
- Public Member Functions inherited from MovingPlatform
 MovingPlatform ()=default
 Moving platform default constructor.
 
void applySettings (std::shared_ptr< PlatformSettings > settings, bool manual) override
 
void initLegManual () override
 
void initLegManualIterative ()
 Method to assist manual leg initialization for moving platform when it fails. More...
 
bool waypointReached () override
 
glm::dvec3 getVelocity () override
 
void setVelocity (glm::dvec3 v)
 Set velocity vector for moving platform. More...
 
bool canMove () const override
 
- Public Member Functions inherited from Platform
 Platform ()=default
 Default platform constructor.
 
std::shared_ptr< PlatformSettingsretrieveCurrentSettings ()
 Retrieve current platform settings and build a new PlatformSettings object with them. More...
 
void updateDynamicCache ()
 Cache update which must be performed between simulation steps and after static modifications. Updating static cache also updates dynamic cache but updating dynamic cache does not update static cache. More...
 
virtual void setAttitude (Rotation attitude)
 Set platform attitude. More...
 
virtual void setOrigin (glm::dvec3 origin)
 Set platform origin way point. More...
 
virtual void setDestination (glm::dvec3 dest)
 Set platform destination way point. More...
 
virtual void setAfterDestination (glm::dvec3 next)
 Set platform after destination way point. More...
 
void setPosition (glm::dvec3 pos)
 Set platform position. More...
 
void setOffset (glm::dvec3 pos)
 Set platform position. More...
 
Rotation getAbsoluteMountAttitude () const
 Obtain platform absolute mount attitude. More...
 
glm::dvec3 getAbsoluteMountPosition () const
 Obtain platform absolute mount position. More...
 
Rotation getAttitude () const
 Obtain platform attitude. More...
 
glm::dvec3 getPosition () const
 Obtain platform position. More...
 
glm::dvec3 getVectorToTarget () const
 Obtain platform vector to target (cache) More...
 
virtual void getRollPitchYaw (double &roll, double &pitch, double &yaw)
 Obtain platform roll, pitch and yaw angles. Notice not all platforms track those angles. More...
 
virtual bool isInterpolated () const
 Check if platform is simulated (false) or interpolated (true) More...
 
- Public Member Functions inherited from Asset
std::string getLocationString ()
 Obtain asset location string. More...
 
virtual bool isEgg () const
 Check whether the asset is an EggAsset or not. More...
 

Public Attributes

double cfg_slowdown_dist_xy = 5.0
 Distance threshold to start slowdown process when not in smooth turn mode.
 
double cfg_slowdown_magnitude = 2.0
 Slowdown step magnitude.
 
double cfg_speedup_magnitude = 2.0
 Speedup step magnitude.
 
double ef_xy_max = 0.1
 Max engine force over XY plane.
 
double yaw = 0.0
 Helicopter yaw angle.
 
double roll = 0.0
 Helicopter roll angle.
 
double pitch = 0.0
 Helicopter pitch angle.
 
double lastSign = 1.0
 Helicopter rotation sign coming from previous simulation step.
 
double cfg_pitch_base = -0.087
 Base pitch angle for the helicopter.
 
double cfg_yaw_speed = 1.5
 Yaw rotation speed (units per second)
 
double cfg_roll_speed = 0.5
 Roll rotation speed (units per second)
 
double cfg_pitch_speed = 1.5
 Pitch rotation speed (units per second)
 
double cfg_max_roll_offset = 0.45
 Maximum boundary for roll angle with respect to base roll.
 
double cfg_max_pitch_offset = 0.61
 Maximum boundary for pitch angle with respect to base pitch.
 
double cfg_max_pitch = cfg_pitch_base + cfg_max_pitch_offset
 Maximum boundary for pitch angle (radians)
 
double cfg_min_pitch = cfg_pitch_base - cfg_max_pitch_offset
 Minimum boundary for pitch angle (radians)
 
double cfg_slowdownFactor
 Helicopter slowdown factor. More...
 
double cfg_speedupFactor
 Helicopter speedup factor. More...
 
double cfg_pitchStepMagnitude = 0
 Pitch step magnitude. More...
 
double cfg_rollStepMagnitude = 0
 Roll step magnitude. More...
 
double cfg_yawStepMagnitude = 0
 Yaw step magnitude. More...
 
double cfg_alignmentThreshold = 0.001
 Helicopter alignment threshold. A helicopter will be considered as aligned when the difference between target yaw and current yaw does not exceed this threshold.
 
glm::dvec3 speed_xy = glm::dvec3(0, 0, 0)
 Helicopter speed vector over xy plane.
 
glm::dvec3 lastSpeed_xy = glm::dvec3(0, 0, 0)
 Helicopter speed vector over xy plane from previous simulation step.
 
Rotation r = Rotation(glm::dvec3(1, 0, 0), 0)
 Rotation instance to assist helicopter rotation computation.
 
Rotation dirAttitudeXY = Rotation(Directions::up, 0)
 Directional attitude over XY plane for HelicopterPlatform. More...
 
int cache_turnIterations = 0
 Count of turn iterations.
 
bool cache_turning = false
 Flag specifying if helicopter is currently turning (true) or not (false)
 
bool cache_aligning = false
 
double cache_xyDistanceThreshold
 XY distance threshold to handle turning computation.
 
bool cache_speedUpFinished = false
 Flag specifying if helicopter speed-up stage has finished (true) or not (false)
 
- Public Attributes inherited from SimplePhysicsPlatform
double mCfg_drag = 1
 Drag magnitude.
 
- Public Attributes inherited from Platform
glm::dvec3 cfg_device_relativeMountPosition = glm::dvec3(0, 0, 0)
 Device mount position relative to the platform.
 
Rotation cfg_device_relativeMountAttitude
 Device mount attitude relative to the platform. More...
 
double lastCheckZ = 0
 Not used at the moment. Might be removed in the future.
 
glm::dvec3 lastGroundCheck = glm::dvec3(0, 0, 0)
 Not used at the moment. Might be removed in the future.
 
std::shared_ptr< Scenescene = nullptr
 Scene where the platform belongs to.
 
std::shared_ptr< NoiseSource< double > > positionXNoiseSource = nullptr
 Noise source for x component of platform position.
 
std::shared_ptr< NoiseSource< double > > positionYNoiseSource = nullptr
 Noise source for y component of platform position.
 
std::shared_ptr< NoiseSource< double > > positionZNoiseSource = nullptr
 Noise source for z component of platform position.
 
std::shared_ptr< NoiseSource< double > > attitudeXNoiseSource = nullptr
 Noise source for x component of platform attitude.
 
std::shared_ptr< NoiseSource< double > > attitudeYNoiseSource = nullptr
 Noise source for y component of platform attitude.
 
std::shared_ptr< NoiseSource< double > > attitudeZNoiseSource = nullptr
 Noise source for z component of platform attitude.
 
double dmax = std::numeric_limits<double>::max()
 Not used at the moment. Might be removed in the future.
 
glm::dvec3 prevWrittenPos = glm::dvec3(dmax, dmax, dmax)
 Not used at the moment. Might be removed in the future.
 
double cfg_settings_movePerSec_m = 0
 How meters per seconds the platform moves. NOTICE this behavior must be overridden by platforms implementing its own physics model.
 
glm::dvec3 originWaypoint = glm::dvec3(0, 0, 0)
 Origin waypoint.
 
glm::dvec3 targetWaypoint = glm::dvec3(0, 0, 0)
 Target waypoint (destination)
 
glm::dvec3 nextWaypoint = glm::dvec3(0, 0, 0)
 Waypoint after target. For the last target, waypoint after target is equal to the target itself.
 
bool onGround = false
 Flag to specify if the platform must be placed on ground (true) or not (false)
 
bool stopAndTurn = false
 Flag to specify if platform must work in stop and turn mode (true) or not (false). Not all platforms support this mode, so it will only be used when possible.
 
bool smoothTurn = false
 Flag to specify if platform must work in smooth turn mode (true) or not (false). Not all platforms support this mode, so it will only be used when possible.
 
bool slowdownEnabled = true
 Flag to specify if slowdown stage must be enabled (true) or not (false). Not all platforms have a slowdown stage, so this flag will only be applied when it is necessary.
 
glm::dvec3 position = glm::dvec3(0, 0, 0)
 Platform 3D position.
 
Rotation attitude = Rotation(Directions::up, 0)
 Platform 3D attitude.
 
bool mSetOrientationOnLegInit = false
 Not used at the moment. Might be removed in the future.
 
bool writeNextTrajectory = true
 Flag to specify if next trajectory needs to be written (true) or not (false)
 
glm::dvec3 cached_absoluteMountPosition = glm::dvec3(0, 0, 0)
 Cached absolute mount position.
 
Rotation cached_absoluteMountAttitude = Rotation(glm::dvec3(0, 1, 0), 0)
 Cached absolute mount attitude.
 
glm::dvec3 cached_dir_current = glm::dvec3(0, 0, 0)
 Current director vector over XY plane.
 
glm::dvec3 cached_dir_current_xy = glm::dvec3(0, 0, 0)
 Current director vector over XY plane (z is always 0)
 
glm::dvec3 cached_vectorToTarget = glm::dvec3(0, 0, 0)
 Distance vector from current position to target.
 
glm::dvec3 cached_vectorToTarget_xy = glm::dvec3(0, 0, 0)
 Distance vector from current position to target over XY plane (z is always 0)
 
double cached_distanceToTarget_xy = 0
 Distance on XY plane between current position and target.
 
glm::dvec3 cached_originToTargetDir_xy = glm::dvec3(0, 0, 0)
 Director vector from origin to target over the XY plane (z is always 0).
 
glm::dvec3 cached_targetToNextDir_xy = glm::dvec3(0, 0, 0)
 Director vector from target to after target waypoint over the XY plane (z is always 0).
 
double cached_endTargetAngle_xy
 Angle between director vector from origin to target and director vector from target to waypoint after target.
 
double cached_currentAngle_xy
 Angle between current director vector and director vector from target to waypoint after target.
 
double cached_originToTargetAngle_xy
 Angle in \([0, 2\pi)\) which identifies director vector from origin waypoint to target waypoint.
 
double cached_targetToNextAngle_xy
 Angle in \([0, 2\pi)\) which identifies director vector from target waypoint to waypoint after target.
 
- Public Attributes inherited from Asset
std::string id = ""
 Asset identifier.
 
std::string name = "Unnamed Asset"
 Asset name.
 
std::string sourceFilePath = ""
 Path to asset file.
 

Additional Inherited Members

- Protected Attributes inherited from SimplePhysicsPlatform
glm::dvec3 mEngineForce = glm::dvec3(0, 0, 0)
 Engine force vector.
 
glm::dvec3 mCfg_g_accel = glm::dvec3(0, 0, -9.81)
 Gravity acceleration vector.
 
double movePerSec_m_stepMagnitude = 0.0
 How many meter does the platform move in each simulation step.
 
bool engineLimitReached = false
 Flag to store if the engine max thrust was reached in a given leg. The value is reset en each leg.
 
bool userSpeedLimitReached = false
 Flag to store if the user-provided movePerSec_m speed was achieved for a given leg.
 

Detailed Description

Class representing a helicopter platform.

Member Function Documentation

◆ canStopAndTurn()

bool HelicopterPlatform::canStopAndTurn ( ) const
inlineoverridevirtual
See also
Platform::canStopAndTurn

Reimplemented from Platform.

◆ computeAlignmentAngles()

void HelicopterPlatform::computeAlignmentAngles ( )

Compute the rotation angles for alignment process.

The alignment process is necessary to align platform orientation at the beginning of a new leg when the turning process at the ending of previous leg had changed it.

◆ computeLiftSinkRate()

double HelicopterPlatform::computeLiftSinkRate ( )

Compute the lift/sink rate.

Returns
Ascend/descend speed

◆ computeNonSmoothSlowdownDist()

void HelicopterPlatform::computeNonSmoothSlowdownDist ( )

Compute the slowdown distance. This is necessary when using the slowdown mode with no smooth turn. Otherwise, the helicopter will stop before arriving to destination.

See also
HelicopterPlatform::cfg_slowdown_dist_xy

◆ computeRotationAngles()

void HelicopterPlatform::computeRotationAngles ( int  simFrequency_hz)

Compute rotation angles (roll, pitch, yaw)

Parameters
[in]simFrequency_hzSimulation frequency (in hz)
See also
HelicopterPlatform::rotate

◆ computeSlowdownStep()

double HelicopterPlatform::computeSlowdownStep ( double const  speedMagnitude) const
inline

Compute speed magnitude after a slowdown step.

Parameters
[in]speedMagnitudeThe speed vector magnitude/norm
Returns
Speed magnitude after slowdown

◆ computeSpeedupStep()

double HelicopterPlatform::computeSpeedupStep ( double const  speedMagnitude) const
inline

Compute speed magnitude after a speedup step.

Parameters
[in]speedMagnitudethe speed vector magnitude/norm
Returns
Speed magnitude after speedup

◆ computeTurningAngles()

void HelicopterPlatform::computeTurningAngles ( )

Compute the rotation angles for turning process.

The turning process changes platform orientation at the end of current leg so the platform faces the next target waypoint

◆ doControlStep()

void HelicopterPlatform::doControlStep ( int  simFrequency_hz)
overridevirtual

Control step for simple phyisics platform simulation.

Parameters
simFrequency_hzSimulation frequency

Reimplemented from SimplePhysicsPlatform.

◆ getCurrentDirection()

glm::dvec3 HelicopterPlatform::getCurrentDirection ( )
overridevirtual
See also
Platform::getCurrentDirection

Reimplemented from Platform.

◆ getDirectionalAttitude()

Rotation HelicopterPlatform::getDirectionalAttitude ( )
inlineoverridevirtual

Directional attitude for HelicopterPlatform considers only the XY direction.

See also
Platform::getDirectionalAttitude

Reimplemented from Platform.

◆ getHeadingRad()

double HelicopterPlatform::getHeadingRad ( )
inlineoverridevirtual
See also
Platform::getHeadingRad

Reimplemented from Platform.

◆ getRotationByReference()

Rotation& HelicopterPlatform::getRotationByReference ( )
inline

Obtain rotation assistance r by reference.

Returns
Reference to rotation assistance r

◆ getSpeedXyByReference()

glm::dvec3& HelicopterPlatform::getSpeedXyByReference ( )
inline

Obtain xy speed vector by reference.

Returns
Reference to xy speed vector

◆ initLeg()

void HelicopterPlatform::initLeg ( )
overridevirtual
See also
Platform::initLeg

Reimplemented from Platform.

◆ initLegManual()

void HelicopterPlatform::initLegManual ( )
overridevirtual
See also
Platform::initLegManual

Reimplemented from Platform.

◆ prepareSimulation()

void HelicopterPlatform::prepareSimulation ( int  simFrequency_hz)
overridevirtual
See also
Platform::prepareSimulation

Reimplemented from Platform.

◆ rotate()

void HelicopterPlatform::rotate ( double  roll,
double  pitch,
double  yaw 
)

Rotate helicopter.

Parameters
[in]rollRotation angle for \((y,z)\) over x-axis
[in]pitchRotation angle for \((x,z)\) over y-axis
[in]yawRotation angle for \((x,y)\) over z-axis

◆ setHeadingRad()

void HelicopterPlatform::setHeadingRad ( double  rad)
inlineoverridevirtual
See also
Platform::setHeadingRad

Reimplemented from Platform.

◆ updateStaticCache()

void HelicopterPlatform::updateStaticCache ( )
overridevirtual
See also
Platform::updateStaticCache

Reimplemented from Platform.

◆ waypointReached()

bool HelicopterPlatform::waypointReached ( )
overridevirtual
See also
Platform::waypointReached

Reimplemented from Platform.

Member Data Documentation

◆ cache_aligning

bool HelicopterPlatform::cache_aligning = false

@biref Flag specifying if helicopter is currently aligning (true) or not (false)

◆ cfg_pitchStepMagnitude

double HelicopterPlatform::cfg_pitchStepMagnitude = 0

Pitch step magnitude.

\[ \textrm{pitchStepMagnitude} = \frac{\textrm{pitchSpeed}}{\textrm{simFrequency}} \]

◆ cfg_rollStepMagnitude

double HelicopterPlatform::cfg_rollStepMagnitude = 0

Roll step magnitude.

\[ \textrm{rollStepMagnitude} = \frac{\textrm{rollSpeed}}{\textrm{simFrequency}} \]

◆ cfg_slowdownFactor

double HelicopterPlatform::cfg_slowdownFactor

Helicopter slowdown factor.

\[ \textrm{slowdownFactor} = 1 - \frac{\textrm{slowdownMagnitude}}{\textrm{simFrequency}} \]

◆ cfg_speedupFactor

double HelicopterPlatform::cfg_speedupFactor

Helicopter speedup factor.

\[ \textrm{speedupFactor} = 1 + \frac{\textrm{speedupMagnitude}}{\textrm{simFrequency}} \]

◆ cfg_yawStepMagnitude

double HelicopterPlatform::cfg_yawStepMagnitude = 0

Yaw step magnitude.

\[ \textrm{yawnStepMagnitude} = \frac{\textrm{yawSpeed}}{\textrm{simFrequency}} \]

◆ dirAttitudeXY

Rotation HelicopterPlatform::dirAttitudeXY = Rotation(Directions::up, 0)

Directional attitude over XY plane for HelicopterPlatform.

See also
HelicopterPlatform::getDirectionalAttitude

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