Jump to content
The simFlight Network Forums

Heading, Altitude Write to Sim Computation (FSUIPC WebSocket Server)


Dabull

Recommended Posts

Can someone please verify if this is the correct reverse computation to write back heading (0x0580) and altitude (0x6020) to the sim? I think altitude is pretty much easy.  I am not convinced of the heading though.

I extracted it as follows:

heading = Math.round(response.data.heading * 360 / (65536*65536))
altitude = Math.round(response.data.altitude * 3.28084)

And I plan to write back as follows:

var newheading = (plannedrecord.heading / 360) * (65536/65536)
var newaltitude = plannedrecord.altitude / 3.28084
Link to comment
Share on other sites

It worked for heading. But for altitude I could not write as x6020 you cannot write to. So I found x0570 that you can write to. But it behaves oddly when I pass the altitude in meters. It flips the plane over and shuts the engine off.

Is the computation for writing to this offset different?

Link to comment
Share on other sites

4 minutes ago, Dabull said:

Is the computation for writing to this offset different?

Yes it's completely different. 6020 is an easier way of reading the altitude. 

0570 is an 8-byte integer (not a float like 6020) so you'll need to declare it as

{ name: 'altitude', address: 0x0570, type: 'int', size: 8 },

The conversion to metres/feet is:

var altitudeMetres = data.altitude / (65535 * 65535);
var altitudeFeet = data.altitude / (65535 * 65535) * 3.28084;

Conversion from metres/feet is:

var newAltitude = altitudeMetres * (65535 * 65535);
var newAltitude = altitudeFeet / 3.28084 * (65535 * 65535);

Paul

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.