Jump to content
Sign in to follow this  
Guest Magma

XYZ ECEF positional variables

Recommended Posts

Guest Magma

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
Guest IanK

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
Guest Magma

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.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Magma

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.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Magma

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
Guest Magma

(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
Guest Magma

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
Guest Magma

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...