• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS Autopilot Altitude Hold Problem - Help Please

I'm hoping that some of the experts here can provide some much needed advice and assistance.

I'm trying to program a standard autopilot that has a flight director, standby button, altitude hold, altitude select, vertical speed button, IAS button etc.

According to the info I have, the normal procedure to fly up to a specific altitude after takeoff and having reached around 800 ft AGL is:

Prior to takeoff turn the altitude dial knob to the desired altitude, in this case let's say 5000 ft.
After departure and at around 800 ft AGL turn on the autopilot, which will also automatically turn on the yaw damper and flight director.
Press the altitude select button, which will highlight in white with the word ARM.
Press the VS button, which will highlight in green to indicate active.
Mouse roll over the VS rate wheel to select desired climb rate, let's say 1200 ft/min.

With the above having been done, the aircraft should climb at 1200 ft/min and then start leveling off at around 4700 - 4800 ft and the altitude select button should then change from ARM and turn white to indicate the word CAPTURE, which it does. The white CAPTURE then turns off and the altitude hold button turns green to now indicate that the altitude of 5000 ft is now being held.

Now for the part that doesn't seem to work:

After the 5000 ft altitude is captured, with altitude hold active, selecting any new altitude via the altitude dial knob will immediately cause the aircraft to either climb or descend, which is totally wrong!

The correct behaviour should be:

The 5000 ft altitude is changed to let's say 8000 ft using the altitude dial knob, the alt hold stays active and still holds 5000 ft.
The altitude select button is pressed and highlights in white with the word ARM, the alt hold still stays active and still holds 5000 ft.
Now the VS button is pressed and the alt hold light goes off, as VS mode has taken over, and we now again mouse roll over the VS rate wheel to select desired climb rate.
Only now does the aircraft climb and leave 5000 ft.

Is there something fundamentally wrong with the ASOBO autopilot templates that I'm getting the above wrong behaviour or is there some magic setting in one of the CFG files that I have missed?

I welcome any help to get this working correctly, for at the moment I just cannot get the autopilot to behave as it should.

That's how the sim's default autopilot works. You will have to write your own code to make it behave the way you need.
I would go one further and say that if you are familiar with the C++ language, it would be easier to do it as a WASM rather then those awful Asobo templates.
Uh... don't see how this thread has anything to do with templates... but, I'm known to miss things. A lot.
Is there something fundamentally wrong with the ASOBO autopilot templates that I'm getting the above wrong behaviour or is there some magic setting in one of the CFG files that I have missed?
Since the templates don't dictate how the internal autopilot functions... I'll say it again... don't see how it has anything to do with the templates.
I see nothing in the templates that controls what the actual internal autopilot will do when the altitude variable is changed.
The behavior they are seeing is the exact same default behavior of FS9, FSX, P3Dv1,2,3,4,5... So... I stand by my statement.
Ok. Ed, I am going to guess Dai had been referring to this:


as a means of addressing the described deficiencies. IMO, it is an "autopilot thread," with a reference to "autopilot templates," do keep up please. No one is arguing that the OP is not dealing with legacy autopilot functionality. I'll go on to suggest, although I may be mistaken, that "WASM" allows more direct control over functions, so the undesired altitude change behavior could likely be addressed using WASM.
Thanks for your insight.

I've managed to identify the actual problem template:


I fail to comprehend why a default template would be created by ASOBO that creates such unrealistic autopilot behaviour.

That template is the code that is "executed" when you push the ALT button on the autopilot. What part of it's code is the source of the problem? After all, it's only processed when the button is pushed. The behavior you're seeing is the exact same behavior the FS9/FSX/P3D autopilot exhibits. The reason for it is that the sim's internal autopilot code is always wanting to hold the value of AUTOPILOT ALTITUDE LOCK VAR when ALT hold is active. Any change to that variable and the internal autopilot code will try to get the aircraft to the new altitude value that's set.

The only way to get around this is to create one's own altitude hold lock variable and only pass that to the sim's AUTOPILOT ALTITUDE LOCK VAR when you want the internal autopilot code to use it.

Having read the templates through, including the ASOBO_AUTOPILOT_Knob_Altitude_SubTemplate (it gets called when you use the knob to change the altitude variable's value), I see no code that tells the autopilot to chase to the new altitude setting EXCEPT that the autopilot's internal behavior is EXACTLY like the FS9/FSX/P3D autopilot code.

I believe the flaw is still inside the core sim code, and the templates have nothing to do with it.