• 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 pitch control

Messages
531
Country
france
Hello,

This problem is not new, I also had it with fs9/FSX and could find a workaround, but not this time.
I would like to control a pitch with the autopilot. For example, imagine I would like the autopilot to maintain a 3° nose up attitude. Is this possible?

I tried to use AP_ATT_HOLD and also AP_PITCH_LEVELER with AP_PITCH_REF_SET but nothing worked...
Any help is greatly welcome.

Thanks,
Eric
 
Hi Eric

I guess you've tried this?

If (pitch is correct)
{
KEY_AP_ATT_HOLD_ON
KEY_AP_WING_LEVELER_OFF
}


-Dai
 
I did this, without turning wing leveler off. It didn't have any effect...
During my test, the autopilot was used to maintain heading and nothing was used for the pitch control. Using AP_ATT_HOLD_ON didn't have any effect, while I was expecting that A/P maintains the attitude.
Maybe I missed something, but I don't know what.
 
You used code like this?

XML:
(>K:AP_ATT_HOLD_ON) (>K:AP_WING_LEVELER_OFF)

or

XML:
(>K:AP_ATT_HOLD_ON) (>K:AP_WING_LEVELER_OFF)
 
I don't code in XML, I use Javascript, so my code was:
Code:
SimVar.SetSimVarValue("K:AP_AT_HOLD_ON", "bool", 1);
I didn't switch off the wing leveler.
I will try this.

I also tried to use the pitch mode, hoping I could set it to a certain value:
Code:
SimVar.SetSimVarValue("K:AP_PITCH_REF_SET", "degrees", -2.0);
SimVar.SetSimVarValue("K:AP_PITCH_LEVELER_ON", "Bool", 1);
It didn't work any better, maybe I used it the wrong way...
 
I have tested, and by switching wing leveler off, it works !!
Here is my code, as suggested by you:
Code:
SimVar.SetSimVarValue("K:AP_ATT_HOLD_ON", "Bool", 1);
SimVar.SetSimVarValue("K:AP_WING_LEVELER_OFF", "Bool", 1);
The current pitch attitude is maintained, perfect :)
 
Yeah - that's what I was trying to say above. I put the code into a function called pitchHold()
Code:
void pitchHold(boolean hold)
{
  if(hold == true)
  {
    trigger_key_event(KEY_AP_ATT_HOLD_ON, 0);
    trigger_key_event(KEY_AP_WING_LEVELER_OFF);
  }
  else
  {
    trigger_key_event(KEY_AP_ATT_HOLD_OFF, 0);
  }
  return;
}
Note that I don't turn the wing leveller back on because I find it to be a complete nuisance. Perhaps you could do something similar in JavaScript which would save you having to think about it in the future?
 
Back
Top