Jump to content

SDK HELP WITH AUTOPILOT


Recommended Posts

Hello, I am new to the SDK but have been working with it pretty well. My problem is whenever I have my program enable the autopilot altitude hold the value currently set in the autopilot altitude hold level resets. The same happens for the opposite; when I set the value for the level it disables itself. As you can see this goes in an endless loop causing an annoyance since once I set the level it shuts off and vice versa. My question is what can I do about this?

BTW i am programming in C#

Thanks,

Dave Katzman

davidkatzman@attbi.com

Link to comment
Share on other sites

Here is just the code for setting the autopilot alt hold:

fsuipc.FSUIPC_Write(iOffset,lVal,ref token,ref dwResult);

translateResultCode(dwResult);

fsuipc.FSUIPC_Process(ref dwResult);

where iOffset = 0x07D4

lVal = 1 for on or 0 for off

ref token = -1

and ref dwResult is an int to hold the result

WHat happens is if i had previously set the alt hold altitude through my program, if i next call this then the value i set before gets set to 00000 and it gets enabled, and vice versa.

Link to comment
Share on other sites

Guest hsors

Hi Dave

It seems in your code you made a confusion between

AP altitude hold value at 0x7D4 which is not 0 or 1 but is a long coded as meters x 65536 (as an example 2000 ft is 39950746) and..

AP altitude lock flag at 0x7D0, also a long, which enables (1) or disables (0) the AP altitude hold function

The 2 offsets appear to be independant..so you should first write the desired AP locked altitude at 0x7D4 (after making the necessary conversion) and then enable the alt function by writting 1 at 0x7D0..or vice versa since processing the 2 calls all together only takes a few ms..

Hervé

Link to comment
Share on other sites

Dave,

I don't know much about C#, but if you could post your variable declarations for iOffset, lVal, token and dwResult (ie. their types) that could help us.

Have you tried a simple test program that does just the 2 functions in a similar manner as you think you are currently using them in your main program?

Have you checked the actual values you are passing to FSUIPC_Write each time? Perhaps debug it by flagging any value of lVal which is not 0 and not 1 for 0x7D0, and flag values <2 for lVal when passed to 0x7D4?

Chris

Link to comment
Share on other sites

I did what you said and it helped a ton :D . What I did was make another application that just dealt with those two variables and entered the data right into the write command. It seems my problem lies somewhere in my other code when the values get converted from what they are to the write values. I am going to start from scratch and make functions for each different function.

BTW just in case anyone was wondering what I was doing, I am building a voice commander for the autopilot. It will be totally controllable through voice. If anyone would like to be able to test this once I am finished please e-mail me at davidkatzman@attbi.com. Also, any other suggestions are welcome as to what other functions to include besides autopilot or what else to add.

Dave

Link to comment
Share on other sites

Thanks for the info, but mine is going to have a little more program specific information in it. I am going to re-develop it with a whole new approach. If I have any suggestions as to what to include, or add please, please let me know. ANY input is appreciated!

Dave

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
 Share

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