Jump to content
The simFlight Network Forums

Getting the Bank Angle of the Aircraft


Recommended Posts

Hello!

I was wondering how I can read the bank angle from FS, and to output the result in degrees. I'm programming a GPWS which will call out "Bank Angle - Bank Angle" when exceeding a 30 deg (or what you like to set it to) turn.

I've tried to use 057C-offset, but the values varies a lot when I get them. I'm programming in Visual Basic 6.

/Chazzie

Link to comment
Share on other sites

I've tried to use 057C-offset, but the values varies a lot when I get them. I'm programming in Visual Basic 6.

Sounds like you have an error then. Please check out FSInterrogate in the SDK. Use it with my FSUIPC.FSI file, also in the SDK, and you can see not only the value changing, but also compare all of its different "raw" forms depending how it is interpreted.

My bet is that you are losing part of the value -- maybe multiplying the possibly very large integer by 360 and so overflowing? If so either convert the value to floating point BEFORE calculating, or do at least part of the divisions first.

Regards,

Pete

Link to comment
Share on other sites

What would be the correct formula for converting the raw in-data?

is *360 / (65536*65536) used to write the data, if the input-data is the degrees from the user, or is it the other way around?

Also, when using FSInterrogate I only get 0's in all fields...

Link to comment
Share on other sites

is *360 / (65536*65536) used to write the data, if the input-data is the degrees from the user, or is it the other way around

It describes how you get degrees from the value provided. All it means is that the FS way of storing angles is to scale them so the biggest possible angle (360 degrees, or for bank +/- 180) fills the entire capacity of the space available. This gives the best precision in a fixed point number.

So, 65536 * 65536 gives the total number of different values you can store in 32 bits (65536 is the number for 16 bits), and FS wants to use all those values to represent 360 degrees. Hence the scaling, for a value occupying n bits::

FS units = degrees * (number of values you can get in n bits) / 360, or

degrees = FS units * 360 / (number of values you can get in n bits)

You have to perform these calculations in such a way that you don't lose values by overflow or by truncation. The easy way out is to use floating point, but if you only want whole numbers of degrees, or some other approximation, then doing part of the division BEFORE the multiplication would be okay.

Also, when using FSInterrogate I only get 0's in all fields...

Is FS running? Is the aircraft banking? If so you've certainly got something wrong there. Are all the values zero? Maybe you are not using the version in a recent SDK and haven't registered FSUIPC? Check the FSUIPC log.

If you get used to using FSInterrogate to check your programming you will find it much faster and come to understand a lot more, more quickly. That's why it is provided.

Regards,

Pete

Link to comment
Share on other sites

Well I only have FSUIPC registered for my application, so maybe the error lies in my otherwise "user"-unregistered version of FSUIPC. I only use FSUIPC for communication with this software (right now atleast) so I don't feel the need to register it. Maybe later on I'll find a use for the registered version as a user, but currently I'm happy with my FlightSimming experience, as soon as my GPWS/FA/CoPilot software is complete :P

Link to comment
Share on other sites

Well I only have FSUIPC registered for my application, so maybe the error lies in my otherwise "user"-unregistered version of FSUIPC.

But the FSInterrogate.exe I supply in the FSUIPC SDK comes with a valid access key embedded in its "properties" and will work with unregistered installations of FSUIPC. These are the details:

FSinterrogate.exe

Product = "FSInterrogate", Company = "Pelle F. S. Liljendal"

Key = 161C 7AUZ D1BV

If it isn't connecting for reason of registration, it will say so in the Log, and this would imply you have a pretty old copy of the FSUIPC SDK. However, I also give the above details in the "Freeware Key" list near the top of this Forum.

Regards,

Pete

Link to comment
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
×
×
  • 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.