Sign in to follow this  
Guest Magma

XYZ ECEF positional variables

Recommended Posts

Does anyone know if FS has any aircraft positional variables that are available in earth-centered/earth-fixed (ECEF) format? I know that XML has velocity variables in XYZ but I haven't seen any positional XYZ variables. XYZ variables are so much easier in doing vector/matrix mathematics.Thanks,Thomas Magma

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hello Thomas,which version 9 used a biconal projection but 10 will probably use an ellipsoidal model to get up to both poles.Ian

Share this post


Link to post
Share on other sites

According to the appendix to the FS9 SDK "Creating Terrain and Land Classification" (May 2004):In Flight Simulator, the earth is defined as an

Share this post


Link to post
Share on other sites

The ECEF coordinate system does not care what model is used for the shape of the earth. It is simply the XYZ coordinates relative to the earths center (usually in meters). I have the sneaking suspicion that FS uses XYZ coordinate system as a basis to determine position of an aircraft and then converts it to long, lat and alt. I want access to the raw XYZ variable to make my math easier and more efficient in my gauge application. I see XML has parameters called:XML_VELOCITY_WORLD_XXML_VELOCITY_WORLD_YXML_VELOCITY_WORLD_ZThis is great when working with velocity vectors, but I would also like to have something like:XML_POSITION_WORLD_XXML_POSITION_WORLD_YXML_POSITION_WORLD_ZTo have this would make it easy to work with vector mathematics.I see that GAUGES.H have a typedef struct that looks like this:typedef struct XYZF64{ union { struct { FLOAT64 lon; FLOAT64 alt; FLOAT64 lat; }; struct { FLOAT64 x; FLOAT64 y; FLOAT64 z; }; struct { FLOAT64 pitch; FLOAT64 heading; FLOAT64 bank;}; };}XYZF64, *PXYZF64, **PPXYZF64,POS3_FLOAT64,VEL3_FLOAT64, *PVEL3_FLOAT64, **PPVEL3_FLOAT64,ACC3_FLOAT64,ROT3_FLOAT64,ROV3_FLOAT64,ROA3_FLOAT64;But I'm not really sure what this means or if/how I can gain access to the XYZ variables. Any thoughts anyone?ThanksThomas Magma

Share this post


Link to post
Share on other sites

Unless you are coding a C gauge, the gauges.h file is useless for your needs. XML gauges have no access to anything in gauges.h directly or indirectly.Aircraft positions are reported by FS as lat, lon, and alt... period.

Share this post


Link to post
Share on other sites

Yes, I am coding in C. I'm importing the XML parameters into my C code. Are you hinting it is in fact possible to acquirer XYZ parameters in C? What about this 'typedef struct XYZF64' union that is in gauges.h? Does this imply that these x y & z variables are somehow accessible to me?typedef struct XYZF64{ union { struct { FLOAT64 lon; FLOAT64 alt; FLOAT64lat; }; struct { FLOAT64 x; FLOAT64 y; FLOAT64 z; }; struct { FLOAT64 pitch; FLOAT64 heading; FLOAT64bank;}; };}XYZF64, *PXYZF64, **PPXYZF64,POS3_FLOAT64,VEL3_FLOAT64, *PVEL3_FLOAT64, **PPVEL3_FLOAT64,ACC3_FLOAT64,ROT3_FLOAT64,ROV3_FLOAT64,ROA3_FLOAT64;Thanks,Thomas Magma

Share this post


Link to post
Share on other sites

No. The X, Y, Z used in the struc are in fact the same velecocity vector variables directly accessible the 'regular way.' They are not static coordinates of the objects absolute spatial position.

Share this post


Link to post
Share on other sites

Thanks I can see that now ... POS3, VEL3 & ROT3 = position, velocity and rotation. But what about this other typedef that is actually commented as calling it a point vector.// XYZF32 - XYZW point(vector) in floating pointtypedef struct XYZF32 { FLOAT32 x; FLOAT32 y; FLOAT32 z; FLOAT32 w;} XYZF32, *PXYZF32;#ifdef __cplusplusstruct CXYZF32:public XYZF32{ CXYZF32() { } CXYZF32(FLOAT32 _x, FLOAT32 _y, FLOAT32 _z, FLOAT32 _w=1.0f) {x = _x; y = _y; z = _z; w = _w;}};#endifMagma

Share this post


Link to post
Share on other sites

(In conclusion to this thread.)I could not find any access to the ECEF XYZ variables in MS flight Simulator and it doesn't look like they are available in FSX either. This really surprised me since this is probably the foundation in which FS bases its coordinate system on. I ended up having the convert back from Lat, Long, Alt (LLA) to ECEF in a subroutine. I guess it is working OK, but at a cost processing power. I am going to send a request to the FS design team to allow access to ECEF variables from the runtime environment.Cheers,Thomas Magma

Share this post


Link to post
Share on other sites

Out of interest, what are you using the ECEF variables for? Also, how do you get the Ellipsoid Height in addition to latitude and longitude?

Share this post


Link to post
Share on other sites

The ellipsoid height is based off a reference ellipsoid, and the definition of the reference ellipsoid (oblate spheroid) that FS uses is published in the doc Creating Terrain and Land Classification. However, I'm pretty sure that the dimension for polar diameter written in that doc is a type-o and I just ended up using WGS84 definitions for the reference ellipsoid. It turns out that the ECEF coordinate system is much easier to do vector mathematics with than LLA coordinates. I use this math to determine relative velocities and approach angles between objects traveling on the ground and in the air.Thomas Magma

Share this post


Link to post
Share on other sites

But, the Ellipsoid Height is the height above the ellipsoid - roughly equivalent to height. How do you obtain this from Flight Simulator? To get the three ECEF coordinates surely you need three input coordinates to define the aircraft's position - lat, lon and height?

Share this post


Link to post
Share on other sites

I use the variable PLANE_ALTITUDE. Which is the "height" above the reference ellipsoid in meters. I'm pretty sure that the reference ellipsoid is equivalent to sea level in FS because I don't think that they would have modeled in gravitational distortions or the pull of the moon (tidal forces).Thomas Magma

Share this post


Link to post
Share on other sites

Heights above sea-level seem to be a confusing area. WGS84 gives the best fit to the earth world-wide but there are significant local difference. According to the UK Ordnance Survey(OS), WGS84 is about 50m different from the Airey Ellipsoid which gives a better fit for the UK. Also, there's 10m difference between the east and west of the UK.Incidebntally, the OS give a method of calculation to go directly from lat, long, and height to x, y, and z but only gives an interative calculation to go back again. Do you know of a direct method?

Share this post


Link to post
Share on other sites

Your content will need to be approved by a moderator

Guest
You are commenting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this