Simconnect variable to set AP heading

Can anyone point to the documentation for AP related variables that I can SET? I see documentation on a whole host of variables starting with AUTOPILOT which are mostly not settable. I have been able to set a few using variables starting with AP for airspeed (AP_SPD_VAR_SET) and altitude (AP_ALT_VAR_SET_ENGLISH) but have not been able to find documentation on heading (AP_HDG_VAR_SET doesn’t work).

I’m using python/SimConnect to interface a simple set of controls to set the A320 heading, altitude and speed.

In a simulator, it would not be sensible to make things like “heading” writable, because “heading” is a result from simulator input, like aeleron and rudder. The result of “heading” is displacement of the aircraft. If you want to change heading, you could change aeleron, take a short idle, then inspect the new heading and correct accordingly… until the aircraft is on course. In RL, an autopilot works like this.

Maybe there’s another option for you. The lowest level, which is aircraft position and orientation CAN be manipulated. But in that case you’d have to provide a real movement path ! There’s an addin named FlightRecorder that allows playback. This playback completely controls the aircraft and makes use of “hardwired” airplane positioning, bank, pitch and yaw angle. It will bypass the simulator completely, but you are on your own… Have a look at it, this is a very well structured little program, it shows a lot of other writable variables as well, so it could answer some of your questions…

They are asking for the heading select value for the AP mode. Not the current heading of the aircraft.
I know that it’s writable, but I have to look up which variable that is.

2 Likes

Try this one:

AUTOPILOT_HEADING_LOCK_DIR

Should be setttable.

Aha ok ! looked over that AP abbreviation (again) :smirk_cat:

Tried that - but didn’t work.

I stumbled upon this that worked:
HEADING_BUG_SET

Thanks to all who replied - got the prototype running

4 Likes

The documentation in the SDK is a mess. “SimConnect_MapClientEventToSimEvent()” is not in the “Contents” tab but can be found using the “Search” tab. Also, the list of event names is under the heading “Legacy Event IDs”, without explaining why they are considered “legacy” since they do appear to work.

If you want a list that is a bit easier to read, try the Prepar3D documentation. The event list is under “Software Development Kit (SDK)” => “References” => “Variables” => “Event IDs”.

PS
Cool prototype BTW!

Cheers,
Bert

Legacy is the wording for features or data that is kept in software to keep supporting older interfaces etc. for backwards compatibility.

It usually means that it’s no longer extended with new features/data.
For anyone doing new development it means that you rather should use a new API/IDs instead to have a future development path with new stuff added along the way. It’s simply more future-proof.
At the same time it might mean that software developed with the new API will not work with other/older sims since they mainly serve the legacy API only.

The simvar AUTOPILOT HEADING LOCK DIR (no underscores) should be settable as of SU4, that was an update I made.

It sounds like you found a key event that works, but I’m curious why that wouldn’t have worked for you.

-Matt | Working Title

Fine, but can you point me to the non-legacy list then? The SDK documentation I have only contains a legacy list. The explanation of the SimConnect_TransmitClientEvent() and SimConnect_MapClientEventToSimEvent() calls actually only refer to this list, without marking either function as legacy.

The text above the list actually does state “The EventIds listed here are purely for reference and legacy support,” so if you insist on language lawyering, one could read this as meaning that some are for reference, while others are for legacy support. :wink:

My gripe is that the list appears marked as legacy, but without any explanation, and surrounding documentation does refer to the list without warning you that it is legacy.

I always use this list: Event IDs | Microsoft Docs

These events can be used. In python I have to leave out the KEY_

Yes, leaving out “KEY_” is necessary to get the SimConnect name. Note that this document belongs to “ESP”, which is the base of the FSX and Prepar3D product ranges. For MSFS 2020 this is not a definite list.

Yep, agree, but it was the best I could find. Always open for better suggestions! :wink:

Dear all,

I once stumbled over the exact same question (and am still looking for a general answer myself ;)). May I suggest to continue the discussion - if there is ongoing interest about this topic, that is - in the following thread (in order not to “hijack” this thread about setting the AP - which to my understanding has already been answered, too):

Case in point: while I figured out a way to enable/disable lights via simulation variables (instead of events) there are still plenty of events which do not have an equivalent (writeable) simulation variable. And then there is functionality like “freeze altitude” etc. for which no simulation variable exists either.

And it is not even clear what the way going forward is supposed to be: provide more and more writeable simulation variables and drop events alttogether? Or replace events with something new?

Anyway, that’s the topic of the linked thread :wink:

2 Likes