Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I´m having some problems with some versions of fuipc reading the aricraft heading. If I use FSUIPC 2.xx everithing is fine, but using fsuipc 3, for some reason it adds some number more, for example

The aricraft heading is 324, and my VB program says that the heading is 336,

Here is the source code:

Dim x As Currency

Dim X2 As Currency

Dim c As Currency

Dim c2 As Currency

Dim ceros As String

If FSUIPC_Read(&H580, 4, VarPtr(x), dwResult) Then

If FSUIPC_Process(dwResult) Then

X2 = x * 360#

c = X2 / (65536# * 65536#) * 10000#

c2 = CInt© + 1

If Len(CStr(c2)) = 1# Then

ceros = "00"

End If

If Len(CStr(c2)) = 2# Then

ceros = "0"

End If

If Len(CStr(c2)) = 3# Then

ceros = ""

End If

frmMain.Label4.Caption = ceros + CStr(c2)

Else

' Unable to "Process"

frmMain.Label4.Caption = "Processing: " & ResultText(dwResult)

End If

Else

' Unable to "Read"

frmMain.Label4.Caption = "Reading: " & ResultText(dwResult)

End If

I hope someone can help me.

Regards

Thomas.

Posted

Heya Thomas...

The heading from 0580 is a "True" not a magnetic heading. You need to compensate for each degree variation (based on location in the world). Look at offset 02A0

Magnetic variation (signed, –ve = West). For degrees *360/65536. Convert True headings to Magnetic by subtracting this value, Magnetic headings to True by adding this value.

Hope that helps !!

Brian

Posted
I´m having some problems with some versions of fuipc reading the aricraft heading. If I use FSUIPC 2.xx everithing is fine, but using fsuipc 3, for some reason it adds some number more, for example

The aricraft heading is 324, and my VB program says that the heading is 336

The aircraft heading is as supplied by FS without any calculations being done by FSUIPC. There will be no difference at all between versions 2.xx and 3.xx. The difference you are seeing is probably because you are checking the values in difference places -- the magnetic variation varies a lot all over the world.

If you want the magnetic heading you need to convert from the true heading you are reading. See Brian's post, that should help.

Regards,

Pete

Posted

Great, what a coincidence... I am currently working on heading too. Now, I can add that question on this tppic. I am having same problem for VB codes... The description " (signed, -ve = west ) "seem to be vague for me. what is signed? Assume ie HEADING? and -ve? can anyone give me clear understaing these words mean?

With VB coedes I suppose I m having difficult to understand how to write the codes converting true heading into Magenetic or magnetic into True.

this is what I wrote:

Dim Heading as Long

Dim dwResult

Call FSUIPC_Read(&H2A0, 4, VarPtr(Heading),dwResult)

Call FSUIPC_Process(dwResult)

TRUEHDG.Caption = Format (Heading "000")

MAGHDG.Caption = Format (Heading, "000")

Heading = Heading - (360\65536) '\\ Coverting True to Magnetic

Heading = Heading + (360\65536) '\\Cnverting Magentic to True [code]

Did I write the equation or calculates the equalvent wrong? If so can anyone help me out to correct it??

Posted

The description " (signed, -ve = west ) "seem to be vague for me. what is signed? Assume ie HEADING? and -ve? can anyone give me clear understaing these words mean?

Signed means the number can be negative (i.e. less than zero) or positive (greater than zero). Those terms are pretty ordinary English words really, not at all technical. An example of a positive number is +1, whilst -1 would be a negative number.

Headings are not generally used in a signed sense -- a heading runs from 0 to 359 degrees (plus fractions of course). But the magnetic variation might add to or subtract from that depending on whether the local mag var is to the East or West, and whether you are converting from TRUE to MAG heading, or from MAG to TRUE.

Call FSUIPC_Read(&H2A0, 4, VarPtr(Heading),dwResult)

Offset 02A0 contains only the magnetic variation, NOT the heading. Please refer to the table in the Programmers Guide where all this is clearly defined.

I think you need to understand what you want to do and what the terms mean BEFORE you start actual programming. Do it on paper, with a pencil, some paper, and a map. Learn a little navigation the manual way first, and everything will soon become clear. There are some very good books on all this. It sounds like you are trying to run before you can walk.

Regards,

Pete

Posted
I think you need to understand what you want to do and what the terms mean BEFORE you start actual programming. Do it on paper, with a pencil, some paper, and a map. Learn a little navigation the manual way first, and everything will soon become clear. There are some very good books on all this. It sounds like you are trying to run before you can walk.

Yes, I've always write down on pieces pf paper and pencil before doing my work. I have that experience when I took Programming classes back in few semesters ago at college. There are some certain thing I do understand how to write a program based on the source that am using which point out what codes can happen at the results.

But when it comes to implementing games, especially FSUIPC. It kinda a little different for me, and kinda far advanced. With insufficent information from FSUIPC SDK for VB, it is kinda of hard tor me to be able to figure out from my head and that get me to ask so many questions that I am unaware of. I guess you can say I rely on sources too much.

Now on the part, I am confusing with offsets that I wanted to work with. say, if I was going to work on heading variation (displaying heading changing numbers once aircraft is banking). I wouldn't know which specific offsets can work with the one I am looking for.

I may be good at implementing codes in general, but not on FSUIPC as of yet. This is where I really want to learn, maybe need a few tips from experiencers and write down on notes for my future benefit. That's only, if I dont find anything on FSUIPC Guideline. Kinda asking to bear with me. :D

Any suggestion, Pete?

Posted

if I was going to work on heading variation (displaying heading changing numbers once aircraft is banking). I wouldn't know which specific offsets can work with the one I am looking for.

If you want Magnetic Heading -- the one which would be displayed on a calibrated gyro-driven heading indicator, you need to read both the aircraft heading from offset 0580 (whch is TRUE), and the magnetic variation from 02A0, then do the calculations to get MAGNETIC.

If you want to make this incorrect for gyro drift when the pilot has not adjusted it to read the same as the magnetic "whiskey" compass when last flying straight and level, you need to also add the current drift amount from offset 0C3E. Modern jets wouldn't need this as the setting is automatically adjusted -- but the drift will be zero then in any case.

If you want the "whiskey" compass heading, which will not be showing you actual headings in a turn, only when flying straight and level, then you need instead to read the double floating point value at offset 02CC. You don't need to do any calculations with that one.

I think that about exhausts the varying "headings" you can deal with! :)

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.