On Freitag 20 Mai 2005 16:37, Andy Ross wrote:
> Mathias Fröhlich wrote:
> > At first I need to know how this local frame is meant.
> > What I have found from the code is that it is meant to be the *geodetic*
> > horizontal local frame.
> > But is is meant to be fixed at the aircraft and thus rotates due to the
> > aircrafts velocity or is it fixed at the earth and relocated for every
> > frame to display?
> For what it's worth, YASim supports this "NED" (north/east/down)
> coordinate frame for output, but doesn't use it internally.  It's
> pretty strange IMHO, and of course has a singularity problem at the
> poles.  If JSBSim is having trouble with it, it might be best to just
> junk the concept and fix the HUD code to use body coordinates.
Yep, JSBSim uses *a* horizontal local frame, the geocentric one.
But not the geodetic horizontal local frame like flightgear seems to expect.
And no sane guy will calculate how the geodetic (not geocentric!) horizontal 
local frame attached to the aircrafts center of gravity will rotate due to 
longitudinal movement ...
And that JSBSim uses that one has historical reasons and that I did not want 
to discuss the change of that with Jon at that time...
... I discussed for much smaller changes for weeks with him. :-/

Ok, Fixing that in the HUD and just use the orientation of the body frame and 
the body velocity for everything in the HUD would be a good idea IMO.
There are other issues with the HUD anyway.
- Having properties as inputs.
- Being able to clip the HUD to be limited to some line stripe surrounding the 
HUD glass.
- Being able to rotate the HUD so that it appears to be on that glass it is 
projected to.

But until then, Mike:

I have checked in into JSBSim's cvs a change which will make the inerial 
acceleration in the earth fixed geodetic horizontal local frame availabel to 
the HUD.
That patch is attached to this mail. So you could apply that to your local 
tree and use that until flightgears JSBsim is again synced with the original 



Mathias Fröhlich, email: [EMAIL PROTECTED]
Index: JSBSim.cxx
RCS file: /var/cvs/FlightGear-0.9/source/src/FDM/JSBSim/JSBSim.cxx,v
retrieving revision 1.31
diff -u -r1.31 JSBSim.cxx
--- JSBSim.cxx	16 Dec 2004 12:47:20 -0000	1.31
+++ JSBSim.cxx	21 May 2005 07:14:14 -0000
@@ -26,6 +26,7 @@
 #include <simgear/compiler.h>
+#include <simgear/math/sg_geodesy.hxx>
 #include <stdio.h>	//	size_t
@@ -552,9 +553,34 @@
                                Propagate->GetUVW(3) );
     // Make the HUD work ...
-    _set_Velocities_Ground( Propagate->GetVel(eNorth),
-                            Propagate->GetVel(eEast),
-                            -Propagate->GetVel(eDown) );
+    {
+      const FGLocation& l = Auxiliary->GetLocationVRP();
+      double xyz[3] = { l(eX)*SG_FEET_TO_METER,
+                        l(eY)*SG_FEET_TO_METER,
+                        l(eZ)*SG_FEET_TO_METER };
+      double lat, lon, alt;
+      sgCartToGeod(xyz, &lat, &lon, &alt);
+      FGQuaternion Tec2geodhl(0, -0.5*M_PI-lat, lon);
+      FGColumnVector3 ecVel = l.GetTl2ec()*Propagate->GetVel();
+      FGColumnVector3 geodhlVel = Tec2geodhl.GetT()*ecVel;
+      _set_Velocities_Ground( geodhlVel(eNorth)*SG_FEET_TO_METER,
+                              geodhlVel(eEast)*SG_FEET_TO_METER,
+                              -geodhlVel(eDown)*SG_FEET_TO_METER );
+      // Transform the acceleration to the earth centered frame and then
+      // back to the geodetic hl frame.
+      FGColumnVector3 accel = Propagate->GetUVWdot();
+      accel -= Propagate->GetUVW()*Propagate->GetPQR();
+      accel = Propagate->GetTb2l()*accel;
+      accel = l.GetTl2ec()*accel;
+      accel = Tec2geodhl.GetT()*accel;
+      _set_Accels_Local( accel(eNorth)*SG_FEET_TO_METER,
+                         accel(eEast)*SG_FEET_TO_METER,
+                         -accel(eDown)*SG_FEET_TO_METER);
+    }
     _set_V_rel_wind( Auxiliary->GetVt() );
Flightgear-devel mailing list

Reply via email to