WSF
WsfPathList.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2003-2015 The Boeing Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11// ****************************************************************************
12// Updated by Infoscitex, a DCS Company.
13// ****************************************************************************
14
15#ifndef WSFPATHLIST_HPP
16#define WSFPATHLIST_HPP
17
18#include "wsf_export.h"
19
20#include <vector>
21
22#include "UtEntity.hpp"
23#include "UtLog.hpp"
24#include "UtSphericalEarth.hpp"
25#include "UtVec3.hpp"
26#include "WsfPathState.hpp"
27
30{
31public:
34 {
35 public:
38 , mDuration(0.0)
39 , mRollRate(0.0)
40 , mIsApproximation(false)
41 {
42 }
43 virtual ~Segment() = default;
44
48 virtual void ComputeState(double aRelativeSimTime, WsfPathState& aState) = 0;
49
51 virtual Segment* Clone() const = 0;
52
54 void Initialize(double aDuration, const WsfPathState& aState)
55 {
56 mDuration = aDuration;
57 mInitialState = aState;
58 }
59
60 void SetRollRate(double aRollRate) { mRollRate = aRollRate; }
61
63 const WsfPathState& GetInitialState() const { return mInitialState; }
64
66 double GetDuration() const { return mDuration; }
68 void SetDuration(double aDuration) { mDuration = aDuration; }
69
71 virtual void Print(ut::log::MessageStream& aStream);
72
76 double mDuration;
78 double mRollRate;
81 };
82
85 {
86 public:
89 , mClimbRate()
90 , mFlightAngle()
91 {
92 }
93 void SetLinearAcceleration(double aAcceleration) { mLinearAcceleration = aAcceleration; }
94
95 void SetClimbRate(double aClimbRate) { mClimbRate = aClimbRate; }
96
97 void SetFlightAngle(double aFlightAngle) { mFlightAngle = aFlightAngle; }
104 };
105
108 {
109 public:
111 : mRotationRadius(UtSphericalEarth::cEARTH_RADIUS)
112 {
113 }
114
115 void InitializeRotation(UtVec3d aInitialLocationWCS, UtVec3d aRotationAxisWCS);
116
117 void SetRotationRadius(double aEarthRadius) { mRotationRadius = aEarthRadius; }
126 };
127
130 {
131 public:
133 : mRoll(0.0)
134 {
135 }
136 Segment* Clone() const override { return new RotationArcSegment(*this); }
137 void ComputeState(double aRelativeSimTime, WsfPathState& aState) override;
138 void SetTargetRoll(double aRoll) { mRoll = aRoll; }
139 void Print(ut::log::MessageStream& aStream) override;
140
141 double mRoll;
142 };
143
146 {
147 public:
149 : mRoll(0.0)
150 {
151 }
152 Segment* Clone() const override { return new RotationSegment(*this); }
153 void ComputeState(double aRelativeSimTime, WsfPathState& aState) override;
154 void SetTargetRoll(double aRoll) { mRoll = aRoll; }
155 void Print(ut::log::MessageStream& aStream) override;
156
157 double mRoll;
158 };
159
163 {
164 public:
165 Segment* Clone() const override { return new PauseSegment(*this); }
166 void ComputeState(double aRelativeSimTime, WsfPathState& aState) override { aState = mInitialState; }
167 void Print(ut::log::MessageStream& aStream) override;
168 };
169
170 typedef std::vector<Segment*> SegmentList;
171
172 WsfPathList();
173 WsfPathList(const WsfPathList& aSrc);
174 ~WsfPathList();
175 WsfPathList& operator=(const WsfPathList& aRhs) = delete;
176
178 void GetState(double aRelativeSimTime, WsfPathState& aState);
179
181 void Reset();
182
184 void Append(Segment* aSegmentPtr);
185
187 void Append(Segment* aSegmentPtr, const WsfPathState& aEndState);
188
189 void Append(double aDuration, WsfPathList& aPathList);
190
191 void PopBack();
192
193 double GetDuration() const;
194
195 double GetEndStateValid() { return mEndStateValid; }
196
198 bool Empty() const { return mSegments.empty(); }
199
202 const WsfPathState& GetEndState();
203
206 {
207 mEndState = aState;
208 mEndStateValid = true;
209 }
210
212 const SegmentList& GetSegments() const { return mSegments; }
213
214 void PrintPath(ut::log::MessageStream& aStream);
215
216
217private:
218 void GetStateP(double aRelativeSimTime, WsfPathState& aState);
219
220 double mDuration;
221 int mLastSegmentIndex;
222 double mLastSegmentStartTime;
223 std::vector<Segment*> mSegments;
224 WsfPathState mEndState;
225 bool mEndStateValid;
226};
227
228#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Contains data about the acceleration and altitude changes during a segment.
Definition WsfPathList.hpp:85
DynamicsData()
Definition WsfPathList.hpp:87
void SetFlightAngle(double aFlightAngle)
Definition WsfPathList.hpp:97
void SetClimbRate(double aClimbRate)
Definition WsfPathList.hpp:95
double mLinearAcceleration
Linear acceleration applied to the duration of the segment.
Definition WsfPathList.hpp:99
double mFlightAngle
Flight angle applied to the duration of the segment.
Definition WsfPathList.hpp:103
void SetLinearAcceleration(double aAcceleration)
Definition WsfPathList.hpp:93
double mClimbRate
Climb rate applied to the duration of the segment.
Definition WsfPathList.hpp:101
Definition WsfPathList.hpp:163
void ComputeState(double aRelativeSimTime, WsfPathState &aState) override
Definition WsfPathList.hpp:166
Segment * Clone() const override
Returns a copy of the segment.
Definition WsfPathList.hpp:165
RotationArcSegment()
Definition WsfPathList.hpp:132
void SetTargetRoll(double aRoll)
Definition WsfPathList.hpp:138
Segment * Clone() const override
Returns a copy of the segment.
Definition WsfPathList.hpp:136
double mRoll
Definition WsfPathList.hpp:141
Contains data about a rotation.
Definition WsfPathList.hpp:108
UtVec3d mRotationAxis
Axis of rotation. May represent a turn, or straight flight (around a spherical earth).
Definition WsfPathList.hpp:123
UtVec3d mInitialLocationWCS
Initial location in WCS. This is rotated to find new position.
Definition WsfPathList.hpp:121
void SetRotationRadius(double aEarthRadius)
Definition WsfPathList.hpp:117
UtVec3d mInitialDirectionWCS
Initial direction in WCS. This is rotated to find new direction.
Definition WsfPathList.hpp:125
double mRotationRadius
Radius of the rotation. (radius of turn, or radius of earth).
Definition WsfPathList.hpp:119
RotationData()
Definition WsfPathList.hpp:110
RotationSegment()
Definition WsfPathList.hpp:148
Segment * Clone() const override
Returns a copy of the segment.
Definition WsfPathList.hpp:152
void SetTargetRoll(double aRoll)
Definition WsfPathList.hpp:154
double mRoll
Definition WsfPathList.hpp:157
Defines an entity's segment from one state to another over time.
Definition WsfPathList.hpp:34
void SetDuration(double aDuration)
Sets the length of time to complete this segment.
Definition WsfPathList.hpp:68
double mRollRate
The roll rate used when changing roll angle.
Definition WsfPathList.hpp:78
Segment()
Definition WsfPathList.hpp:36
virtual Segment * Clone() const =0
Returns a copy of the segment.
const WsfPathState & GetInitialState() const
Returns the state at the start of the segment.
Definition WsfPathList.hpp:63
WsfPathState mInitialState
The initial state of the segment. This should be equivalent to ComputeState(0.0).
Definition WsfPathList.hpp:74
void SetRollRate(double aRollRate)
Definition WsfPathList.hpp:60
bool mIsApproximation
Indicates this segment is an approximation.
Definition WsfPathList.hpp:80
virtual ~Segment()=default
double mDuration
The length of simulation time this duration takes to complete.
Definition WsfPathList.hpp:76
virtual void ComputeState(double aRelativeSimTime, WsfPathState &aState)=0
double GetDuration() const
Returns the length of time to complete this segment.
Definition WsfPathList.hpp:66
void Initialize(double aDuration, const WsfPathState &aState)
Initialize the basic members of the segment.
Definition WsfPathList.hpp:54
std::vector< Segment * > SegmentList
Definition WsfPathList.hpp:170
double GetDuration() const
Returns the sim-time required to move along the path.
Definition WsfPathList.cpp:359
void GetState(double aRelativeSimTime, WsfPathState &aState)
Returns the state at a time offset from the beginning of the path.
Definition WsfPathList.cpp:378
double GetEndStateValid()
Definition WsfPathList.hpp:195
void PopBack()
Definition WsfPathList.cpp:431
void SetEndState(WsfPathState &aState)
Sets the final state at the end of the path.
Definition WsfPathList.hpp:205
WsfPathList()
Definition WsfPathList.cpp:296
void Append(Segment *aSegmentPtr)
Appends a segment to the path.
Definition WsfPathList.cpp:325
const SegmentList & GetSegments() const
returns the list of segments in the path
Definition WsfPathList.hpp:212
WsfPathList & operator=(const WsfPathList &aRhs)=delete
void Reset()
Removes all segments from the path.
Definition WsfPathList.cpp:418
bool Empty() const
Returns true if the path list is empty.
Definition WsfPathList.hpp:198
Definition WsfPathState.hpp:24
Copyrights Multiple, All Rights Reserved