• 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.

major bug in autopilot

Messages
43
Country
germany
Hi,

I recently added a new control to my sim for the elevator trim (axis).

When I turn on the autopilot in ALT mode, the aircraft will not maintain the set altitude! I see that it happens because the autopilot tries to control the trim axis. This happens in all default planes.

Did someone create a gauge that will disconnect the trim axis while the AP is on? Or how could this be done?
 
The autopilot controls longitudinal flight by adjusting the trim.

If the control you have added also adjusts the trim then it will override the autopilot. This will prevent the autopilot from holding altitude. Disconnecting the autopilot from the trim will not help to hold altitude.

What does your added control do?
 
Last edited:
Disconnecting the autopilot from the trim will not help to hold altitude.

It seems that you basically repeated my post, but misunderstood one point.

My control is a regular joystick axis assigned to the elevator trim through the FSX menu.

I would like to automatically disconnect the manual trim axis so that the autopilot can write to it.
 
The only solution I can think of is to create an FSUIPC application/dll that keeps setting Bit 5 of offset 0x310A when altitude hold is engaged. It could perhaps also be done in Simconnect.
 
MGH,

Basically you set the GROUP PRIORITY to HIGHEST_MASKABLE and don't write any new values.

This chunk of code checks the hydraulic pressure, if it's below 2400PSI it sets the GROUP PRIORITY to HIGHEST_MASKABLE which stops the values of the Group Events being passed to FSX. You can also use this to then input your own values into FSX which I did for the Sea Fury throttle to prevent over-boosting. If the pressure is above 2400PSI the GROUP PRIORITY is set to HIGHEST which means all clients will receive the values, including FSX.

Code:
	execute_calculator_code("(A:ENG HYDRAULIC PRESSURE:1, psi)", &SimConnectData->Hyd1, NULL, NULL);
	execute_calculator_code("(A:ENG HYDRAULIC PRESSURE:2, psi)", &SimConnectData->Hyd2, NULL, NULL);


	if((SimConnectData->Hyd1 + SimConnectData->Hyd2) < 2400)
	{
	hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP_CONTROLS, SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE);
	}
	else
	{
	hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP_CONTROLS, SIMCONNECT_GROUP_PRIORITY_HIGHEST);
	}


This chunk of code is just adding all the required Events to the GROUP_CONTROLS, depending on what you're doing it's worth remembering there are frequently several different events that can all affect a control. E.g. axis_set values for joystick controls, keyboard control increment/decrement and keyboard control small increment/decrement.

Code:
				//Hyd lock code
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AXIS_ELEV_SET, "AXIS_ELEVATOR_SET");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AXIS_AILERON_SET, "AXIS_AILERONS_SET");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AXIS_RUDDER_SET, "AXIS_RUDDER_SET");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_SPOILER_SET, "SPOILERS_SET");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_AXIS_SPOILER_SET, "AXIS_SPOILER_SET");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_SPOILER_TOGGLE, "SPOILERS_TOGGLE");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_TAILHOOK_TOGGLE, "TOGGLE_TAIL_HOOK_HANDLE");
				hr = SimConnect_MapClientEventToSimEvent(hSimConnect, EVENT_WINGFOLD_TOGGLE, "TOGGLE_WING_FOLD");
				
				
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_AXIS_ELEV_SET, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_AXIS_AILERON_SET, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_AXIS_RUDDER_SET, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_AXIS_SPOILER_SET, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_SPOILER_SET, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_SPOILER_TOGGLE, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_TAILHOOK_TOGGLE, TRUE);
				hr = SimConnect_AddClientEventToNotificationGroup(hSimConnect, GROUP_CONTROLS, EVENT_WINGFOLD_TOGGLE, TRUE);
				
				hr = SimConnect_SetNotificationGroupPriority(hSimConnect, GROUP_CONTROLS, SIMCONNECT_GROUP_PRIORITY_HIGHEST);

				hr = SimConnect_SetInputGroupState(hSimConnect, GROUP_CONTROLS, TRUE);
 
FSX autopilot and trim

I think we are overcomplicating things a bit.

When the autopilot is switched on it enters pitch hold. It willl maintain the pitch angle at the moment of selection. This is its reference pitch angle. If you slow down, it will apply nose up trim to hold that reference angle. If you use trim, you can change the reference angle and it will again hold the retrimmed reference angle.

When you turn on altitude hold, the autopilot will use trim to alter pitch so as to maintain level flight, if you slow down it will apply nose up pitch and vice versa. If you really slow down it will maintain altitude until it runs out of nose up trim. If you use trim, the trim setting will change, but as soon as you cease trim inputs the autopilot will take over and put the trim where it should be for level flight.

Roy
 
Roy, the problem under discussion is simply that a new, external hardware control is interfering with the autopilot's operation...

...so a means of "disconnecting" this external control programmatically is being suggested.
 
Given that "My control is a regular joystick axis assigned to the elevator trim through the FSX menu" that control can be be disconneced using FSUIPC.


Code:
short Alt_Hold_Lock;
unsigned short Connection;
unsigned short Bit5 = 16;

// Read altitude hold lock
FSUIPC->Read(0x07D0, 4, &Alt_Hold_Lock);

// Read connection state
FSUIPC->Read(0x310A, 1, &Connection);
FSUIPC->Process();

if (Alt_Hold_Lock)
   {
   // Disconnect trim
   Connection = Connection | Bit5;
   FSUIPC->Write(0x310A, 1, &Connection);
   }
else
   {
   // Connect trim
   Connection = Connection & !Bit5;
   FSUIPC->Write(0x310A, 1, &Connection);
   }   
                           
FSUIPC->Process();

Note that I created my own component which is why the FSUIPC calls have a different, simpler format, but it illustrates the principle.
 
This will not end well... LOL

When you inhibit the trim axis... the autopilot will do what it needs to... and things will appear 'normal'.... until you turn the autopilot off, the trim axis is re-connected and the aircraft suddenly pitches wildly as it reorients itself based on the trim axis value.

In short, assigning trim to an analog axis will always cause problems of one sort or another in FS.
 
Perhaps there is something wrong with his new joystick and he should send it back for replacement. It should not interfere with the autopilot if it is functioning properly (except when the trim button is in use) Sounds to me like a major bug in the joystick

Roy
 
Last edited:
Perhaps there is something wrong with his new joystick and he should send it back for replacement. It should not interfere with the autopilot if it is functioning properly (except when the trim button is in use) Sounds to me like a major bug in the joystick

Roy

You are wrong there. You can try it yourself. It happens with every kind of analogue axis.

@WarpD
I agree with you there, but the option has been added in FSX, so it must be possible.

@Roy
You have perfectly desribed the function of the autopilot. But the problem is that the readings from the analogue trim axis override any adjustments the AP wants to make.

@mgh
It seems that FSUIPC is my best bet then, because I don't know how to program in SimConnect.
 
@WarpD
I agree with you there, but the option has been added in FSX, so it must be possible.

Trust me, it's not 'possible'.

There's one major difference between FS and a real aircraft in this regard. In a real aircraft, as the autopilot changes the trim to control pitch, the physical trim wheel would rotate as well. Since your analog axis has no such capability... it will never, ever 'align' with the autopilot's trim settings.
 
Ti,
It would help me if you gave a fuller explanation of what you are seeing in pitch mode and alt hold mode. It would also help if you said which version of FS you are using because I believe FSX added pitch mode and I only use FSX.

Also there are autopilots that have an alt hold mode that just captures current altitude and others where you can set a desired altitude to hold.

So, if you are in either alt hold and you do not touch the trim, what happens? Then when you make a small adjustment to trim and release the trim what happens? What I see with a test gauge that shows me trim position is that the autopilot will regain the trim setting it had before I touched the button, almost immediately after I cease trim inputs. It will be affected by my trim input and that will affect altitude hold while I input trim, but not after I stop. I see this as normal autopilot operation, not a bug. You really do not need trim inputs in alt hold mode because it happens automatically

You need trim inputs when in pitch hold mode, because the stick is basically frozen and the only way to adjust pitch is with trim.

Ed makes a very good point about what would happen if you disabled trim.

Please give us a fuller description of what is happening and which version of FS you are using

Roy
 
Ti,
What I see with a test gauge that shows me trim position is that the autopilot will regain the trim setting it had before I touched the button, almost immediately after I cease trim inputs.

Everything has been said in this thread. Please note the difference between trim button and trim axis.
 
Now I get it, you have assigned one of the rotating axis controls to trim, took me a while, sorry.

Roy
 
This will not end well... LOL

When you inhibit the trim axis... the autopilot will do what it needs to... and things will appear 'normal'.... until you turn the autopilot off, the trim axis is re-connected and the aircraft suddenly pitches wildly as it reorients itself based on the trim axis value.

In short, assigning trim to an analog axis will always cause problems of one sort or another in FS.

Oh, I can confirm this for sure and certain. There's a huge analog "trim wheel" on my CH Pro Yoke, which frankly is totally useless except for initially "zero calibrating" the yoke's elevator axis.

Were I to try using it for elevator trim, as soon as I shut off the autopilot all hell would break loose... :eek:
 
Trust me, it's not 'possible'.

There's one major difference between FS and a real aircraft in this regard. In a real aircraft, as the autopilot changes the trim to control pitch, the physical trim wheel would rotate as well. Since your analog axis has no such capability... it will never, ever 'align' with the autopilot's trim settings.

Ed's argument is the key. A standard yoke axis would always rest in neutral point, which should equal 0 trim, and input up/down in response to forward/backward movements of the handle. Being the case, IMHO this is incompatible with the trim system of an aircraft, so it should be removed directly through FSX menu.

Tom
 
Back
Top