WSF
WsfPointMassSixDOF_PilotObject.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 2020 Infoscitex, a DCS 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#ifndef WSFPOINTMASSSIXDOFPILOTOBJECT_HPP
13#define WSFPOINTMASSSIXDOFPILOTOBJECT_HPP
14
19
20namespace wsf
21{
22namespace six_dof
23{
24class WSF_SIX_DOF_EXPORT PointMassPilotObject : public PilotObject
25{
26public:
29
31
32 // In most instances, PilotObject children should override this function
33 virtual bool ProcessInput(UtInput& aInput);
34
35 // In most instances, PilotObject children should override this function
36 virtual bool Initialize(int64_t aSimTime_nanosec);
37
38 void ManageFrozenControls() override;
39
40 // This returns the "type" of pilot object -- each child of this class
41 // should override this function.
42 std::string GetPilotType() const override { return "PointMassPilotObject"; }
43
44 // Control input positions -------------------------------------------------------------
45
46 // These functions return the current positions of specified control inputs
47
48 // This returns the current stick back control input position
49 double GetStickBackControllerPosition() const override;
50
51 // This returns the current stick right control input position
52 double GetStickRightControllerPosition() const override;
53
54 // This returns the current rudder right control input position
55 double GetRudderRightControllerPosition() const override;
56
57 // This returns the current throttle control input position,
58 // using IDLE=0, MIL=1.0, and AB=2.0
59 double GetThrottleControllerPosition() const override;
60
61 // This returns the current military (non-afterburner) throttle control
62 // input position. For a combined military/afterburner throttle value,
63 // use GetThrottleControllerPosition() instead.
64 double GetThrottleMilitaryControllerPosition() const override;
65
66 // This returns the current afterburner throttle control input
67 // position. For a combined military/afterburner throttle value,
68 // use GetThrottleControllerPosition() instead.
69 double GetThrottleAfterburnerControllerPosition() const override;
70
71 // This returns the current speed brakes control input position
72 double GetSpeedBrakesControllerPosition() const override;
73
74 // This returns the current flaps control input position
75 double GetFlapsControllerPosition() const override;
76
77 // This returns the current landing gear control input position
78 virtual double GetLandingGearControllerPosition() const override;
79
80 // This returns the current spoilers control input position
81 double GetSpoilersControllerPosition() const override;
82
83 // This returns the current thrust reverser control input position
84 double GetThrustReverserControllerPosition() const override { return 0.0; }
85
86 // Manual pilot functions --------------------------------------------------------------
87 // TODO -- These will be moved to the manual pilot classes, as appropriate
88
89 // These functions provide an interface for a ManualPilot controlled via
90 // input from a crew station.
91
92 // This allows external controls to be "injected" into the PointMassPilotObject.
93 // This variant allows a reduced set of inputs, omitting rudder.
94 // The aStickRightPosition and aStickAftPosition values are +/-1. The
95 // aSpdBrakeLeverPosition, aSpoilerLeverPosition, and aFlapsLeverPosition
96 // are 0-1. The aThrottleLeverPosition assumes that 0 is idle, 1 is full power
97 // without augmentation/afterburner (military power), and 2 is full power
98 // with full augmentation/afterburner (full afterburner).
99 void SetManualControlData(double aStickRightPosition,
100 double aStickAftPosition,
101 double aThrottleLeverPosition,
102 double aSpdBrakeLeverPosition,
103 double aSpoilerLeverPosition,
104 double aFlapsLeverPosition) override;
105
106 // This allows external controls to be "injected" into the PointMassPilotObject.
107 // This variant includes rudder control. The aStickRightPosition, aStickAftPosition
108 // and aRudderRightPosition values are +/-1. The aSpdBrakeLeverPosition,
109 // aSpoilerLeverPosition, and aFlapsLeverPosition are 0-1. The
110 // aThrottleLeverPosition assumes that 0 is idle, 1 is full power without
111 // augmentation/afterburner (military power), and 2 is full power with full
112 // augmentation/afterburner (full afterburner).
113 void SetManualControlData(double aStickRightPosition,
114 double aStickAftPosition,
115 double aRudderRightPosition,
116 double aThrottleLeverPosition,
117 double aSpdBrakeLeverPosition,
118 double aSpoilerLeverPosition,
119 double aFlapsLeverPosition) override;
120
121 // This allows external controls to be "injected" into the PointMassPilotObject.
122 // This variant adds landing gear control. The aStickRightPosition, aStickAftPosition
123 // and aRudderRightPosition values are +/-1. The aSpdBrakeLeverPosition,
124 // aSpoilerLeverPosition, aFlapsLeverPosition, and aLandingGearLeverPosition are 0-1.
125 // The aThrottleLeverPosition assumes that 0 is idle, 1 is full power without
126 // augmentation/afterburner (military power), and 2 is full power with full
127 // augmentation/afterburner (full afterburner). The aLandingGearLeverPosition assumes
128 // that 0 is gear up and 1 is gear full down and locked.
129 void SetManualControlData(double aStickRightPosition,
130 double aStickAftPosition,
131 double aRudderRightPosition,
132 double aThrottleLeverPosition,
133 double aSpdBrakeLeverPosition,
134 double aSpoilerLeverPosition,
135 double aFlapsLeverPosition,
136 double aLandingGearLeverPosition) override;
137
138 // This allows external controls to be "injected" into the PointMassPilotObject.
139 // This variant adds thrust vectoring and enhanced landing gear and braking
140 // controls. The aStickRightPosition, aStickAftPosition, aRudderRightPosition,
141 // aThrustVectorYawRightPosition, aThrustVectorPitchUpPosition,
142 // aThrustVectorRollRightPosition, and aNoseWheelSteeringRightPosition values
143 // are +/-1. The aWheelBrakeLeftPosition and aWheelBrakeRightPosition assume
144 // that 0 is brake off and 1 is full brake. The aSpdBrakeLeverPosition,
145 // aSpoilerLeverPosition, aFlapsLeverPosition, and aLandingGearLeverPosition
146 // are 0-1. The aThrottleLeverPosition assumes that 0 is idle, 1 is full power
147 // without augmentation/afterburner (military power), and 2 is full power with
148 // full augmentation/afterburner (full afterburner). The
149 // aThrustReverserLeverPosition assumes that 0 is no reverser and 1 is full
150 // reverser. The aLandingGearLeverPosition assumes that 0 is gear up and 1 is
151 // gear full down and locked. The aNWS_Enabled is a flag to enable/disable
152 // Nose Wheel Steering (NWS) and assumes false is normal mode and true is NWS
153 // mode. NWS mode provides a greater range of motion for the nose wheel, often
154 // used when taxiing.
155 void SetManualControlData(double aStickRightPosition,
156 double aStickAftPosition,
157 double aRudderRightPosition,
158 double aThrottleLeverPosition,
159 double aThrustReverserLeverPosition,
160 double aThrustVectorYawRightPosition,
161 double aThrustVectorPitchUpPosition,
162 double aThrustVectorRollRightPosition,
163 double aSpdBrakeLeverPosition,
164 double aSpoilerLeverPosition,
165 double aFlapsLeverPosition,
166 double aLandingGearLeverPosition,
167 double aNoseWheelSteeringRightPosition,
168 double aWheelBrakeLeftPosition,
169 double aWheelBrakeRightPosition,
170 bool aNWS_Enabled) override;
171
172 // Synthetic pilot functions -----------------------------------------------------------
173 // TODO -- These will be moved to the synthetic pilot class, as appropriate
174
175 // These functions provide an interface for a SyntheticPilot controlled via
176 // script commands
177
178 // This allows external controls to be "injected" into the PointMassPilotObject.
179 // This variant allows a reduced set of inputs, omitting rudder.
180 // The aStickRightPosition and aStickAftPosition values are +/-1. The
181 // aSpdBrakeLeverPosition, aSpoilerLeverPosition, and aFlapsLeverPosition
182 // are 0-1. The aThrottleLeverPosition assumes that 0 is idle, 1 is full power
183 // without augmentation/afterburner (military power), and 2 is full power
184 // with full augmentation/afterburner (full afterburner).
185 void SetExternalDirectControlData(double aStickRightPosition,
186 double aStickAftPosition,
187 double aThrottleLeverPosition,
188 double aSpdBrakeLeverPosition,
189 double aSpoilerLeverPosition,
190 double aFlapsLeverPosition) override;
191
192 // This allows external controls to be "injected" into the PointMassPilotObject.
193 // This variant includes rudder control. The aStickRightPosition, aStickAftPosition
194 // and aRudderRightPosition values are +/-1. The aSpdBrakeLeverPosition,
195 // aSpoilerLeverPosition, and aFlapsLeverPosition are 0-1. The
196 // aThrottleLeverPosition assumes that 0 is idle, 1 is full power without
197 // augmentation/afterburner (military power), and 2 is full power with full
198 // augmentation/afterburner (full afterburner).
199 void SetExternalDirectControlData(double aStickRightPosition,
200 double aStickAftPosition,
201 double aRudderRightPosition,
202 double aThrottleLeverPosition,
203 double aSpdBrakeLeverPosition,
204 double aSpoilerLeverPosition,
205 double aFlapsLeverPosition) override;
206
207 // This allows external controls to be "injected" into the PointMassPilotObject.
208 // This variant adds landing gear control. The aStickRightPosition, aStickAftPosition
209 // and aRudderRightPosition values are +/-1. The aSpdBrakeLeverPosition,
210 // aSpoilerLeverPosition, aFlapsLeverPosition, and aLandingGearLeverPosition are 0-1.
211 // The aThrottleLeverPosition assumes that 0 is idle, 1 is full power without
212 // augmentation/afterburner (military power), and 2 is full power with full
213 // augmentation/afterburner (full afterburner). The aLandingGearLeverPosition assumes
214 // that 0 is gear up and 1 is gear full down and locked.
215 void SetExternalDirectControlData(double aStickRightPosition,
216 double aStickAftPosition,
217 double aRudderRightPosition,
218 double aThrottleLeverPosition,
219 double aSpdBrakeLeverPosition,
220 double aSpoilerLeverPosition,
221 double aFlapsLeverPosition,
222 double aLandingGearLeverPosition) override;
223
224 // This allows external controls to be "injected" into the PointMassPilotObject.
225 // This variant adds thrust vectoring and enhanced landing gear and braking
226 // controls. The aStickRightPosition, aStickAftPosition, aRudderRightPosition,
227 // aThrustVectorYawRightPosition, aThrustVectorPitchUpPosition,
228 // aThrustVectorRollRightPosition, and aNoseWheelSteeringRightPosition values
229 // are +/-1. The aWheelBrakeLeftPosition and aWheelBrakeRightPosition assume
230 // that 0 is brake off and 1 is full brake. The aSpdBrakeLeverPosition,
231 // aSpoilerLeverPosition, aFlapsLeverPosition, and aLandingGearLeverPosition
232 // are 0-1. The aThrottleLeverPosition assumes that 0 is idle, 1 is full power
233 // without augmentation/afterburner (military power), and 2 is full power with
234 // full augmentation/afterburner (full afterburner). The
235 // aThrustReverserLeverPosition assumes that 0 is no reverser and 1 is full
236 // reverser. The aLandingGearLeverPosition assumes that 0 is gear up and 1 is
237 // gear full down and locked. The aNWS_Enabled is a flag to enable/disable
238 // Nose Wheel Steering (NWS) and assumes false is normal mode and true is NWS
239 // mode. NWS mode provides a greater range of motion for the nose wheel, often
240 // used when taxiing.
241 void SetExternalDirectControlData(double aStickRightPosition,
242 double aStickAftPosition,
243 double aRudderRightPosition,
244 double aThrottleLeverPosition,
245 double aThrustReverserLeverPosition,
246 double aThrustVectorYawRightPosition,
247 double aThrustVectorPitchUpPosition,
248 double aThrustVectorRollRightPosition,
249 double aSpdBrakeLeverPosition,
250 double aSpoilerLeverPosition,
251 double aFlapsLeverPosition,
252 double aLandingGearLeverPosition,
253 double aNoseWheelSteeringRightPosition,
254 double aWheelBrakeLeftPosition,
255 double aWheelBrakeRightPosition,
256 bool aNWS_Enabled) override;
257
258 // Testing support functions -----------------------------------------------------------
259
260 // Testing Support -- These functions are used when testing. Note that they are
261 // inherited, and are not overridable, since all PilotObjects support "testing".
262
263 // This next group of functions are typically used to set controls for testing
264 // and "calculation" functions.
265
266 // Sets the stick right control: -1=Full Forward (nose down), 0=Neutral,
267 // 1=Full Aft (nose up)
268 void SetTestStickBackControllerPosition(double aStickAftPosition) override;
269
270 // Sets the stick right control: -1=Full Left, 0=Neutral, 1=Full Right
271 void SetTestStickRightControllerPosition(double aStickRightPosition) override;
272
273 // Sets the rudder right control: -1=Full Left, 0=Neutral, 1=Full Right
274 void SetTestRudderRightControllerPosition(double aRudderRightPosition) override;
275
276 // Sets the speed brake control: 0=Closed, 1=Open
277 void SetTestSpeedBrakesControllerPosition(double aSpeedBrakesPosition) override;
278
279 // Sets the flaps control: 0=Retracted, 1=Fully Extended
280 void SetTestFlapsControllerPosition(double aFlapsPosition) override;
281
282 // Sets the spoilers control: 0=Retracted, 1=Fully Extended
283 void SetTestSpoilersControllerPosition(double aSpoilersPosition) override;
284
285 // Sets the landing gear control: 0=Retracted, 1=Fully Extended
286 void SetTestLandingGearControllerPosition(double aLandingGearPosition) override;
287
288 // These functions provide the ability to "preposition" the vehicle to a
289 // specified altitude and speed during testing. Note that these should only be
290 // used in testing, since they directly modify the speed/altitude.
291
292 // -------------------------------------------------------------------------------------
293
294 // The CommonController (autopilot) typically controls the throttle and speed brakes
295 // as part of its speed control. However, these can be overridden with direct commands.
296
298 CommonController* GetCommonController() const override { return mCommonController.get(); }
299
300 // Stick and rudder position are normally controlled by the autopilot, but can be
301 // overridden using these direct input functions.
302
303 void SetDirectStickBackInput(double aStickBackPosition) override;
304 void SetDirectStickRightInput(double aStickBackPosition) override;
305 void SetDirectRudderRightInput(double aStickBackPosition) override;
306
307 // Speed brakes are normally controlled by the autopilot, but they can be overridden
308 // using these direct input functions.
309
310 void OpenSpeedBrake() override;
311 void CloseSpeedBrake() override;
312 void SetDirectSpeedBrakesInput(double aValue) override;
313
314 // -------------------------------------------------------------------------------------
315
316 // These functions provide control inputs for landing gear, flaps, spoilers,
317 // thrust reversers, and nose wheel steering (NWS)
318
319 void SetLandingGearControlPosition(double aPosition) override;
320 void SetFlapsControlPosition(double aPosition) override;
321 void SetSpoilersControlPosition(double aPosition) override;
322 void SetThrustReverserControlPosition(double aPosition) override;
323
324 // -------------------------------------------------------------------------------------
325
326protected:
328
329 // Inherited PilotObject Functions -- These functions are not overridden;
330 // child PilotObjects will simply inherit these internal functions.
331
332 // This "zeros" control inputs if controls are disabled
333 void ZeroDisabledControlData() override;
334
335 // This updates the active pilot object with the commands from the parent vehicle
336 void InheritParentControlData() override;
337
338 // SetThrottleData assumes that 1 is full, unaugmented power (military power)
339 // and 2.0 is full afterburner. This function is called (directly or indirectly)
340 // by all variants of the SetControlData functions.
341 void SetThrottleData(double aThrottleLeverPosition) override;
342
343 // This sets the current military (non-afterburner) throttle control input position
344 void SetThrottleMilitaryData(double aThrottleLeverPosition) override;
345
346 // This sets the current afterburner throttle control input position
347 void SetThrottleAfterburnerData(double aThrottleLeverPosition) override;
348
349 void EnforceControlLimits() override;
350
351 // *** THIS SHOULD BE OVERRIDDEN BY EACH PILOT OBJECT ***
352 // This uses the internal controls (mAutopilotControls of type
353 // PointMassSixDOF_AutopilotDataTypes::sAutopilotControls) to set the actual controls
354 void LoadControlDataWithAutopilotControlData() override;
355
356 // *** THIS SHOULD BE OVERRIDDEN BY EACH PILOT OBJECT ***
357 // This uses the internal controls (mAutopilotControls of type
358 // PointMassSixDOF_AutopilotDataTypes::sAutopilotControls) to set the actual controls
359 void LoadControlDataWithAutopilotStabilityData() override;
360
361 UtCloneablePtr<PointMassCommonController> mCommonController{nullptr};
362
363 float mStdStickBack = 0.0f;
364 float mStdStickRight = 0.0f;
365 float mStdRudderRight = 0.0f;
366 float mStdThrottleMil = 0.0f;
367 float mStdThrottleAB = 0.0f;
368 float mStdSpeedBrakesOut = 0.0f;
369 float mStdFlapsDown = 0.0f;
370 float mStdSpoilersOut = 0.0f;
371};
372} // namespace six_dof
373} // namespace wsf
374
375#endif
Definition WsfSixDOF_CommonController.hpp:38
Definition WsfPointMassSixDOF_CommonController.hpp:26
Definition WsfPointMassSixDOF_PilotObject.hpp:25
float mStdThrottleMil
Definition WsfPointMassSixDOF_PilotObject.hpp:366
float mStdRudderRight
Definition WsfPointMassSixDOF_PilotObject.hpp:365
virtual bool ProcessInput(UtInput &aInput)
Definition WsfPointMassSixDOF_PilotObject.cpp:49
float mStdSpoilersOut
Definition WsfPointMassSixDOF_PilotObject.hpp:370
double GetThrustReverserControllerPosition() const override
Definition WsfPointMassSixDOF_PilotObject.hpp:84
float mStdThrottleAB
Definition WsfPointMassSixDOF_PilotObject.hpp:367
std::string GetPilotType() const override
Definition WsfPointMassSixDOF_PilotObject.hpp:42
float mStdFlapsDown
Definition WsfPointMassSixDOF_PilotObject.hpp:369
void ManageFrozenControls() override
Definition WsfPointMassSixDOF_PilotObject.cpp:83
CommonController * GetCommonController() const override
Definition WsfPointMassSixDOF_PilotObject.hpp:298
UtCloneablePtr< PointMassCommonController > mCommonController
Definition WsfPointMassSixDOF_PilotObject.hpp:361
PointMassCommonController * GetPointMassCommonController() const
Definition WsfPointMassSixDOF_PilotObject.hpp:297
virtual bool Initialize(int64_t aSimTime_nanosec)
Definition WsfPointMassSixDOF_PilotObject.cpp:76
PointMassPilotObject & operator=(const PointMassPilotObject &other)=delete
float mStdStickRight
Definition WsfPointMassSixDOF_PilotObject.hpp:364
float mStdStickBack
Definition WsfPointMassSixDOF_PilotObject.hpp:363
float mStdSpeedBrakesOut
Definition WsfPointMassSixDOF_PilotObject.hpp:368
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved