Skip to content

Commit

Permalink
Create AGL property for contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcleod authored and bcoconni committed Jun 29, 2024
1 parent c867cc7 commit 242650d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
29 changes: 17 additions & 12 deletions src/models/FGLGear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,21 +284,24 @@ const FGColumnVector3& FGLGear::GetBodyForces(void)

vFn.InitMatrix();

if (isRetractable) gearPos = GetGearUnitPos();
// Compute AGL
FGColumnVector3 normal, terrainVel, dummy;
FGLocation gearLoc, contact;
FGColumnVector3 vWhlBodyVec = Ts2b * (vXYZn - in.vXYZcg);

if (gearPos > 0.99) { // Gear DOWN
FGColumnVector3 normal, terrainVel, dummy;
FGLocation gearLoc, contact;
FGColumnVector3 vWhlBodyVec = Ts2b * (vXYZn - in.vXYZcg);
vLocalGear = in.Tb2l * vWhlBodyVec; // Get local frame wheel location
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
double height = fdmex->GetInertial()->GetContactPoint(gearLoc, contact,
normal, terrainVel, dummy);

vLocalGear = in.Tb2l * vWhlBodyVec; // Get local frame wheel location
gearLoc = in.Location.LocalToLocation(vLocalGear);
AGL = height;

// Compute the height of the theoretical location of the wheel (if strut is
// not compressed) with respect to the ground level
double height = fdmex->GetInertial()->GetContactPoint(gearLoc, contact,
normal, terrainVel,
dummy);
if (isRetractable) gearPos = GetGearUnitPos();

if (gearPos > 0.99) { // Gear DOWN

if (!fdmex->GetTrimStatus())
height -= GroundReactions->GetBumpHeight();
Expand Down Expand Up @@ -785,6 +788,8 @@ void FGLGear::bind(FGPropertyManager* PropertyManager)
return;
}

property_name = base_property_name + "/AGL";
PropertyManager->Tie(property_name.c_str(), &AGL);
property_name = base_property_name + "/WOW";
PropertyManager->Tie( property_name.c_str(), &WOW );
property_name = base_property_name + "/x-position";
Expand Down
1 change: 1 addition & 0 deletions src/models/FGLGear.h
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ class JSBSIM_API FGLGear : public FGForce
bool Castered;
bool StaticFriction;
std::string name;
double AGL;

BrakeGroup eBrakeGrp;
ContactType eContactType;
Expand Down

0 comments on commit 242650d

Please sign in to comment.