I just stumbled across this thread and couldn't figure out whether it was resolved or not. Not being overly familiar with FlightGear, I'm not even sure what the inputs to this problem were. This is how I would approach it though...

Usually mag heading is calculated from a magnetic field model, eg, WMM 2000.

The main output of this model is the magnetic field vector, B, in geodetic (d) axes: [Bx_d By_d Bz_d].

Magnetic declination (magvar) and inclination (dip) are trig functions of these coordinates:

magvar = atan2(By_d/Bx_d)

dip = atan(Bz_d/sqrt(Bx_d^2 + By_d^2)) = asin(Bz_d/|B|)

Transforming the vector B into other coordinate systems gives other parameters of interest, eg:

Magnetic heading is given by psiM = -atan2(By_h/Bx_h), where h is for horizontal axes.

Indicated heading could be psiMI = -atan2(By_b/Bx_b), where b is for body axes (for a needle rotating in the plane of the wings).

To transform the vector B between different coordinate systems, you need the relevant direction cosine matrices:

T_bd=R3(phi)R2(theta)R1(psi)

T_bh=R3(phi)R2(theta)R1(0)

T_hd=R3(0)R2(0)R1(psi)

(notation: T_bd is body from geodetic axes, R1 is the yaw rotation matrix, R2 is the pitch rotation matrix and R3 is the roll rotation matrix.)

This provides the basis for relating everything to everything else. If you are starting with the magnetic field vector, the calculations are fairly straight forward. If you only have magvar and dip, then it's a bit more fiddly. If you don't want to use a matrix class, you can expand out the DCMs.

Regards, Rob

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to