From 1f73cf7f8aa85e0bb65db8119f9d1b892a1675f2 Mon Sep 17 00:00:00 2001 From: Sean McLeod Date: Sun, 30 Jun 2024 23:23:37 +0200 Subject: [PATCH] Add unit to AGL property name, comment for AGL member, prevent negative AGL value --- src/models/FGLGear.cpp | 8 +++++--- src/models/FGLGear.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/models/FGLGear.cpp b/src/models/FGLGear.cpp index abd51e0f5..d9aae6a6d 100644 --- a/src/models/FGLGear.cpp +++ b/src/models/FGLGear.cpp @@ -293,11 +293,13 @@ const FGColumnVector3& FGLGear::GetBodyForces(void) gearLoc = in.Location.LocalToLocation(vLocalGear); // Compute the height of the theoretical location of the wheel (if strut is - // not compressed) with respect to the ground level + // not compressed) with respect to the ground level (AGL) double height = fdmex->GetInertial()->GetContactPoint(gearLoc, contact, normal, terrainVel, dummy); - AGL = height; + // Don't want strut compression when in contact with the ground to return + // a negative AGL + AGL = max(height, 0.0); if (isRetractable) gearPos = GetGearUnitPos(); @@ -788,7 +790,7 @@ void FGLGear::bind(FGPropertyManager* PropertyManager) return; } - property_name = base_property_name + "/AGL"; + property_name = base_property_name + "/AGL-ft"; PropertyManager->Tie(property_name.c_str(), &AGL); property_name = base_property_name + "/WOW"; PropertyManager->Tie( property_name.c_str(), &WOW ); diff --git a/src/models/FGLGear.h b/src/models/FGLGear.h index 0fcbb5607..b35c2c36f 100644 --- a/src/models/FGLGear.h +++ b/src/models/FGLGear.h @@ -355,7 +355,7 @@ class JSBSIM_API FGLGear : public FGForce double maximumForce = DBL_MAX; double bumpiness = 0.0; bool isSolid = true; - bool WOW; + bool WOW; // Weight On Wheel bool lastWOW; bool FirstContact; bool StartedGroundRun; @@ -366,7 +366,7 @@ class JSBSIM_API FGLGear : public FGForce bool Castered; bool StaticFriction; std::string name; - double AGL; + double AGL; // Height above ground level BrakeGroup eBrakeGrp; ContactType eContactType;