WSF
WsfPathComputer.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 WSFPATHCOMPUTER_HPP
16#define WSFPATHCOMPUTER_HPP
17
18#include "wsf_export.h"
19
20#include "UtLog.hpp"
21#include "UtRandom.hpp"
23#include "WsfPathList.hpp"
24#include "WsfWaypoint.hpp"
25
27{
30 , mLatitude(0.0)
31 , mLongitude(0.0)
32 , mAltitude(0.0)
33 , mHeading(0.0)
34 , mSpeed(0.0)
35 , mDistance(0.0)
36 , mTime(0.0)
38 , mNextPointLat(0.0)
39 , mNextPointLon(0.0)
42 {
43 }
44
58
65
66 void Print(ut::log::MessageStream& aStream);
67
69 unsigned int mTargetType;
71 double mLatitude;
73 double mLongitude;
75 double mAltitude;
77 double mHeading;
79 double mSpeed;
81 double mDistance;
83 double mTime;
94};
95
98{
99public:
100 WsfPathComputer(ut::Random* aRandomPtr = nullptr);
101
103
104 // Appends instructions to aPathList to transition from State to TargetState
105 void ComputePath(const WsfPathState& aState, const WsfPathTarget& aTarget, WsfPathList& aPathList);
106
107 void CreateTarget(const WsfPathState& aCurrentState,
108 WsfPathConstraints& aCurrentConstraints,
109 const WsfPathConstraints& aMoverConstraints,
110 const WsfWaypoint& aTargetPoint,
111 const WsfWaypoint* aNextPointPtr,
112 WsfPathTarget& aTarget);
113
114 void ConstrainTarget(WsfPathTarget& aTarget, const WsfPathConstraints& aConstraints);
115
116 void RevisePathHitPointAtTime(WsfPathTarget& aTarget, WsfPathList& aPath);
117
120 void SetMaximumTurn(double aMaxTurn) { mMaximumTurn = aMaxTurn; }
121
122 double GetMaximumTurn() const { return mMaximumTurn; }
123
124 void SetPathVarianceRadius(double aPathVarianceRadius) { mPathVarianceRadius = aPathVarianceRadius; }
125 void SetSpeedVariancePct(double aSpeedVariancePct) { mSpeedVariancePct = aSpeedVariancePct; }
126
127 void SetDefaultSwitch(WsfPath::Switch aDefaultSwitch) { mDefaultSwitch = aDefaultSwitch; }
128
131 void SetRandom(ut::Random* aRandomPtr) { mRandomPtr = aRandomPtr; }
132
133 double GetTurnRadius(double aSpeed);
134
135 void TurnToHeading(const WsfPathState& aState,
136 const WsfPathTarget& aTarget,
137 WsfPathList& aPathList,
138 WsfPathTarget::TurnDirection aTurnDirection);
139
140 void TurnRelative(const WsfPathState& aState,
141 const WsfPathTarget& aTarget,
142 WsfPathList& aPathList,
143 double aTurnAngle,
144 double aTurnRadius = -1.0);
145
146 bool TurnToPointHeading(const WsfPathState& aState, const WsfPathTarget& aTarget, WsfPathList& aPath);
147
148 void StraightToPoint(const WsfPathState& aState, const WsfPathTarget& aTarget, WsfPathList& aPath, bool aAllowHeadingChange);
149
150 void Rotate(UtVec3d aRotationAxis,
151 double aArcLength,
152 double aTime,
153 const WsfPathTarget& aTarget,
154 const WsfPathState& aState,
155 WsfPathList& aPath,
156 double aRotationRadius,
157 double aTargetRoll = 0.0);
158
159 void StraightOnHeading(const WsfPathState& aState, const WsfPathTarget& aTarget, WsfPathList& aPath);
160
168
169 bool ComputeSpeedAltitudeTargets(const WsfPathState& aState,
170 const WsfPathTarget& aTarget,
171 SpeedAltitudeBreakpoint& aBreakpoint);
172
175 void ForceFlyFlightPath(bool aBool) { mFlyFlightPathToTarget = aBool; }
176
177 ut::Random* mRandomPtr;
179 double mSimTime;
181
183
186
190
199
200private:
201 bool TurnToPoint(const WsfPathState& aState, const WsfPathTarget& aTarget, WsfPathList& aPath, int aIterations);
202};
203
204#endif
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
WsfPathComputer(ut::Random *aRandomPtr=nullptr)
Definition WsfPathComputer.cpp:268
WsfPath::Switch mDefaultSwitch
Definition WsfPathComputer.hpp:189
double mIntegrationTime
Definition WsfPathComputer.hpp:180
void StraightToPoint(const WsfPathState &aState, const WsfPathTarget &aTarget, WsfPathList &aPath, bool aAllowHeadingChange)
Definition WsfPathComputer.cpp:925
void SetPathVarianceRadius(double aPathVarianceRadius)
Definition WsfPathComputer.hpp:124
WsfPathConstraints mConstraints
Definition WsfPathComputer.hpp:178
bool ComputeSpeedAltitudeTargets(const WsfPathState &aState, const WsfPathTarget &aTarget, SpeedAltitudeBreakpoint &aBreakpoint)
Definition WsfPathComputer.cpp:1184
ut::Random * mRandomPtr
Definition WsfPathComputer.hpp:177
void SetSpeedVariancePct(double aSpeedVariancePct)
Definition WsfPathComputer.hpp:125
double mSimTime
Definition WsfPathComputer.hpp:179
void Rotate(UtVec3d aRotationAxis, double aArcLength, double aTime, const WsfPathTarget &aTarget, const WsfPathState &aState, WsfPathList &aPath, double aRotationRadius, double aTargetRoll=0.0)
Definition WsfPathComputer.cpp:1009
void ForceFlyFlightPath(bool aBool)
Definition WsfPathComputer.hpp:175
bool mUsingComputedLinearAcceleration
'true' if the current target has a computed linear acceleration
Definition WsfPathComputer.hpp:194
bool mUsingComputedSpeed
'true' if the current target has a computed speed.
Definition WsfPathComputer.hpp:196
void StraightOnHeading(const WsfPathState &aState, const WsfPathTarget &aTarget, WsfPathList &aPath)
Definition WsfPathComputer.cpp:1146
void SetRandom(ut::Random *aRandomPtr)
Definition WsfPathComputer.hpp:131
bool mFlyFlightPathToTarget
'true' use calculated flight path constraints to fly along slope to next target point
Definition WsfPathComputer.hpp:198
double mSpeedVariancePct
Definition WsfPathComputer.hpp:185
double mPathVarianceRadius
Definition WsfPathComputer.hpp:184
void SetUsingComputedClimbRate(bool aBool)
Definition WsfPathComputer.hpp:174
bool TurnToPointHeading(const WsfPathState &aState, const WsfPathTarget &aTarget, WsfPathList &aPath)
void SetMaximumTurn(double aMaxTurn)
Definition WsfPathComputer.hpp:120
WsfPathConstraints & GetConstraints()
Definition WsfPathComputer.hpp:102
bool UsingComputedClimbRate()
Definition WsfPathComputer.hpp:173
bool mUsingComputedClimbRate
'true' if the current target has a computed flight angle
Definition WsfPathComputer.hpp:192
double GetMaximumTurn() const
Definition WsfPathComputer.hpp:122
double mMaximumTurn
Definition WsfPathComputer.hpp:182
void SetDefaultSwitch(WsfPath::Switch aDefaultSwitch)
Definition WsfPathComputer.hpp:127
Defines a list of motions a platform could take.
Definition WsfPathList.hpp:30
Definition WsfWaypoint.hpp:57
Switch
Option setting when to react as a WsfWaypoint is approached.
Definition WsfPath.hpp:76
Definition WsfPathComputer.hpp:162
double mSimTime
Definition WsfPathComputer.hpp:163
double mLinearAcceleration
Definition WsfPathComputer.hpp:164
double mFlightAngle
Definition WsfPathComputer.hpp:166
double mClimbRate
Definition WsfPathComputer.hpp:165
Contains constraints used for computing a path in WsfPathComputer.
Definition WsfPathConstraints.hpp:24
Definition WsfPathState.hpp:24
Definition WsfPathComputer.hpp:27
TargetType
Definition WsfPathComputer.hpp:46
@ cOPTIONAL_POINT
Definition WsfPathComputer.hpp:55
@ cLOCATION
Definition WsfPathComputer.hpp:47
@ cHEADING
Definition WsfPathComputer.hpp:49
@ cSPEED
Definition WsfPathComputer.hpp:50
@ cEXTRAPOLATE
Definition WsfPathComputer.hpp:51
@ cRELATIVE_TURN
Definition WsfPathComputer.hpp:53
@ cREQUIRED_POINT
Definition WsfPathComputer.hpp:54
@ cTIME_TO_POINT
Definition WsfPathComputer.hpp:56
@ cALTITUDE
Definition WsfPathComputer.hpp:48
@ cTURN_ON_APPROACH
Definition WsfPathComputer.hpp:52
double mNextPointLon
Definition WsfPathComputer.hpp:90
double mTime
Specifies the length of time to travel before completion.
Definition WsfPathComputer.hpp:83
double mSpeed
Specifies the target speed. Must be used with (mTargetType & cSPEED).
Definition WsfPathComputer.hpp:79
double mHeading
Specifies the target heading. Must be used with (mTargetType & cHEADING).
Definition WsfPathComputer.hpp:77
TurnDirection mTurnDirection
Specifies the direction used to complete a turn.
Definition WsfPathComputer.hpp:85
void Print(ut::log::MessageStream &aStream)
Definition WsfPathComputer.cpp:221
WsfPathTarget()
Definition WsfPathComputer.hpp:28
double mTurnFailureThreshold
}
Definition WsfPathComputer.hpp:93
unsigned int mTargetType
Bit combination of TargetType.
Definition WsfPathComputer.hpp:69
TurnDirection
Definition WsfPathComputer.hpp:60
@ cTURN_DIR_LEFT
Turn to the left, even if right is closer.
Definition WsfPathComputer.hpp:61
@ cTURN_DIR_SHORTEST
Turn in the direction that results in the shortest turn (DEFAULT).
Definition WsfPathComputer.hpp:62
@ cTURN_DIR_RIGHT
Turn to the right, even if left is closer.
Definition WsfPathComputer.hpp:63
double mLatitude
Specifies the target latitude. Must be used with (mTargetType & cLOCATION).
Definition WsfPathComputer.hpp:71
double mDistance
Specifies the distance traveled before completion.
Definition WsfPathComputer.hpp:81
double mAltitude
Specifies the target altitude. Must be used with (mTargetType & cALTITUDE).
Definition WsfPathComputer.hpp:75
double mNextPointRadialAccel
Definition WsfPathComputer.hpp:91
double mLongitude
Specifies the target longitude. Must be used with (mTargetType & cLOCATION).
Definition WsfPathComputer.hpp:73
double mNextPointLat
Definition WsfPathComputer.hpp:89
Copyrights Multiple, All Rights Reserved