Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I've been trying for awhile to translate an 8 byte floating point double value, specifically at Offset 0x6058 (FS2004 GPS cross track error), but can't seem to make sense of what I get back from FS2004. I thought it would be similar to getting the Latitude value at 0x0560 where using C# I just copy the quad word value into a double floating point variable then multiply by 90.0/(10001750.0 * 65536.0 * 65536.0), but I was wrong.

Can anyone help me?

Posted
I've been trying for awhile to translate an 8 byte floating point double value, specifically at Offset 0x6058 (FS2004 GPS cross track error), but can't seem to make sense of what I get back from FS2004. I thought it would be similar to getting the Latitude value at 0x0560 where using C# I just copy the quad word value into a double floating point variable then multiply by 90.0/(10001750.0 * 65536.0 * 65536.0), but I was wrong.

The Latitude value at 0560 is NOT floating point, but fixed point. Where a floating point value is documented, you simply read it directly into a floating point variable. Do not convert it into floating point, it is already floating point!

Pete

Posted

Pete,

Sorry I wasn't more clear in my first question: I was using the latitude offset as an example of how I got the correct value from fsuipc.

The problem I have is that when I try to get the value of say Offset 0x6058 (FS2004 GPS cross-track error) it doesn't make sense. If I use the same method that I use for latitude I get a very large number.

Dallas

Posted

The problem I have is that when I try to get the value of say Offset 0x6058 (FS2004 GPS cross-track error) it doesn't make sense. If I use the same method that I use for latitude I get a very large number.

You should not use the same method as you use for the latitude. That is the point. It will, indeed, look like a huge number if you do that, because floating point format is completely different to fixed point. You need to read floating point values directly into floating point variables (easy in C or C++), or at least copy them over in a way which doesn't convert them -- unlike your method for the latitude.

I'm afraid I cannot help further with your language. If you don't know how to use its floating point variables perhaps someone else will be able to help.

Regards

Pete

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.