Autopilot PIDs

Version: 1.1.6.34

Frequency: Consistently

Severity: High

Context: in flight → Developing, changing .cfg and hitting compile

Bug description:

The MSFS SDK documentation talks about PIDs variables to be used to set the autopilot inside system.cfg - [Autopilot] Section.

However this is very ambiguous as you are unable to set the roll PIDs and other properly on this section, instead, I found out, you have to set the AP roll PIDs inside the AI.cfg, which is miss leading and very odd.

Now I am trying to set Pitch PID and Vertical Speed via the AI.cfg and it have very little effect and I found out some configurations files instead inside system.cfg affected those..

Everything is confusing and out of place, while you guys can address the documentation, etc. could you please provide me with some advise that also other developers on this forums can use regarding:

A) What settings and which file controls roll PIDs for AP (G1000, G3000), which I believe is used for HDG hold, bank roll and ILS after working 10 hours straight changing settings to test.

B) What settings and which file controls Pitch PIDs that is used to “Pitch hold” for AP (G1000, G3000)

C) What settings and which file controls Vertical Speed PIDs that is used to “Vertical speed hold” for AP (G1000, G3000)

D) What settings and which file controls FLC PIDs that is used to “FLC Mode” for AP (G1000, G3000)

E) What settings and which file controls Navigation PIDs that is used for “FMS NAV Mode” for AP (G1000, G3000)

F) What settings and which file controls Altitude HOLD PIDs that is used for AP (G1000, G3000)

I understand D, E, F might be a combination of A, B, C but I think it would be helpful for the development community to understand this better, etc. Currently it is a struggle hunting down lots and lots on configurations inside multiple .cfg files to tweak your autopilot, ideally we should aim to a single place, and system.cfg has configuration settings that conflicts with ai.cfg so we end up not knowing what to change to achieve our aimed behaviour goals for the flight.

As a starting point having a bit of guidance / clarification on this post will be very useful for many developers, then perhaps we can aim to consolidate things inside system.cfg [AUTOPILOT] for future versions, because is where everything should go from a logical point of view.

Repro steps:

Try to set pitch PIDs on AI.cfg or System.cfg which one you should set? try to set roll PIDs on system.cfg as per MSFS 2020 documentation vs msfs 2024 documentation, roll PIDs variables were removed.. and yet we have other on ai.cfg that handles roll pids.. the whole this is cumbersome and confusing.

Many thanks in advance for any help you guys can provide to the developing community on this subject.

Regards,

Raul

2 Likes

Hey @SimbolFSReborn

AP pids are basically split into two parts:

  1. PIDs controlling how the aircraft follows the fllight director commands
  2. PIDs for the actual flight director command

For PIDs 1 : these are controlled from the AI.cfg ,as far as your aircraft are concerned the G3000 autopilot outputs are only pitch / bank commands , so these two PIDs are the important ones. and they control the actual surfaces deflection and how well the aircraft tracks the flight director.

For PIDs 2 : These are part of the G3000/G1000 flight director code and control the flight director in all Vertical and Horizontal modes and outputs to the flight director as pitch/roll command . these control ALT HOLD, VS , FLC , GS , GP , HDG , NAV , LOC etc.
Values for these PIDs and the functions they control are not exposed. I found that I had to monkey patch through the MFD plugins to override the default values / functions.

for example , this resides in the iife of my MFD plugin to enable changing the values of the FLC PID , something like this can also be used to swap the actual class functions as well :

(function patchAPFLCDirector() {
   const APFLCDirector = msfssdk && msfssdk.APFLCDirector;

    const GenericFlcComputer = msfssdk && msfssdk.GenericFlcComputer;

    if (!APFLCDirector || !GenericFlcComputer) {

        console.warn('\[HJET\] APFLCDirector or GenericFlcComputer not found on msfssdk.');

        return;

    }

    if (APFLCDirector._hjetFlcPatched) {

        return;

    }

    APFLCDirector._hjetFlcPatched = true;

    const OriginalCtor = APFLCDirector.prototype.constructor;

    APFLCDirector.prototype.constructor = function (bus, apValues, stateMachine, options) {

        OriginalCtor.call(this, bus, apValues, stateMachine, options);

        if (!options || !options.flcComputer) {

            this.flcComputer = new GenericFlcComputer({

                kP: 1,

                kI: 0,

                kD: 1,      // custom change

                maxOut: 90,

                minOut: -90,

                apDataProvider: apValues.dataProvider

            });

        }

    };

})();
2 Likes

Hi Marwan,

Many thanks, I found out last night the glideslope PID reference by AI.CFG has zero effect on G1000 and G3000, only the “pitch” PID had an effect, so basically only the PITCH PID is being used + ROLL PID.

PITCH Pid is influencing the ILS entirely after massive tests, which is a problem as this PID ideally should be split, now I ended up having to do some compromises to have a good Pitch mode for the AP + ILS GS Following.

Your post confirm my initial request, everything is all over the place and lack of proper documentation for US as developers on this makes it harder to understand what to do to tweak APs properly for different avionics, etc.

Thanks for helping to improve this.. my goal is to work with Asobo via these post to improve the SDK for everybody, let’s hope you contribution helps them realise we need much better ways to explain what to do to 3rd party devs.

Best,
Raul

2 Likes