Autopilot disengaged event, what I am doing wrong?

Hi,
I am writing simconnect app and all things which I need are working except one. I can’t figure out how to get event when autopilot will be disengaged.

I tried:
SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AUTOPILOT_OFF, “AUTOPILOT_OFF”)))

SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP0, EVENT_AUTOPILOT_OFF)))

SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_DEFAULT);

In dispatch:
case SIMCONNECT_RECV_ID_EVENT:
{
SIMCONNECT_RECV_EVENT* evt = (SIMCONNECT_RECV_EVENT*)pData;
switch (evt->uEventID)
{
case EVENT_AUTOPILOT_OFF:

Using Python Simconnect library , It corresponds to an “Toggle event”

like :

sm = SimConnect()

ae = AircraftEvents(sm)
aq = AircraftRequests(sm, _time=10)

### Toggle AutoPilot

EVENT_TO_TRIGGER = ae.find(“AP_MASTER”)
EVENT_TO_TRIGGER()

Works ok
Greetings

Thanks, but I don’t want to use any wrapper. But maybe I can look to sources of this library and check what is going under the hood.

I figured out what is wrong.
First SIMCONNECT_GROUP_PRIORITY_DEFAULT should be SIMCONNECT_GROUP_PRIORITY_HIGHEST.

Second AUTOPILOT_OFF is not working. In documentation is supported but in reality is not. My code with AP_MASTER is working perfectly fine.

I understand.
Yes , have a look at sources ( Eventlist.py file ) for the complete listing…
I have tried with an C# Forms / WPF app (Managed) but could not pass the simple “Reading of Variables” . Including setting values would be the ideal. ( not very able in C# myself…)

So I came across this Python “Wrapper” and it works fine , allthough only from the Python command line , editing values in the source everytime ( like changing course on AP , AP on/off, etc., and of course monitoring altitude,airspeed and the like)

My next try is to bring that Python code into an Windows Forms/WPF app , no luck so far. MS says it can be done with Visual Studio 2019 …

Greetings

BTW Can you check if AUTOPILOT_OFF is not working also via Python wrapper? I guess this event should be handled when AP will be disengaged. I want confirm that this is a FS issue. AP_MASTER is working for me but not AUTOPILOT_OFF. Thanks.

Willingly.
I will tomorrow and report back.
In the mean time, I abandoned Python ( no practicall way of programming a Form … kind of but not eficient)
So I am back to the roots and using Managed + C#

Will check both

Greetings

Works Ok !

Checked both Python Wrapper and C# Win Form

All three are “Toggle Events” ( 1/0 )

AP_MASTER
AUTOPILOT_OFF
AUTOPILOT_ON

Feedback request is “AUTOPILOT MASTER” (AUTOPILOT_MASTER)

Greetings
Francisco

What do you mean by that?

How are you testing AUTOPILOT_OFF? I tried it on C172 by pressing AP button on G1000 and this is not working for me. When I am using AP_MASTER I have events on AP ON and OFF.
Are you seting AUTOPILOT_OFF different than AP_MASTER?

When fired , react as pusbottons

AP_MASTER identical as AP button on G1000
Every push flips the position On to Off - Off to On

AUTOPILOT_OFF
AUTOPILOT_ON
Every push , insists in corresponding position ( inverts if it is the case…)

Set the desired State

You need to check if the Event you fired led to the result you desired ( hence feedback ) So , this one to be added to some Group of requests definitions ( read the state )

Hope I helped
Greetings

I’m using C# and the Autopilot On, Off does work as expected.
such as

TransmitEvent(EventEnum.AUTOPILOT_OFF, 1);

1 Like

What this exactly do? Is this setting AP to some state or is registering event when this state will be achieved? I don’t want set AP. I want to know when pilot will disable AP.

Looks like below code is working for me on all toggle events (like AP_MASTER, AP_PANEL_ALTITUDE_HOLD, BRAKES) but not on any other. So obviously my code is wrong or I don’t understand concept of ON OFF events. Is this possible to be notified when pilot turn something off? AUTOPILOT_OFF, AP_HDG_HOLD_OFF, AP_ALT_HOLD_OFF

SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AUTOPILOT_OFF, “AUTOPILOT_OFF”)))
SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP0, EVENT_AUTOPILOT_OFF)))
SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP0, SIMCONNECT_GROUP_PRIORITY_HIGHEST)))

example … notification when the OnGround state changes

simconnect.RequestDataOnSimObject(DATA_REQUESTS.OnGround, DEFINITIONS.OnGround, SimConnect.SIMCONNECT_OBJECT_ID_USER, SIMCONNECT_PERIOD.SECOND, SIMCONNECT_DATA_REQUEST_FLAG.CHANGED, 0, 0, 0);

Do you know how to turn off the ILS Approach Mode on the A320 (and Boeing?)

For me iti is only abbout the C172 with G1000 for now.

Following the same procedure as autopilot master On/Off ( toggle ) and Autopilot On and Autopilot Off ( Events to fire ), I would suggest trying with :

AP_LOC_HOLD_ON / AP_LOC_HOLD_OFF : Localizer

AP_APR_HOLD_ON / AP_APR_HOLD_OFF : Localizer + Glide slope

I have yet to program these two on my Panel but am confidennt they will do fine.

For feedbback , or request or reading (the same meaning ) I would use

AUTOPILOT GLIDESLOPE HOLD / AUTOPILOT APPROACH HOLD ( toggle ( bool ))

I dont really think there could be a specific command ( event ) for each type of Aircraft in the Simconnect specifications, not that I have encountered such in my readings .
Int his kind of things , the concept is for all the same , if youconsider that ILS is an international Standard…should be modelled as such too.

Give them a try

Greetings
Franncisco

thanks! yes, when both are True the state = “Approach Mode”

you are correct , I actually had Approach On / Off working but it doesn’t change the button so I thought it wasn’t working. But I can see on the PFD that the mode is changing. The button state must be handled separately … thanks again …

Hello all,
The situation is as follows. I am on a long flight and am not always at the PC. And would like to be informed when the autopilot flies out. e.g. when there is a weather update and the Airbus goes into over speed, the autopilot flies out. Here I would like to be informed then. A program for this is already created. The only problem is that I don’t know how to query the autopilot if it is on or off. The variable Autopilot_Master does not work in Fenix or PMDG.
Can someone help me here?
Thanks
Superflo5c

I have a program written here with me that calls me when the sim stands (the coordinates no longer move) I would now like this program what is based on the simWatcher also calls me when the autopilot goes off.

gladly also write in German.