Helios++
Helios software for LiDAR simulations
InterpolatedMovingPlatformEgg.h
1 #pragma once
2 
3 #include <assetloading/EggAsset.h>
4 #include <platform/InterpolatedMovingPlatform.h>
5 #include <sim/comps/SimulationStepLoop.h>
6 
17  public EggAsset<
18  InterpolatedMovingPlatform,
19  SimulationStepLoop &
20  >,
21  public MovingPlatform
22 {
23 public:
24  // *** ATTRIBUTES *** //
25  // ******************** //
27  InterpolatedMovingPlatform::InterpolationScope::POSITION_AND_ATTITUDE;
29  InterpolatedMovingPlatform::RotationSpec::CANONICAL;
30  std::shared_ptr<TemporalDesignMatrix<double, double>> tdm;
31  std::shared_ptr<DiffDesignMatrix<double, double>> ddm;
32  bool syncGPSTime; // If true, set start GPS time to first time from data
33  double startTime; // To be used when syncGPSTime is true and also to
34  // translate to simulation time s.t. -startTime
35  // It is given in seconds, not nanoseconds
36 
37 
38  // *** CONSTRUCTION / DESTRUCTION *** //
39  // ************************************ //
41  EggAsset(),
42  scope(
44  InterpolationScope::POSITION_AND_ATTITUDE
45  ),
46  tdm(nullptr),
47  ddm(nullptr),
48  syncGPSTime(false),
49  startTime(0)
50  {}
51  virtual ~InterpolatedMovingPlatformEgg() = default;
52 
53  // *** EGG METHODS *** //
54  // ********************* //
55  InterpolatedMovingPlatform hatch(SimulationStepLoop &stepLoop) override{
57  stepLoop,
58  *tdm,
59  *ddm,
60  scope,
61  syncGPSTime,
62  startTime,
63  rotspec
64  );
65  fulfillPlatform(imp);
66  return imp;
67  }
68  std::shared_ptr<InterpolatedMovingPlatform> smartHatch(
69  SimulationStepLoop &stepLoop
70  ) override{
71  std::shared_ptr<InterpolatedMovingPlatform> imp =
72  std::make_shared<InterpolatedMovingPlatform>(
73  stepLoop,
74  *tdm,
75  *ddm,
76  scope,
77  syncGPSTime,
78  startTime,
79  rotspec
80  );
81  fulfillPlatform(*imp);
82  return imp;
83  }
84 
85 protected:
86  // *** INNER UTIL METHODS *** //
87  // **************************** //
93  // Platform attributes
96  imp.lastCheckZ = lastCheckZ;
98  imp.scene = scene;
105  imp.dmax = dmax;
111  imp.onGround = onGround;
112  imp.stopAndTurn = stopAndTurn;
113  imp.smoothTurn = smoothTurn;
115  imp.position = position;
116  imp.attitude = attitude;
119  // Platform cached attributes
133  // Moving platform attributes
134  imp.setVelocity(getVelocity());
135  }
136 
137 public:
138  // *** GETTERs and SETTERs *** //
139  // ***************************** //
143  bool isEgg() const override {
144  return EggAsset<
146  >::isEgg();
147  }
148 };
An EggAsset is an asset that can hatch to its full class.
Definition: EggAsset.h:18
EggAsset()
Default constructor for EggAsset.
Definition: EggAsset.h:25
Egg class that can hatch to a full InterpolatedMovingPlatform class.
Definition: InterpolatedMovingPlatformEgg.h:22
void fulfillPlatform(InterpolatedMovingPlatform &imp)
Fulfill given InterpolatedMovingPlatform with data from the egg.
Definition: InterpolatedMovingPlatformEgg.h:92
bool isEgg() const override
Definition: InterpolatedMovingPlatformEgg.h:143
Class representing a MovingPlatform which position is defined by a function interpolated from a Desig...
Definition: InterpolatedMovingPlatform.h:23
InterpolationScope
Specify what is the interpolation scope. It is, which components are interpolated.
Definition: InterpolatedMovingPlatform.h:29
RotationSpec
Rotation specifications supported by the interpolated moving platform.
Definition: InterpolatedMovingPlatform.h:38
Class representing a moving platform.
Definition: MovingPlatform.h:8
void setVelocity(glm::dvec3 v)
Set velocity vector for moving platform.
Definition: MovingPlatform.h:69
glm::dvec3 getVelocity() override
Definition: MovingPlatform.h:62
bool stopAndTurn
Flag to specify if platform must work in stop and turn mode (true) or not (false)....
Definition: Platform.h:117
Rotation attitude
Platform 3D attitude.
Definition: Platform.h:139
glm::dvec3 cached_absoluteMountPosition
Cached absolute mount position.
Definition: Platform.h:157
double cfg_settings_movePerSec_m
How meters per seconds the platform moves. NOTICE this behavior must be overridden by platforms imple...
Definition: Platform.h:92
std::shared_ptr< Scene > scene
Scene where the platform belongs to.
Definition: Platform.h:49
double lastCheckZ
Not used at the moment. Might be removed in the future.
Definition: Platform.h:41
glm::dvec3 cached_vectorToTarget_xy
Distance vector from current position to target over XY plane (z is always 0)
Definition: Platform.h:180
glm::dvec3 cached_originToTargetDir_xy
Director vector from origin to target over the XY plane (z is always 0).
Definition: Platform.h:191
double cached_originToTargetAngle_xy
Angle in which identifies director vector from origin waypoint to target waypoint.
Definition: Platform.h:211
glm::dvec3 cached_vectorToTarget
Distance vector from current position to target.
Definition: Platform.h:175
double cached_endTargetAngle_xy
Angle between director vector from origin to target and director vector from target to waypoint after...
Definition: Platform.h:201
bool onGround
Flag to specify if the platform must be placed on ground (true) or not (false)
Definition: Platform.h:111
bool smoothTurn
Flag to specify if platform must work in smooth turn mode (true) or not (false). Not all platforms su...
Definition: Platform.h:123
double cached_targetToNextAngle_xy
Angle in which identifies director vector from target waypoint to waypoint after target.
Definition: Platform.h:216
bool slowdownEnabled
Flag to specify if slowdown stage must be enabled (true) or not (false). Not all platforms have a slo...
Definition: Platform.h:129
bool writeNextTrajectory
Flag to specify if next trajectory needs to be written (true) or not (false)
Definition: Platform.h:149
glm::dvec3 cached_targetToNextDir_xy
Director vector from target to after target waypoint over the XY plane (z is always 0).
Definition: Platform.h:196
double dmax
Not used at the moment. Might be removed in the future.
Definition: Platform.h:81
glm::dvec3 position
Platform 3D position.
Definition: Platform.h:135
glm::dvec3 lastGroundCheck
Not used at the moment. Might be removed in the future.
Definition: Platform.h:45
glm::dvec3 cfg_device_relativeMountPosition
Device mount position relative to the platform.
Definition: Platform.h:29
glm::dvec3 targetWaypoint
Target waypoint (destination)
Definition: Platform.h:100
glm::dvec3 nextWaypoint
Waypoint after target. For the last target, waypoint after target is equal to the target itself.
Definition: Platform.h:105
std::shared_ptr< NoiseSource< double > > attitudeYNoiseSource
Noise source for y component of platform attitude.
Definition: Platform.h:71
bool mSetOrientationOnLegInit
Not used at the moment. Might be removed in the future.
Definition: Platform.h:144
glm::dvec3 originWaypoint
Origin waypoint.
Definition: Platform.h:96
glm::dvec3 cached_dir_current_xy
Current director vector over XY plane (z is always 0)
Definition: Platform.h:170
glm::dvec3 prevWrittenPos
Not used at the moment. Might be removed in the future.
Definition: Platform.h:85
std::shared_ptr< NoiseSource< double > > attitudeZNoiseSource
Noise source for z component of platform attitude.
Definition: Platform.h:75
Rotation cached_absoluteMountAttitude
Cached absolute mount attitude.
Definition: Platform.h:161
std::shared_ptr< NoiseSource< double > > positionXNoiseSource
Noise source for x component of platform position.
Definition: Platform.h:55
std::shared_ptr< NoiseSource< double > > positionZNoiseSource
Noise source for z component of platform position.
Definition: Platform.h:63
double cached_currentAngle_xy
Angle between current director vector and director vector from target to waypoint after target.
Definition: Platform.h:206
Rotation cfg_device_relativeMountAttitude
Device mount attitude relative to the platform.
Definition: Platform.h:33
std::shared_ptr< NoiseSource< double > > attitudeXNoiseSource
Noise source for x component of platform attitude.
Definition: Platform.h:67
double cached_distanceToTarget_xy
Distance on XY plane between current position and target.
Definition: Platform.h:185
std::shared_ptr< NoiseSource< double > > positionYNoiseSource
Noise source for y component of platform position.
Definition: Platform.h:59
glm::dvec3 cached_dir_current
Current director vector over XY plane.
Definition: Platform.h:166
Class extending LinearVoidStepLoop to support main simulation loop.
Definition: SimulationStepLoop.h:15