WSF
WsfRigidBodySixDOF_LandingGear.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 WSFRIGIDBODYSIXDOFLANDINGGEAR_HPP
13#define WSFRIGIDBODYSIXDOFLANDINGGEAR_HPP
14
15#include "wsf_six_dof_export.h"
16
17#include <cinttypes>
18#include <string>
19#include <vector>
20
21#include "UtCloneablePtr.hpp"
22class UtInput;
23#include "UtVec3dX.hpp"
25#include "WsfSixDOF_Object.hpp"
26
27namespace wsf
28{
29namespace six_dof
30{
31// The RigidBodyLandingGear class provides a means to provide forces and moments produced
32// by landing gear and/or other contact points on the vehicle which are handled by
33// instances of the RigidBodyGroundReactionPoint class.
34
35class WSF_SIX_DOF_EXPORT RigidBodyLandingGear : public Object
36{
37public:
40
42
44
45 void SetParentVehicle(Mover* aParentVehicle) override;
46
47 // ProcessInput reads initialization data
48 bool ProcessInput(UtInput& aInput);
49 bool Initialize(int64_t aSimTime_nanosec);
50 bool Initialize2();
51
52 // This function should be called to "update" the landing gear, including updating
53 // internal parameters. The aDesiredForceBasedFrictionDirectionInSurfaceVecNED
54 // is used for force-based friction conditions.
55 void Update(int64_t aSimTime_nanosec, UtVec3dX& aRequiredOpposingForceInSurfaceVecNED_lbs);
56
57 void SetLastUpdateSimTime(int64_t aLastUpdateSimTime_nanosec)
58 {
59 mLastUpdateSimTime_nanosec = aLastUpdateSimTime_nanosec;
60 }
61
62 // This returns the total force and moment produced by all reaction points
63 // It should be called after Update() is called.
64 void GetForceAndMoments(UtVec3dX& aForce_lbs, UtVec3dX& aMoment_ftlbs) const;
65
66 // This returns true if at least one reaction point exceeded its maximum compression.
67 // Exceeding maximum compression usually means the vehicle has crashed.
69
70 // This returns true if at least one reaction point is in contact with the ground/surface
72
73 // This returns true if at least one landing gear point is in contact with the ground/surface
74 bool WeightOnWheels() const { return mWeightOnWheelsFlag; }
76
77 // This returns true if all landing gear are not moving
78 bool AllGearAtRest() const;
79
80 // This returns true if friction is large enough to hold the aircraft from moving
82
83 // This allows an external force (such as a ground tug) to apply a force
84 // to the nose gear. The angle is measured as zero being forward and
85 // positive angles being to the right
86 void ApplyExternalForce(double aForceMagnitude_lbs, double aAngle_deg);
87
88 // This allows an external force (such as a ground tug) to apply a force
89 // to the nose gear. The specified vector is in body coordinates.
90 void ApplyExternalForce(const UtVec3dX& aExternalForceBody_lbs);
91
92 // This removes any and all external forces on the nose gear
93 void RemoveExternalForce();
94
95 // This controls enabling of NWS (which allows a greater steering angle than normal mode
96 void EnableNWS(bool aEnable);
97
98 // This returns true is NWS is enabled
99 bool NWS_IsEnabled() const { return mNWS_IsEnabled; }
100
101 // This returns the distance (in feet) that the nose gear is from the reference point
102 // in body coordinates. If more than one nose gear exists, it returns the value
103 // for the first one encountered.
104 double NoseGearDistForwardOfReference_ft();
105
106 // This returns the distance (in feet) that the right main gear is from the reference point
107 // in body coordinates. If more than one right main gear exists, it returns the value
108 // for the first one encountered.
109 double RightMainGearRearwardOfReference_ft();
110
111 // This returns the distance (in feet) that the right main gear is from the reference point
112 // in body coordinates. If more than one right main gear exists, it returns the value
113 // for the first one encountered.
114 double RightMainGearSidewaysOfReference_ft();
115
116 // This calculates the steering angle to achieve the specified turn radius.
117 // Returns false if it cannot achieve the desired turn radius
118 void SteeringAngleForDesiredRadiusFt_deg(double aTurnRadius_ft, double& aSteeringAngle_deg, double aMaxSteeringAngle_deg);
119
120 // This returns a pointer to the nose gear
121 RigidBodyGroundReactionPoint* GetNoseGear();
122
123 // This returns a pointer to the right main gear
124 RigidBodyGroundReactionPoint* GetRightMainGear();
125
126 // This returns a pointer to the left main gear
127 RigidBodyGroundReactionPoint* GetLeftMainGear();
128
129 // This returns the nominal height (in meters) of the vehicle above ground
130 // level when resting on the landing gear. It is useful for determining the
131 // "altitude" of the vehicle when on the ground. Note that this is a nominal
132 // value -- the actual value will be based on gross weight, which will
133 // compress the gear more or less than nominal, changing the height.
135
136protected:
138
139 bool NameIsUnique(const std::string& aName) const;
140
141 // This is used (when at least one point is in contact with ground) to
142 // determine if the vehicle is at rest.
143 bool VehicleIsAtRest() const;
144
146 std::vector<UtCloneablePtr<RigidBodyGroundReactionPoint>> mListOfGroundReactionPoints;
158 bool mNWS_IsEnabled = false;
165};
166} // namespace six_dof
167} // namespace wsf
168
169#endif
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 WsfRigidBodySixDOF_GroundReactionPoint.hpp:32
Definition WsfRigidBodySixDOF_LandingGear.hpp:36
UtVec3dX mTotalMoment_ftlbs
Definition WsfRigidBodySixDOF_LandingGear.hpp:150
bool Initialize2()
Definition WsfRigidBodySixDOF_LandingGear.cpp:141
UtVec3dX mCurrentExternalForceBody_lbs
Definition WsfRigidBodySixDOF_LandingGear.hpp:148
void SetLastUpdateSimTime(int64_t aLastUpdateSimTime_nanosec)
Definition WsfRigidBodySixDOF_LandingGear.hpp:57
int64_t mLastUpdateSimTime_nanosec
Definition WsfRigidBodySixDOF_LandingGear.hpp:145
bool mWeightOnNoseWheelFlag
Definition WsfRigidBodySixDOF_LandingGear.hpp:155
bool SomethingIsInContactWithGround() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:71
RigidBodyLandingGear * Clone() const
Definition WsfRigidBodySixDOF_LandingGear.cpp:43
bool WeightOnWheels() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:74
bool mApplyExternalForce
Definition WsfRigidBodySixDOF_LandingGear.hpp:147
std::string mNWSEnableControlName
Definition WsfRigidBodySixDOF_LandingGear.hpp:159
RigidBodyGroundReactionPoint * mNoseGear
Definition WsfRigidBodySixDOF_LandingGear.hpp:162
bool mSomethingExceededMaxCompression
Definition WsfRigidBodySixDOF_LandingGear.hpp:152
bool ProcessInput(UtInput &aInput)
Definition WsfRigidBodySixDOF_LandingGear.cpp:57
bool mWeightOnWheelsFlag
Definition WsfRigidBodySixDOF_LandingGear.hpp:154
bool FrictionHoldingStill() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:81
bool WeightOnNoseWheel() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:75
RigidBodyGroundReactionPoint * mLeftMainGear
Definition WsfRigidBodySixDOF_LandingGear.hpp:164
UtVec3dX mTotalForce_lbs
Definition WsfRigidBodySixDOF_LandingGear.hpp:149
bool mNWS_IsEnabled
Definition WsfRigidBodySixDOF_LandingGear.hpp:158
bool Initialize(int64_t aSimTime_nanosec)
Definition WsfRigidBodySixDOF_LandingGear.cpp:112
std::vector< UtCloneablePtr< RigidBodyGroundReactionPoint > > mListOfGroundReactionPoints
Definition WsfRigidBodySixDOF_LandingGear.hpp:146
bool SomethingExceededMaxCompression() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:68
bool NWS_IsEnabled() const
Definition WsfRigidBodySixDOF_LandingGear.hpp:99
RigidBodyLandingGear & operator=(const RigidBodyLandingGear &other)=delete
void SetParentVehicle(Mover *aParentVehicle) override
Definition WsfRigidBodySixDOF_LandingGear.cpp:48
bool mFrictionHoldingStill
Definition WsfRigidBodySixDOF_LandingGear.hpp:157
UtVec3dX mLastVehicleVelocityOnGround_mps
Definition WsfRigidBodySixDOF_LandingGear.hpp:151
double GetNominalHeightAboveGroundOnGear()
Definition WsfRigidBodySixDOF_LandingGear.hpp:134
double mNominalHgtAboveGndOnGear_m
Definition WsfRigidBodySixDOF_LandingGear.hpp:161
RigidBodyGroundReactionPoint * mRightMainGear
Definition WsfRigidBodySixDOF_LandingGear.hpp:163
size_t mNWSEnableControlHandle
Definition WsfRigidBodySixDOF_LandingGear.hpp:160
bool mLastTimeAtRestOnSurface
Definition WsfRigidBodySixDOF_LandingGear.hpp:156
bool mSomethingIsInContactWithGround
Definition WsfRigidBodySixDOF_LandingGear.hpp:153
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