|
From: <ric...@gm...> - 2014-04-20 16:16:55
|
This is a really ugly hack that makes the problem go away for JSBSim aircraft that assume zero altitude AGL means crashed. I wouldn't suggest applying it -- more for discussion.
From f964f74e6733f7f337d2b5b6e3e430bc6387ccfe Mon Sep 17 00:00:00 2001
From: Richard Senior <ric...@gm...>
Date: Sun, 20 Apr 2014 16:39:38 +0100
Subject: [PATCH] Temporary fix to JSBSim to avoid zero altitude-agl with
scenery gaps
---
src/FDM/JSBSim/JSBSim.cxx | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/FDM/JSBSim/JSBSim.cxx b/src/FDM/JSBSim/JSBSim.cxx
index 91c4dd6..174dd3d 100644
--- a/src/FDM/JSBSim/JSBSim.cxx
+++ b/src/FDM/JSBSim/JSBSim.cxx
@@ -105,8 +105,12 @@ public:
FGColumnVector3& v, FGColumnVector3& w) const {
double loc_cart[3] = { l(FGJSBBase::eX), l(FGJSBBase::eY), l(FGJSBBase::eZ) };
double contact[3], normal[3], vel[3], angularVel[3], agl = 0;
- mInterface->get_agl_ft(t, loc_cart, SG_METER_TO_FEET*2, contact, normal,
+ bool valid_agl = mInterface->get_agl_ft(t, loc_cart, SG_METER_TO_FEET*2, contact, normal,
vel, angularVel, &agl);
+ if (!valid_agl) {
+ // Altitude above ground level is indeterminate
+ agl = DBL_MAX;
+ }
n = FGColumnVector3( normal[0], normal[1], normal[2] );
v = FGColumnVector3( vel[0], vel[1], vel[2] );
w = FGColumnVector3( angularVel[0], angularVel[1], angularVel[2] );
--
1.8.3.2
On 20 Apr 2014, at 13:51, Adams.syd <ada...@gm...> wrote:
> I can also confirm this.same thing happens flying from Cyvr to cyyj.i get stuck in midair about halfway there,over the ocean.
>
> Sent from Samsung Mobile
>
>
>
> Renk Thorsten <tho...@jy...> wrote:
>
>
>
>
> We have an odd bug with JSBSim planes hitting something solid in mid-air:
>
> http://forum.flightgear.org/viewtopic.php?f=25&t=22743
>
> The test case is to take off from EGFF (Cardiff) on runway 12, climb and maintain 120 degrees. Off the coast, there is a 'wall' in the sea where the ocean landclass of the coastal tile meets the generic auto-generated ocean landclass and they have a mismatch of a few meters in altitude. Since we're probably not bothering with z-buffer filling when rendering ocean, this also shows as a rendering artefact when seen from the right angle.
>
> Crossing this line, position/altitude-agl-ft goes to zero in JSBSim planes (apparently not for others). This in turn seems to trigger ground interaction code, crash detection etc. where this is implemented, leading to unwanted side-effects.
>
> Other users have reported that JSBSim also returns altitude-agl-ft of zero when the plane is above a gap in the scenery (no landclass defined, experimental terrain, possibly no tile loaded due to a hung tile manager...). It may be that this is a bug we've been carrying for a long time, but without ground interaction code and crash detection, it never became much apparent.
>
> So it would seem that discontinuities in the terrain mesh trigger something in JSBSim that confused the altitude above ground determination. If the JSBSim knowledgeable people could perhaps take a look?
>
> * Thorsten
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Flightgear-devel mailing list
> Fli...@li...
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech_______________________________________________
> Flightgear-devel mailing list
> Fli...@li...
> https://lists.sourceforge.net/lists/listinfo/flightgear-devel
|