Helios++
Helios software for LiDAR simulations
Platform Class Reference

Class representing a platform asset. More...

#include <Platform.h>

Inheritance diagram for Platform:
Collaboration diagram for Platform:

Public Member Functions

 Platform ()=default
 Default platform constructor.
 
virtual std::shared_ptr< Platformclone ()
 
virtual void _clone (std::shared_ptr< Platform > p)
 
virtual void prepareSimulation (int simFrequency_hz)
 Prepare the platform to deal with simulation. More...
 
virtual void prepareLeg (int const simFrequency_hz)
 Prepare the platform to deal with the next leg. More...
 
virtual void applySettings (std::shared_ptr< PlatformSettings > settings, bool manual)
 Apply given platform settings to the platform. More...
 
std::shared_ptr< PlatformSettingsretrieveCurrentSettings ()
 Retrieve current platform settings and build a new PlatformSettings object with them. More...
 
virtual void updateStaticCache ()
 Cache update which only needs to be performed after static modifications. Updating static cache also updates dynamic cache. 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 bool waypointReached ()
 Check if platform has reached its destination way point (true) or not (false) More...
 
virtual void doSimStep (int simFrequency_hz)
 Do corresponding computations for the platform at current simulation step. More...
 
virtual void initLegManual ()
 Function to initialize leg when working in manual mode.
 
virtual void initLeg ()
 Function to initialize leg when working in default mode.
 
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...
 
virtual Rotation getDirectionalAttitude ()
 Obtain the directional attitude. While the attitude represents the platform orientation, the directional attitude represents the movement direction. More...
 
virtual glm::dvec3 getCurrentDirection ()
 Obtain platform current direction.
 
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 void setHeadingRad (double rad)
 Set the heading angle in radians. This angle can be understood as yaw in most cases. More...
 
virtual double getHeadingRad ()
 Obtain platform heading angle in radians, which can be understood as yaw in most cases. More...
 
virtual glm::dvec3 getVelocity ()
 Obtain platform velocity vector. More...
 
virtual bool canMove () const
 Check if platform can move (true) or not (false) More...
 
virtual bool canStopAndTurn () const
 Check if platform support stop and turn mode (true) or not (false) 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

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.
 

Detailed Description

Class representing a platform asset.

Member Function Documentation

◆ applySettings()

void Platform::applySettings ( std::shared_ptr< PlatformSettings settings,
bool  manual 
)
virtual

Apply given platform settings to the platform.

Parameters
settingsSettings to be applied to the platform
manualNot used by base Platform class.

Reimplemented in MovingPlatform.

◆ canMove()

virtual bool Platform::canMove ( ) const
inlinevirtual

Check if platform can move (true) or not (false)

Returns
True if platform can move, false otherwise

Reimplemented in MovingPlatform.

◆ canStopAndTurn()

virtual bool Platform::canStopAndTurn ( ) const
inlinevirtual

Check if platform support stop and turn mode (true) or not (false)

Returns
True if platform support stop and turn mode, false otherwise

Reimplemented in HelicopterPlatform.

◆ doSimStep()

virtual void Platform::doSimStep ( int  simFrequency_hz)
inlinevirtual

Do corresponding computations for the platform at current simulation step.

Parameters
simFrequency_hzSimulation frequency

Reimplemented in SimplePhysicsPlatform, MovingPlatform, LinearPathPlatform, and InterpolatedMovingPlatform.

◆ getAbsoluteMountAttitude()

Rotation Platform::getAbsoluteMountAttitude ( ) const
inline

Obtain platform absolute mount attitude.

Returns
Platform absolute mount attitude

◆ getAbsoluteMountPosition()

glm::dvec3 Platform::getAbsoluteMountPosition ( ) const
inline

Obtain platform absolute mount position.

Returns
Platform absolute mount position

◆ getAttitude()

Rotation Platform::getAttitude ( ) const
inline

Obtain platform attitude.

Returns
Platform attitude

◆ getDirectionalAttitude()

virtual Rotation Platform::getDirectionalAttitude ( )
inlinevirtual

Obtain the directional attitude. While the attitude represents the platform orientation, the directional attitude represents the movement direction.

By default, attitude and directional attitude are the same. But certain platform types might require to consider both attitudes separately.

Reimplemented in HelicopterPlatform.

◆ getHeadingRad()

virtual double Platform::getHeadingRad ( )
inlinevirtual

Obtain platform heading angle in radians, which can be understood as yaw in most cases.

Returns
Platform heading angle in radians

Reimplemented in HelicopterPlatform.

◆ getPosition()

glm::dvec3 Platform::getPosition ( ) const
inline

Obtain platform position.

Returns
Platform position

◆ getRollPitchYaw()

virtual void Platform::getRollPitchYaw ( double &  roll,
double &  pitch,
double &  yaw 
)
inlinevirtual

Obtain platform roll, pitch and yaw angles. Notice not all platforms track those angles.

Parameters
[out]rollUsed to return roll angle
[out]pitchUsed to return pitch angle
[out]yawUsed to return yaw angle

Reimplemented in InterpolatedMovingPlatform.

◆ getVectorToTarget()

glm::dvec3 Platform::getVectorToTarget ( ) const
inline

Obtain platform vector to target (cache)

Returns
Platform vector to target (cache)

◆ getVelocity()

virtual glm::dvec3 Platform::getVelocity ( )
inlinevirtual

Obtain platform velocity vector.

Returns
Platform velocity vector

Reimplemented in MovingPlatform.

◆ isInterpolated()

virtual bool Platform::isInterpolated ( ) const
inlinevirtual

Check if platform is simulated (false) or interpolated (true)

Returns
False if platform is simulated, True otherwise

Reimplemented in InterpolatedMovingPlatform.

◆ prepareLeg()

virtual void Platform::prepareLeg ( int const  simFrequency_hz)
inlinevirtual

Prepare the platform to deal with the next leg.

Parameters
simFrequency_hzSimulation frequency the platform will work with

Reimplemented in SimplePhysicsPlatform.

◆ prepareSimulation()

virtual void Platform::prepareSimulation ( int  simFrequency_hz)
inlinevirtual

Prepare the platform to deal with simulation.

Parameters
simFrequency_hzSimulation frequency the platform will work with

Reimplemented in SimplePhysicsPlatform, HelicopterPlatform, and GroundVehiclePlatform.

◆ retrieveCurrentSettings()

shared_ptr< PlatformSettings > Platform::retrieveCurrentSettings ( )

Retrieve current platform settings and build a new PlatformSettings object with them.

Returns
Newly created PlatformSettings object with current platform settings

◆ setAfterDestination()

void Platform::setAfterDestination ( glm::dvec3  next)
virtual

Set platform after destination way point.

Parameters
nextNew after destination way point

◆ setAttitude()

void Platform::setAttitude ( Rotation  attitude)
virtual

Set platform attitude.

Parameters
attitudeNew attitude for the platform

◆ setDestination()

void Platform::setDestination ( glm::dvec3  dest)
virtual

Set platform destination way point.

Parameters
destNew destination way point

Reimplemented in LinearPathPlatform, and GroundVehiclePlatform.

◆ setHeadingRad()

virtual void Platform::setHeadingRad ( double  rad)
inlinevirtual

Set the heading angle in radians. This angle can be understood as yaw in most cases.

Parameters
radNew heading angle in radians

Reimplemented in HelicopterPlatform.

◆ setOffset()

void Platform::setOffset ( glm::dvec3  pos)

Set platform position.

Parameters
posNew position for the platform

◆ setOrigin()

void Platform::setOrigin ( glm::dvec3  origin)
virtual

Set platform origin way point.

Parameters
originNew origin way point

◆ setPosition()

void Platform::setPosition ( glm::dvec3  pos)

Set platform position.

Parameters
posNew position for the platform

◆ updateDynamicCache()

void Platform::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.

See also
Platform::updateStaticCache

◆ updateStaticCache()

void Platform::updateStaticCache ( )
virtual

Cache update which only needs to be performed after static modifications. Updating static cache also updates dynamic cache.

"

See also
Platform::updateDynamicCache

Reimplemented in HelicopterPlatform.

◆ waypointReached()

bool Platform::waypointReached ( )
virtual

Check if platform has reached its destination way point (true) or not (false)

Returns
True if platform destination way point has been reached (true) or not (false)

Reimplemented in MovingPlatform, InterpolatedMovingPlatform, and HelicopterPlatform.

Member Data Documentation

◆ cfg_device_relativeMountAttitude

Rotation Platform::cfg_device_relativeMountAttitude
Initial value:
glm::dvec3(0, 1, 0), 0
)
Definition: Rotation.h:80

Device mount attitude relative to the platform.


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