WSF
WsfRigidBodySixDOF_CommonController.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 WSFRIGIDBODYSIXDOFCOMMONCONTROLLER_HPP
13#define WSFRIGIDBODYSIXDOFCOMMONCONTROLLER_HPP
14
19
20namespace wsf
21{
22namespace six_dof
23{
24class WSF_SIX_DOF_EXPORT RigidBodyCommonController : public CommonController
25{
26public:
28 explicit RigidBodyCommonController(UtInput& aInput, const std::string& aCommand);
30
32
34
35 void ReadSupportFile(const std::string& aFilename);
36
37 void Update(sAutopilotControls& aControls, int64_t aSimTime_nanosec) override;
38
39 void SetParentVehicle(Mover* aVehicle) override { mParentVehiclePtr = utils::CastToRigidBody(aVehicle); }
40
41 // This is used to "enable" taxi mode. When in taxi mode, the vehicle may use different
42 // controls. For example, a bank-to-turn aircraft will use rudder pedals to control
43 // left/right motion rather than the control stick to control roll left/right.
44 void SetTaxiMode(bool aTaxiModeActive);
45
46 // Returns true if taxi mode is active
47 bool GetTaxiMode() const;
48
49 void SetDesiredTaxiRadius(double aTaxiRadius_ft);
50
51 // This provides the stickBack position to create a zero moment at the specified mach and alpha.
52 // Returns true if data is valid.
53 bool GetStickForZeroMomentVsMachAlpha(double aMach, double aAlpha_rad, double aThrottleSetting, double& aStickBack) const;
54
55 // If true, a simple yaw damper should be used
56 bool UseSimpleYawDamper() const { return mUseSimpleYawDamper; }
57
58protected:
60
61 void LoadConfigFile(const std::string& aFilename);
62 void ProcessInputCommand(UtInput& aInput, const std::string& aCommand) override;
63
64 void ProcessLaternalNavChannelsBankToTurn(double aSimTime) override;
65 void ProcessVerticalNavChannelBankToTurn(double aSimTime) override;
66 void ProcessSpeedChannelBankToTurn(double aSimTime) override;
67
68 void ProcessLaternalNavChannelsYawToTurn(double aSimTime) override;
69 void ProcessVerticalNavChannelYawToTurn(double aSimTime) override;
70 void ProcessSpeedChannelYawToTurn(double aSimTime) override;
71
72 // Lateral modes ------------------------------------------------------------------
73
74 void ProcessLateralNavMode_Taxi_Waypoint(double aSimTime);
75 void ProcessLateralNavMode_Taxi_Heading(double aSimTime);
76 void ProcessLateralNavMode_Taxi_YawRate(double aSimTime);
77
78 void ProcessStandardLateralNavMode_Beta(double aCommandedBeta_deg, double aSimTime) override;
79
80 void ProcessStandardLateralNavMode_TaxiHeading(double aHeading_deg, double aTurnRate_dps, double aSimTime);
81 void ProcessStandardLateralNavMode_TaxiYawRate(double aCommandedYawRate_dps, double aSimTime);
82
83 // Vertical modes -----------------------------------------------------------------
84
85 void ProcessStandardVerticalNavMode_Alpha(double aCommandedAlpha_deg, double aSimTime) override;
86
87 void ProcessVerticalNavMode_Taxi(double aSimTime); // (Not yet implemented) TODO
88
89 // Speed modes --------------------------------------------------------------------
90
91 double ProcessSpeedMode_Taxi_Waypoint(double aSimTime); // (Not yet implemented) TODO
92 double ProcessSpeedMode_Taxi_ForwardAccel(double aSimTime); // (Not yet implemented) TODO
93 double ProcessSpeedMode_Taxi_KIAS(double aSimTime); // (Not yet implemented) TODO
94 double ProcessSpeedMode_Taxi_KTAS(double aSimTime); // (Not yet implemented) TODO
95 double ProcessStandardSpeedModeTaxi_FPS(double aSpeed_fps, double aSimTime);
96
97 // --------------------------------------------------------------------------------
98
99 PID* GetPID_ByType(Pid::Type aTableType) override;
100
101 // This returns the current aim heading (deg) and turn rate (deg/sec)
102 void GetAimHeadingAndTurnRateForTaxiWaypointNav_deg(double aSimTime, double& aAimHeading_deg, double& aTurnRate_dps);
103
104 void SetControllingValueForAllPIDs(double aControllingValue);
105
106 // This is updated in the Update() function so that the state data can be easily
107 // used in other functions in this class
108
109private:
110 Mover* GetParentVehicle() override;
111
112 RigidBodyMover* mParentVehiclePtr = nullptr;
113
114 double mCombinedWheelBraking = 0.0;
115 double mWheelBrakingLeft = 0.0;
116 double mWheelBrakingRight = 0.0;
117
118 double mExternalGearControlValue = 0.0;
119 double mExternalLftWheelBrakeControlValue = 0.0;
120 double mExternalRgtWheelBrakeControlValue = 0.0;
121
122 bool mTaxiModeActive = false;
123
124 double mMinimumTaxiTurnRadius_ft = 50.0;
125 double mDesiredTaxiTurnRadius_ft = 50.0;
126
127 UtCloneablePtr<UtTable::Table> mStickForZeroMomentVsMachAlphaTablePtr{nullptr};
128 UtCloneablePtr<UtTable::Table> mThrustDeltaStickForZeroMomentVsMachAlphaTablePtr{nullptr};
129 UtCloneablePtr<UtTable::Table> mXcgDeltaStickForZeroMomentVsMachAlphaTablePtr{nullptr};
130 UtCloneablePtr<UtTable::Table> mZcgDeltaStickForZeroMomentVsMachAlphaTablePtr{nullptr};
131
132 bool mUseSimpleYawDamper = false;
133};
134} // namespace six_dof
135} // namespace wsf
136
137#endif // WSFRIGIDBODYSIXDOFCOMMONCONTROLLER_H
aObjectPtr Update(simTime)
This is a base class for detailed air movers. This umbrella can cover RB6 or PM6 models.
Definition WsfSixDOF_Mover.hpp:58
Definition WsfSixDOF_PID.hpp:42
Definition WsfRigidBodySixDOF_CommonController.hpp:25
bool UseSimpleYawDamper() const
Definition WsfRigidBodySixDOF_CommonController.hpp:56
void ReadSupportFile(const std::string &aFilename)
Definition WsfRigidBodySixDOF_CommonController.cpp:744
RigidBodyCommonController * Clone() const
Definition WsfRigidBodySixDOF_CommonController.cpp:57
RigidBodyCommonController & operator=(const RigidBodyCommonController &other)=delete
void SetParentVehicle(Mover *aVehicle) override
Definition WsfRigidBodySixDOF_CommonController.hpp:39
Definition WsfRigidBodySixDOF_Mover.hpp:38
Type
Definition WsfSixDOF_VehicleData.hpp:112
WSF_SIX_DOF_EXPORT RigidBodyMover * CastToRigidBody(Mover *aVehicle)
Definition WsfRigidBodySixDOF_Utils.cpp:44
Definition WsfSA_Processor.hpp:35
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfSixDOF_CommonController.hpp:41
Copyrights Multiple, All Rights Reserved