WSF
WsfMover.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 WSFMOVER_HPP
16#define WSFMOVER_HPP
17
18#include "wsf_export.h"
19
20#include "UtVec3.hpp"
22class WsfDraw;
23class WsfGeoPoint;
24class WsfModeList;
25class WsfMoverMode;
26#include "WsfPath.hpp"
27#include "WsfPlatformPart.hpp"
28class WsfRoute;
29#include "WsfVariable.hpp"
30
37{
38public:
39 static const char* cTYPE_KIND;
40
41 WsfMover() = delete;
42 WsfMover(const WsfScenario& aScenario);
43 WsfMover(const WsfMover& aSrc);
44 WsfMover& operator=(const WsfMover&) = delete;
45 ~WsfMover() override;
46
48
49 WsfComponent* CloneComponent() const override { return Clone(); }
51 const int* GetComponentRoles() const override;
52 void* QueryInterface(int aRole) override;
54
56
57
59 WsfMover* Clone() const override = 0;
60
61 const char* GetScriptClassName() const override;
62
63 virtual void SwapMoverInitiated(double aSimTime, WsfMover* aOldMoverPtr);
64 bool Initialize(double aSimTime) override;
66 bool ProcessInput(UtInput& aInput) override;
67 void Update(double aSimTime) override;
69
71
72 void TurnOff(double aSimTime) override;
73 void TurnOn(double aSimTime) override;
74 void SetNonOperational(double aSimTime) override;
75 void SetOperational(double aSimTime) override;
76 void PartBroken(double aSimTime) override;
77 void Restore(double aSimTime) override;
79
80 virtual WsfSpatialDomain GetSpatialDomain() const;
81
82 virtual bool IsStopped() const;
83 virtual bool IsPaused() const;
84 virtual bool IsExtrapolating() const;
85
86 virtual void SetHeading(double aHeading);
87 virtual void SetPitch(double aPitch);
88 virtual void SetRoll(double aRoll);
89
90 virtual void SetOrientationNED(double aHeading, double aPitch, double aRoll);
91
93 // * Used in SetRoute or to move platform
94 virtual void ResetPosition(double aSimTime) {}
95
97
98
101 double GetLastUpdateTime() const { return mLastUpdateTime; }
102
105 double GetUpdateInterval() const override { return mUpdateInterval; }
106
114
117 void SetUpdateInterval(double aUpdateInterval) override { mUpdateInterval = aUpdateInterval; }
118
122 void SetLastUpdateTime(double aLastUpdateTime) { mLastUpdateTime = aLastUpdateTime; }
123
124 virtual bool UpdateAllowed() const;
125
126 bool UpdateWhenBroken() const { return mUpdateWhenBroken; }
127 void SetUpdateWhenBroken() { mUpdateWhenBroken = true; }
128 void SetNoUpdateWhenBroken() { mUpdateWhenBroken = false; }
130
135
137 virtual const WsfRoute* GetRoute() const;
138
139 virtual const WsfRoute* GetDefaultRoute() const;
140
141 virtual int RoutePointIndex() const { return 0; }
142
143 virtual bool GoToAltitude(double aSimTime, double aAltitude, double aClimbDiveRate, bool aKeepRoute);
144
145 virtual bool ReturnToRoute(double aSimTime);
146
147 virtual bool GoToClosestPoint(double aSimTime);
148
149 virtual bool GoToLabel(double aSimTime, WsfStringId aLabelId);
150
151 virtual bool GoToLocation(double aSimTime, double aLatitude, double aLongitude, double aAltitude);
152
153 virtual bool GoToSpeed(double aSimTime, double aSpeed, double aLinearAccel, bool aKeepRoute);
154
155 virtual bool TurnToHeading(double aSimTime, double aHeading, double aRadialAccel, WsfPath::TurnDirection aTurnDirection);
156
157 virtual bool TurnToRelativeHeading(double aSimTime,
158 double aHeadingChange,
159 double aRadialAccel,
160 WsfPath::TurnDirection aTurnDirection);
161
162 virtual bool SetRoute(double aSimTime, const WsfRoute& aRoute);
163
164 virtual bool UpdateRoute(double aSimTime, const WsfRoute& aRoute);
165
166 virtual bool UpdateDefaultRoute();
167
168 virtual bool GoToWaypoint(double aSimTime, unsigned int aDestination);
169
170 virtual bool FindAndSetPath(double aSimTime, WsfGeoPoint* aStartPtr, WsfGeoPoint* aEndPtr);
171
172 virtual bool FlyRates(const UtVec3d& aAngularRates, // radians/sec
173 const UtVec3d& aLongitudinalAccel)
174 {
175 return false;
176 } // meters/sec^2
177
178 virtual bool FlyHeadingSpeedAltitude(double aHeading, // deg
179 double aSpeed, // meters/sec
180 double aAltitude, // meters
181 double aMaxGees, // Gs
182 double aMaxClimb)
183 {
184 return false;
185 } // meters/sec
186
187 virtual bool TurnInPlaneWithSpeed(const UtVec3d& aPlane, // world coordinates (not body coordinates)
188 double aGees, // Gs
189 double aSpeed)
190 {
191 return false;
192 } // meters/sec
193
194 virtual bool TurnInPlaneWithThrottle(const UtVec3d& aPlane, // world coordinates (not body coordinates)
195 double aGees, // Gs
196 double aThrottle)
197 {
198 return false;
199 } //[0-3]
200
201 virtual bool FlyVectorWithSpeed(const UtVec3d& aVelocityVector, // world coordinates (not body coordinates)
202 // (magnitude does not matter, just direction)
203 double aMaxGees, // Gs
204 double aSpeed)
205 {
206 return false;
207 } // meters/sec
208
209 virtual bool FlyVectorWithThrottle(const UtVec3d& aVelocityVector, // world coordinates (not body coordinates)
210 // (magnitude does not matter, just direction)
211 double aMaxGees, // Gs
212 double aThrottle)
213 {
214 return false;
215 } //[0-3]
216
217
218 virtual bool ExecuteTriggers(double aSimTime, unsigned int aPointIndex);
219
220 virtual bool GetFutureLocationWCS(double aSimTime, double aLocationWCS[3]);
221
226 WsfStringId GetModeId() const { return mModeId; }
227 virtual void SetMode(WsfStringId aModeName);
228
230 bool ThreadSafe() const { return mThreadSafe; }
231 void SetThreadSafe() { mThreadSafe = true; }
232 void SetNotThreadSafe() { mThreadSafe = false; }
233
238
239
241 virtual void InitializeProperties(){};
242
244 virtual bool PropertyExists(const std::string& aPropertyName);
245
247 virtual void RegisterProperty(const std::string& aPropertyName, const int& aProperty);
249 virtual void RegisterProperty(const std::string& aPropertyName, const double& aProperty);
251 virtual void RegisterProperty(const std::string& aPropertyName, const std::string& aProperty);
252
255 virtual bool GetPropertyInt(const std::string& aPropertyName, int& aProperty);
258 virtual bool GetPropertyDouble(const std::string& aPropertyName, double& aProperty);
261 virtual bool GetPropertyString(const std::string& aPropertyName, std::string& aProperty);
262
267 virtual double GetThrottlePosition() { return 1.0; }
268
270
273
274 virtual double TurnRadius(double atSpeed) { return 0.0; } // TODO //returns meters
276
277 WsfModeList* GetModeList() const { return mModeListPtr; }
278
281 virtual void TriggerExtrapolation();
282
286 {
287 public:
288 KinematicModel() = delete;
289 KinematicModel(const KinematicModel& aSrc) = default;
290 virtual ~KinematicModel();
291
292 double GetApogeeTime() const { return mApogeeTime; }
293 double GetTimeAtLocation() const { return mTimeAtLocation; }
294 double GetStartTime() const { return mStartTime; }
295
300 virtual bool GetLocationXYZ(double aTime, double aLocXYZ[3]) const = 0;
301
307 virtual bool GetVelocityXYZ(double aTime, double aVelXYZ[3]) const = 0;
308
309 static void GetRangeAndAltitude(const double aOriginLocXYZ[3],
310 const double aModelLocXYZ[3],
311 double& aRange,
312 double& aAltitude);
313
314 protected:
315 KinematicModel(double aSimTime, WsfStringId aModelTypeId);
316
321 };
322
335 virtual KinematicModel* CreateKinematicModel(double aSimTime,
336 WsfStringId aPlatformTypeId,
337 const double aLocationWCS[3],
338 const double aVelocityWCS[3],
339 WsfMover* aMoverPtr,
340 WsfDraw* aDrawPtr) const
341 {
342 return nullptr;
343 }
344
345protected:
346 void SetModeList(WsfModeList* aModeListPtr);
347
350
352
356
361
363 std::vector<WsfMoverMode*> mMoverModeList;
364
366
367private:
368 WsfModeList* mModeListPtr;
369
370 bool HasProperties() const { return mPropertiesPtr != nullptr; }
371 WsfAttributeContainer& GetProperties() const;
372
375 WsfVariable<double> mUpdateInterval;
376
380 mutable WsfAttributeContainer* mPropertiesPtr;
381
383 bool mUpdateWhenBroken;
384};
385
387
388#endif
@ cWSF_INITIALIZE_ORDER_MOVER
The mover must be initialized prior to just about everything else because it defines the initial loca...
Definition WsfComponentRoles.hpp:168
#define WSF_DECLARE_COMPONENT_ROLE_TYPE(TYPE, ROLE)
Definition WsfComponentRoles.hpp:44
@ cWSF_COMPONENT_MOVER
A 'mover' component (WsfMover).
Definition WsfComponentRoles.hpp:100
aObjectPtr GetPropertyDouble("maximum_radial_acceleration", radialAccel)
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
WsfSpatialDomain
A collection of enumerations and type definitions that are used across a number of components.
Definition WsfTypes.hpp:32
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfAttributeContainer.hpp:24
Definition WsfComponent.hpp:39
Provides the capability to draw shapes into the WSF replay file.
Definition WsfDraw.hpp:35
Definition WsfGeoPoint.hpp:29
Definition WsfModeList.hpp:31
Definition WsfMoverMode.hpp:29
Definition WsfMover.hpp:286
WsfStringId mModelTypeId
Definition WsfMover.hpp:320
double GetApogeeTime() const
Definition WsfMover.hpp:292
double mApogeeTime
Definition WsfMover.hpp:318
double mTimeAtLocation
Definition WsfMover.hpp:319
double GetStartTime() const
Definition WsfMover.hpp:294
static void GetRangeAndAltitude(const double aOriginLocXYZ[3], const double aModelLocXYZ[3], double &aRange, double &aAltitude)
Definition WsfMover.cpp:658
virtual bool GetVelocityXYZ(double aTime, double aVelXYZ[3]) const =0
double GetTimeAtLocation() const
Definition WsfMover.hpp:293
virtual bool GetLocationXYZ(double aTime, double aLocXYZ[3]) const =0
double mStartTime
Definition WsfMover.hpp:317
KinematicModel(const KinematicModel &aSrc)=default
Definition WsfMover.hpp:37
void SetUpdateWhenBroken()
Definition WsfMover.hpp:127
virtual void InitializeProperties()
Add any input properties and its default value common properties list.
Definition WsfMover.hpp:241
bool UpdateWhenBroken() const
Definition WsfMover.hpp:126
virtual bool FlyVectorWithSpeed(const UtVec3d &aVelocityVector, double aMaxGees, double aSpeed)
Definition WsfMover.hpp:201
void SetThreadSafe()
Definition WsfMover.hpp:231
WsfModeList * GetModeList() const
Definition WsfMover.hpp:277
bool mThreadSafe
Definition WsfMover.hpp:360
WsfVariable< double > mUpdateTimeTolerance
Definition WsfMover.hpp:355
void SetNoUpdateWhenBroken()
Definition WsfMover.hpp:128
double GetLastUpdateTime() const
Definition WsfMover.hpp:101
int GetComponentInitializationOrder() const override
Definition WsfMover.hpp:50
virtual bool IsStopped() const
Return whether the mover (and its attached platform) is stopped.
Definition WsfMover.cpp:551
double mLastUpdateTime
The simulation time when Update was last called.
Definition WsfMover.hpp:351
virtual bool FlyHeadingSpeedAltitude(double aHeading, double aSpeed, double aAltitude, double aMaxGees, double aMaxClimb)
Definition WsfMover.hpp:178
double GetUpdateInterval() const override
Definition WsfMover.hpp:105
WsfMover & operator=(const WsfMover &)=delete
virtual WsfSpatialDomain GetSpatialDomain() const
Definition WsfMover.cpp:339
virtual void SetPitch(double aPitch)
Definition WsfMover.cpp:218
WsfMover * Clone() const override=0
virtual KinematicModel * CreateKinematicModel(double aSimTime, WsfStringId aPlatformTypeId, const double aLocationWCS[3], const double aVelocityWCS[3], WsfMover *aMoverPtr, WsfDraw *aDrawPtr) const
Definition WsfMover.hpp:335
virtual void SetOrientationNED(double aHeading, double aPitch, double aRoll)
Definition WsfMover.cpp:240
virtual bool TurnInPlaneWithThrottle(const UtVec3d &aPlane, double aGees, double aThrottle)
Definition WsfMover.hpp:194
double GetUpdateTimeTolerance() const
Definition WsfMover.hpp:113
WsfMover()=delete
static const char * cTYPE_KIND
Definition WsfMover.hpp:39
virtual bool IsExtrapolating() const
Definition WsfMover.cpp:576
virtual bool FlyVectorWithThrottle(const UtVec3d &aVelocityVector, double aMaxGees, double aThrottle)
Definition WsfMover.hpp:209
virtual void SetRoll(double aRoll)
Definition WsfMover.cpp:229
std::vector< WsfMoverMode * > mMoverModeList
The generic list of modes (not valid until Initialize is called).
Definition WsfMover.hpp:363
virtual void ResetPosition(double aSimTime)
Informs the mover to use the current platform state.
Definition WsfMover.hpp:94
virtual bool TurnInPlaneWithSpeed(const UtVec3d &aPlane, double aGees, double aSpeed)
Definition WsfMover.hpp:187
void SetUpdateTimeTolerance(double aDt)
Revise the internal time tolerance allowed for Update() sequencing logic.
Definition WsfMover.hpp:349
virtual bool FlyRates(const UtVec3d &aAngularRates, const UtVec3d &aLongitudinalAccel)
Definition WsfMover.hpp:172
void SetNotThreadSafe()
Definition WsfMover.hpp:232
virtual bool IsPaused() const
Definition WsfMover.cpp:561
WsfStringId GetModeId() const
Definition WsfMover.hpp:226
void SetLastUpdateTime(double aLastUpdateTime)
Definition WsfMover.hpp:122
virtual void SetHeading(double aHeading)
Definition WsfMover.cpp:207
void SetUpdateInterval(double aUpdateInterval) override
Definition WsfMover.hpp:117
WsfStringId mModeId
Definition WsfMover.hpp:365
virtual double GetThrottlePosition()
Definition WsfMover.hpp:267
bool ThreadSafe() const
Returns true if the mover update is thread safe.
Definition WsfMover.hpp:230
virtual void SwapMoverInitiated(double aSimTime, WsfMover *aOldMoverPtr)
Definition WsfMover.cpp:99
virtual int RoutePointIndex() const
Definition WsfMover.hpp:141
WsfComponent * CloneComponent() const override
Definition WsfMover.hpp:49
virtual double TurnRadius(double atSpeed)
Definition WsfMover.hpp:274
virtual WsfObject * Clone() const =0
virtual void Update(double aSimTime)
Definition WsfPlatformPart.cpp:322
virtual void SetOperational(double aSimTime)
Definition WsfPlatformPart.cpp:661
virtual void PartBroken(double aSimTime)
Definition WsfPlatformPart.cpp:232
bool Initialize2(double aSimTime) override
Definition WsfPlatformPart.cpp:291
const char * GetScriptClassName() const override
Definition WsfPlatformPart.cpp:683
void * QueryInterface(int aRole) override
Definition WsfPlatformPart.cpp:143
virtual void TurnOff(double aSimTime)
Definition WsfPlatformPart.cpp:606
WsfPlatformPart(const WsfScenario &aScenario, int aPartType)
Definition WsfPlatformPart.cpp:62
virtual void TurnOn(double aSimTime)
Definition WsfPlatformPart.cpp:622
bool Initialize(double aSimTime) override
Definition WsfPlatformPart.cpp:276
const int * GetComponentRoles() const override
Definition WsfPlatformPart.cpp:137
bool ProcessInput(UtInput &aInput) override
Definition WsfPlatformPart.cpp:347
virtual void SetNonOperational(double aSimTime)
Definition WsfPlatformPart.cpp:642
virtual void Restore(double aSimTime)
Definition WsfPlatformPart.cpp:252
A collection of WsfWaypoint objects that represent a path to be followed.
Definition WsfRoute.hpp:40
Contains the data required to create a simulation, and acts as the entry point for input file process...
Definition WsfScenario.hpp:111
Definition WsfVariable.hpp:149
TurnDirection
Turn direction for TurnToHeading and TurnToRelativeHeading.
Definition WsfPath.hpp:88
Copyrights Multiple, All Rights Reserved