GetAGLevel in CustomGroundCallback not being invoked #1174
Replies: 7 comments 1 reply
-
Okay, but you haven't shown your code where you set your custom ground callback as the callback to be used, e.g. Otherwise the default ground callback supplied by JSBSim will be used: jsbsim/src/models/FGInertial.cpp Line 76 in 0f00b80 |
Beta Was this translation helpful? Give feedback.
-
Thank You! Now It works in this way: std::shared_ptr<JSBSim::FGInertial> Inertial = FDMExec->GetInertial();
Inertial->SetGroundCallback(new CustomGroundCallback(mesh_probe, mesh_probe_rear)); Now it works, but it doesn't work well. The point of contact is not established, the plane falls vertically as if there were no ground under the wheels. I logged the elevation I'm sending, and the numbers are correct. |
Beta Was this translation helpful? Give feedback.
-
I logged location(0) and it is always at 0.00. |
Beta Was this translation helpful? Give feedback.
-
Should I subtract the elevation from the geodetic altitude before return? https://jsbsim-team.github.io/jsbsim/FGGroundCallback_8cpp_source.html double FGDefaultGroundCallback::GetAGLevel(double t, const FGLocation& loc,
FGLocation& contact, FGColumnVector3& normal,
FGColumnVector3& vel, FGColumnVector3& angularVel) const
{
vel.InitMatrix();
angularVel.InitMatrix();
FGLocation l = loc;
l.SetEllipse(a,b);
double latitude = l.GetGeodLatitudeRad();
double cosLat = cos(latitude);
double longitude = l.GetLongitude();
normal = FGColumnVector3(cosLat*cos(longitude), cosLat*sin(longitude),
sin(latitude));
contact.SetEllipse(a, b);
contact.SetPositionGeodetic(longitude, latitude, mTerrainElevation);
return l.GetGeodAltitude() - mTerrainElevation;
} |
Beta Was this translation helpful? Give feedback.
-
Do you have retractable gear, and if so, is the gear possibly retracted?
Remember, the function you're implementing needs to return the AGL between the |
Beta Was this translation helpful? Give feedback.
-
Not sure exactly what you mean by Now when loc
{mECLoc={data=0x000000000014eb68 {-7559866.5600183215, 12098308.575596180, 15298471.380769854} } mLon=...}
JSBSim::FGJSBBase: {...}
mECLoc: {data=0x000000000014eb68 {-7559866.5600183215, 12098308.575596180, 15298471.380769854} }
mLon: 0.0000000000000000
mLat: 0.0000000000000000
mRadius: 0.0000000000000000
mGeodLat: 0.0000000000000000
GeodeticAltitude: 0.0000000000000000
mTl2ec: {data=0x000000000014eba8 {0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, ...} }
mTec2l: {data=0x000000000014ebf0 {0.0000000000000000, 0.0000000000000000, 0.0000000000000000, 0.0000000000000000, ...} }
a: 1.0000000000000000
e2: 0.0000000000000000
c: 0.0000000000000000
ec: 1.0000000000000000
ec2: 1.0000000000000000
mCacheValid: false
mEllipseSet: false You will notice the following in the default ground callback that you posted above, i.e. it makes a copy of FGLocation l = loc;
l.SetEllipse(a,b);
double latitude = l.GetGeodLatitudeRad(); So this is what I see in the debugger for l
{mECLoc={data=0x000000000014e838 {-7559866.5600183215, 12098308.575596180, 15298471.380769854} } mLon=...}
JSBSim::FGJSBBase: {...}
mECLoc: {data=0x000000000014e838 {-7559866.5600183215, 12098308.575596180, 15298471.380769854} }
mLon: 2.1293019443065497
mLat: 0.82030435957987735
mRadius: 20918027.616959054
mGeodLat: 0.82364901223183440
GeodeticAltitude: 29995.922120246123
mTl2ec: {data=0x000000000014e878 {0.38876503631779880, -0.62215375568271758, 0.67954871115079740, -0.84804796003419902, ...} }
mTec2l: {data=0x000000000014e8c0 {0.38876503631779880, -0.84804796003419902, 0.36010610105724961, -0.62215375568271758, ...} }
a: 20925646.325460002
e2: 0.0066943800085510485
c: 140084.22842716915
ec: 0.99664718932601670
ec2: 0.99330561999144895
mCacheValid: true
mEllipseSet: true |
Beta Was this translation helpful? Give feedback.
-
I'm sorry, I can't do it, my skills are not sufficient, but thank you anyway. |
Beta Was this translation helpful? Give feedback.
-
Problem Description: I'm implementing a custom CustomGroundCallback class in JSBSim to handle ground interactions for landing gear. However, the GetAGLevel function is never called during the simulation, even though I followed examples and the model configuration seems correct.
Here’s my implementation:
Question: Is there any additional configuration needed to ensure JSBSim uses this callback for gear interactions?
Thank you in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions