FlightGear next
FGLGear.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGLGear.h
4 Author: Jon S. Berndt
5 Date started: 11/18/99
6
7 ------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26HISTORY
27--------------------------------------------------------------------------------
2811/18/99 JSB Created
29
30%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31SENTRY
32%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34#ifndef FGLGEAR_H
35#define FGLGEAR_H
36
37/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
38INCLUDES
39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
40
41#include <string>
42
46#include "FGSurface.h"
47
48/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49FORWARD DECLARATIONS
50%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
51
52namespace JSBSim {
53
54class FGTable;
55class Element;
57
58/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59CLASS DOCUMENTATION
60%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
61
185
186/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187CLASS DECLARATION
188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
189
190class FGLGear : protected FGSurface, public FGForce
191{
192public:
213
231 FGLGear(Element* el, FGFDMExec* Executive, int number, const struct Inputs& input);
233 ~FGLGear();
234
238 const FGColumnVector3& GetBodyForces(FGSurface *surface = NULL);
239
242 return Ts2b * (vXYZn - in.vXYZcg);
243 }
244 double GetBodyLocation(int idx) const {
245 FGColumnVector3 vWhlBodyVec = Ts2b * (vXYZn - in.vXYZcg);
246 return vWhlBodyVec(idx);
247 }
248
249 const FGColumnVector3& GetLocalGear(void) const { return vLocalGear; }
250 double GetLocalGear(int idx) const { return vLocalGear(idx); }
251
253 const std::string& GetName(void) const {return name; }
255 bool GetWOW(void) const {return WOW; }
257 double GetCompLen(void) const {return compressLength;}
259 double GetCompVel(void) const {return compressSpeed; }
261 double GetCompForce(void) const {return StrutForce; }
262
264 void SetWOW(bool wow) {WOW = wow;}
265
268 void SetReport(bool flag) { ReportEnable = flag; }
271 bool GetReport(void) const { return ReportEnable; }
272 double GetSteerNorm(void) const {
273 return maxSteerAngle == 0.0 ? 0.0 : radtodeg/maxSteerAngle*SteerAngle;
274 }
275 void SetSteerCmd(double cmd) { SetSteerAngleDeg(cmd * maxSteerAngle); }
276 double GetstaticFCoeff(void) const { return staticFCoeff; }
277
278 int GetBrakeGroup(void) const { return (int)eBrakeGrp; }
279 int GetSteerType(void) const { return (int)eSteerType; }
280
281 bool GetSteerable(void) const { return eSteerType != stFixed; }
282 bool GetRetractable(void) const { return isRetractable; }
283 bool GetGearUnitUp(void) const { return isRetractable ? (GetGearUnitPos() < 0.01) : false; }
284 bool GetGearUnitDown(void) const { return isRetractable ? (GetGearUnitPos() > 0.99) : true; }
285
286 double GetWheelRollForce(void) {
287 UpdateForces();
288 FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
289 return vForce(eX)*cos(SteerAngle) + vForce(eY)*sin(SteerAngle); }
290 double GetWheelSideForce(void) {
291 UpdateForces();
292 FGColumnVector3 vForce = mTGear.Transposed() * FGForce::GetBodyForces();
293 return vForce(eY)*cos(SteerAngle) - vForce(eX)*sin(SteerAngle); }
294 double GetBodyXForce(void) {
295 UpdateForces();
296 return FGForce::GetBodyForces()(eX);
297 }
298 double GetBodyYForce(void) {
299 UpdateForces();
300 return FGForce::GetBodyForces()(eY);
301 }
302 double GetBodyZForce(void) {
303 UpdateForces();
304 return FGForce::GetBodyForces()(eZ);
305 }
306 double GetWheelRollVel(void) const { return vWhlVelVec(eX)*cos(SteerAngle)
307 + vWhlVelVec(eY)*sin(SteerAngle); }
308 double GetWheelSideVel(void) const { return vWhlVelVec(eY)*cos(SteerAngle)
309 - vWhlVelVec(eX)*sin(SteerAngle); }
310 double GetWheelSlipAngle(void) const { return WheelSlip; }
311 double GetWheelVel(int axis) const { return vWhlVelVec(axis);}
312 bool IsBogey(void) const { return (eContactType == ctBOGEY);}
313 double GetGearUnitPos(void) const;
314 double GetSteerAngleDeg(void) const { return radtodeg*SteerAngle; }
315 void SetSteerAngleDeg(double angle) {
316 if (eSteerType != stFixed && !Castered)
317 SteerAngle = degtorad * angle;
318 }
319
320 const struct Inputs& in;
321
322 void ResetToIC(void);
323 void bind(void);
324
325private:
326 int GearNumber;
327 static const FGMatrix33 Tb2s, Ts2b;
328 FGMatrix33 mTGear;
329 FGColumnVector3 vLocalGear;
330 FGColumnVector3 vWhlVelVec, vGroundWhlVel; // Velocity of this wheel
331 FGColumnVector3 vGroundNormal;
332 FGTable *ForceY_Table;
333 FGFunction *fStrutForce;
334 double SteerAngle;
335 double kSpring;
336 double bDamp;
337 double bDampRebound;
338 double compressLength;
339 double compressSpeed;
340 double rollingFCoeff;
341 double Stiffness, Shape, Peak, Curvature; // Pacejka factors
342 double BrakeFCoeff;
343 double maxCompLen;
344 double SinkRate;
345 double GroundSpeed;
346 double TakeoffDistanceTraveled;
347 double TakeoffDistanceTraveled50ft;
348 double LandingDistanceTraveled;
349 double MaximumStrutForce, StrutForce;
350 double MaximumStrutTravel;
351 double FCoeff;
352 double WheelSlip;
353 double GearPos;
354 bool WOW;
355 bool lastWOW;
356 bool FirstContact;
357 bool StartedGroundRun;
358 bool LandingReported;
359 bool TakeoffReported;
360 bool ReportEnable;
361 bool isRetractable;
362 bool Castered;
363 bool StaticFriction;
364 std::string name;
365
366 BrakeGroup eBrakeGrp;
367 ContactType eContactType;
368 SteerType eSteerType;
369 DampType eDampType;
370 DampType eDampTypeRebound;
371 double maxSteerAngle;
372
373 LagrangeMultiplier LMultiplier[3];
374
375 FGGroundReactions* GroundReactions;
376 FGPropertyManager* PropertyManager;
377
378 mutable bool useFCSGearPos;
379
380 void ComputeBrakeForceCoefficient(void);
381 void ComputeSteeringAngle(void);
382 void ComputeSlipAngle(void);
383 void ComputeSideForceCoefficient(void);
384 void ComputeVerticalStrutForce(void);
385 void ComputeGroundFrame(void);
386 void ComputeJacobian(const FGColumnVector3& vWhlContactVec);
387 void UpdateForces(void);
388 void SetstaticFCoeff(double coeff);
389 void CrashDetect(void);
390 void InitializeReporting(void);
391 void ResetReporting(void);
392 void ReportTakeoffOrLanding(void);
393 void Report(ReportType rt);
394 void Debug(int from);
395};
396}
397
398//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
399
400#endif
This class implements a 3 element column vector.
virtual const FGColumnVector3 & GetBodyForces(void)
Definition FGForce.cpp:81
FGColumnVector3 vXYZn
Definition FGForce.h:314
FGForce(FGFDMExec *FDMExec)
Constructor.
Definition FGForce.cpp:53
Represents a mathematical function.
Definition FGFunction.h:753
Manages ground reactions modeling.
static constexpr double radtodeg
Definition FGJSBBase.h:348
static constexpr double degtorad
Definition FGJSBBase.h:349
void SetSteerAngleDeg(double angle)
Definition FGLGear.h:315
BrakeGroup
Brake grouping enumerators.
Definition FGLGear.h:215
bool GetGearUnitUp(void) const
Definition FGLGear.h:283
DampType
Damping types.
Definition FGLGear.h:223
int GetSteerType(void) const
Definition FGLGear.h:279
ContactType
Contact point type.
Definition FGLGear.h:219
void SetReport(bool flag)
Set the console touchdown reporting feature.
Definition FGLGear.h:268
double GetWheelSlipAngle(void) const
Definition FGLGear.h:310
void ResetToIC(void)
Definition FGLGear.cpp:247
double GetLocalGear(int idx) const
Definition FGLGear.h:250
double GetCompLen(void) const
Gets the current compressed length of the gear in feet.
Definition FGLGear.h:257
~FGLGear()
Destructor.
Definition FGLGear.cpp:238
bool GetGearUnitDown(void) const
Definition FGLGear.h:284
double GetBodyYForce(void)
Definition FGLGear.h:298
double GetWheelRollVel(void) const
Definition FGLGear.h:306
bool GetRetractable(void) const
Definition FGLGear.h:282
double GetWheelSideForce(void)
Definition FGLGear.h:290
double GetBodyZForce(void)
Definition FGLGear.h:302
double GetstaticFCoeff(void) const
Definition FGLGear.h:276
bool GetSteerable(void) const
Definition FGLGear.h:281
double GetBodyXForce(void)
Definition FGLGear.h:294
const struct Inputs & in
Definition FGLGear.h:320
const FGColumnVector3 & GetLocalGear(void) const
Definition FGLGear.h:249
double GetCompVel(void) const
Gets the current gear compression velocity in ft/sec.
Definition FGLGear.h:259
void bind(void)
Definition FGLGear.cpp:770
double GetGearUnitPos(void) const
Definition FGLGear.cpp:661
double GetSteerNorm(void) const
Definition FGLGear.h:272
double GetSteerAngleDeg(void) const
Definition FGLGear.h:314
FGLGear(Element *el, FGFDMExec *Executive, int number, const struct Inputs &input)
Constructor.
Definition FGLGear.cpp:71
FrictionType
Friction types.
Definition FGLGear.h:225
bool GetWOW(void) const
Gets the Weight On Wheels flag value.
Definition FGLGear.h:255
ReportType
Report type enumerators.
Definition FGLGear.h:221
double GetWheelSideVel(void) const
Definition FGLGear.h:308
double GetWheelVel(int axis) const
Definition FGLGear.h:311
double GetWheelRollForce(void)
Definition FGLGear.h:286
int GetBrakeGroup(void) const
Definition FGLGear.h:278
bool IsBogey(void) const
Definition FGLGear.h:312
double GetBodyLocation(int idx) const
Definition FGLGear.h:244
double GetCompForce(void) const
Gets the gear compression force in pounds.
Definition FGLGear.h:261
FGColumnVector3 GetBodyLocation(void) const
Gets the location of the gear in Body axes.
Definition FGLGear.h:241
void SetWOW(bool wow)
Sets the weight-on-wheels flag.
Definition FGLGear.h:264
const std::string & GetName(void) const
Gets the name of the gear.
Definition FGLGear.h:253
bool GetReport(void) const
Get the console touchdown reporting feature.
Definition FGLGear.h:271
void SetSteerCmd(double cmd)
Definition FGLGear.h:275
SteerType
Steering group membership enumerators.
Definition FGLGear.h:217
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF).
Definition FGLocation.h:152
Handles matrix math operations.
Definition FGMatrix33.h:70
Base class for all surface properties.
Definition FGSurface.h:62
FGSurface(FGFDMExec *fdmex, int number=-1)
Constructor.
Definition FGSurface.cpp:52
Lookup table class.
Definition FGTable.h:234
std::vector< double > BrakePos
Definition FGLGear.h:209
FGColumnVector3 vXYZcg
Definition FGLGear.h:207
FGColumnVector3 PQR
Definition FGLGear.h:205
FGColumnVector3 UVW
Definition FGLGear.h:206