KAP140 not following heading

Version: 1.5.27.0

Frequency: Consistently

Severity: Blocker

Marketplace package name: sws-aircraft-airvan

Context: Community & developer mode

Bug description: When engaging HDG HOLD, the autopilot remains in attitude hold and will not follow the selected heading. NAV mode works OK.

If I start a flight with the default C172SP (analogue), the 172 follows heading just fine. I then switch to the GA-8 using the Aircraft Selector and the plane is able to follow the heading normally.

KAP140_State is 2 and AP_KAP140_INSTALLED is 1, which are in line with the C172, so the KAP140 initialises the Lvars correctly.

Panel.cfg entries

[VCockpit01]
size_mm				= 320,234
pixel_size			= 320,234
texture				= $AS530
htmlgauge00			= NavSystems/WTGNSv2/WT530/WT530.html,0,0,320,234

[VCockpit02]
size_mm				= 350,190
pixel_size			= 350,190
texture				= $AS430
htmlgauge00			= NavSystems/WTGNSv2/WT430/WT430.html, 0, 0, 350, 190

[VCockpit05]
size_mm				= 512,105
pixel_size			= 512,105
texture				= $SWS_KFC225_Screen
htmlgauge00			= Generic/Autopilots/KAP140/KAP140.html,	0,0,512,105

Panel.xml

<Instrument>
		<Name>AS530</Name>
		<NavIndex>1</NavIndex>
		<ComIndex>1</ComIndex>
		<SupportAPFlightDirector>False</SupportAPFlightDirector>
		<MaxAPBankAngle>30</MaxAPBankAngle>
		<Electric>
		  <Simvar name="CIRCUIT ON:13" unit="Boolean"/>
		</Electric>
	</Instrument> 
	
	<Instrument>
		<Name>AS430</Name>
		<NavIndex>2</NavIndex>
		<ComIndex>2</ComIndex>
		<SupportAPFlightDirector>False</SupportAPFlightDirector>
		<MaxAPBankAngle>30</MaxAPBankAngle>
		<Electric>
		  <Simvar name="CIRCUIT ON:40" unit="Boolean"/>
		</Electric>
	</Instrument>

Interior.xml

<UseTemplate Name="ASOBO_AS530_Template">
					<!--<EXTERNAL_AUTOPILOT_BEHAVIOR_CONTROL/>-->
					<POTENTIOMETER/>
					<NAV_INDEX>1</NAV_INDEX>
					<COM_INDEX>1</COM_INDEX>
					<CIRCUIT_ID>#CIRCUIT_ID_GPS1#</CIRCUIT_ID>
					<FAILURE>(A:CIRCUIT ON:#CIRCUIT_ID_GPS1#, Bool)</FAILURE>
					<EMISSIVE_DEFAULT_VALUE>(A:LIGHT PANEL POWER SETTING:2, Percent over 100) 1 #MIN_BRIGHTNESS# - * #MIN_BRIGHTNESS# (A:CIRCUIT ON:#CIRCUIT_ID_GPS1#, Bool) * +</EMISSIVE_DEFAULT_VALUE>
					<DIMMING_FACTOR>(A:CIRCUIT POWER SETTING:#CIRCUIT_ID_GPS1#, Percent over 100)</DIMMING_FACTOR>
					<ANIM_NEVER_FAILS/>
				</UseTemplate>
				<UseTemplate Name="ASOBO_AS430_Template">
					<!--<EXTERNAL_AUTOPILOT_BEHAVIOR_CONTROL/>-->
					<NAV_INDEX>2</NAV_INDEX>
					<COM_INDEX>2</COM_INDEX>
					<POTENTIOMETER/>
					<CIRCUIT_ID>#CIRCUIT_ID_GPS2#</CIRCUIT_ID>
					<FAILURE>(A:CIRCUIT ON:#CIRCUIT_ID_GPS2#, Bool)</FAILURE>
					<ANIM_NEVER_FAILS/>
					<EMISSIVE_DEFAULT_VALUE>(A:LIGHT PANEL POWER SETTING:2, Percent over 100) 1 #MIN_BRIGHTNESS# - * #MIN_BRIGHTNESS# (A:CIRCUIT ON:#CIRCUIT_ID_GPS2#, Bool) * +</EMISSIVE_DEFAULT_VALUE>
					<DIMMING_FACTOR>(A:CIRCUIT POWER SETTING:#CIRCUIT_ID_GPS2#, Percent over 100)</DIMMING_FACTOR>
				</UseTemplate>

The Autopilot uses the ASOBO_KAP140_Template and adds a couple of buttons that are needed (YawDamper, FlightDirector, AltitudeArm)

post the [Autopilot] section in system.cfg

I recently had a problem with an Autopilot miss behaving, and it was all related somehow to the system.cfg file, I still don’t know what btw! I recreated the entries and boom, problem went away.

So post that in order to allow Asobo to help better.

R.

Here it is:

[AUTOPILOT]
autopilot_available =1
flight_director_available =0
default_vertical_speed =700
autothrottle_available =0
pitch_takeoff_ga =7
max_pitch =10
max_pitch_acceleration =1
max_pitch_velocity_lo_alt =2
max_pitch_velocity_hi_alt =1.5
max_pitch_velocity_lo_alt_breakpoint =20000
max_pitch_velocity_hi_alt_breakpoint =28000
max_bank = 25.0
max_bank_acceleration = 5
max_bank_velocity = 10
default_bank_mode=3 

max_throttle_rate =0.1
yaw_damper_gain = 1
altimeter_indicator = 1
pitch_use_trim = 1 ;Note: trim is used by AP for small adjustments. The elevator is used for bigger ones.

max_pitch_velocity_lo_ang=1
max_pitch_velocity_hi_ang=5
nav_proportional_control_ex1=10
nav_integrator_control_ex1=1
nav_derivative_control_ex1=5
nav_integrator_boundary_ex1=5
nav_derivative_boundary_ex1=10
gs_proportional_control=9.52
gs_integrator_control=0.26
gs_derivative_control=0
gs_integrator_boundary=0.7
gs_derivative_boundary=0
default_pitch_mode=1
autothrottle_arming_required=0
autothrottle_takeoff_ga=0
autothrottle_max_rpm=0
use_no_default_bank=0
use_no_default_pitch=0
min_feet_ra_for_athr=-1000
min_feet_ra_for_ap=-1000
min_flight_time_for_ap=0
auto_max_bank=0
auto_max_bank_min_alt=0
auto_max_bank_min_alt_angle=0
hdg_ref_var=1
auto_max_bank_table=0:15,250:15,250:25
head_hold_pid= 0,0,0,0,0,0,0
airspeed_hold_pid= 0,0,0,0,0,0,0
FBWPitchTrimSpeedScalar=1
pitch_proportional_control=1
pitch_integrator_control=0.1
pitch_derivative_control=3
pitch_integrator_boundary=1
pitch_derivative_boundary=100
pitch_pid_reset_mode=2
roll_proportional_control=1
roll_integrator_control=0.001
roll_derivative_control=1
roll_integrator_boundary=8
roll_derivative_boundary=100
roll_pid_reset_mode=2
hdg_proportional_control=5
hdg_integrator_control=0.01
hdg_derivative_control=0.5
hdg_integrator_boundary=2
hdg_derivative_boundary=360
vs_proportional_control=0.5
vs_integrator_control=0.05
vs_derivative_control=1
vs_integrator_boundary=300
vs_derivative_boundary=1000
nav_yaw_proportional_control_ex1=0.5
nav_yaw_integrator_control_ex1=0.1
nav_yaw_derivative_control_ex1=0.2
nav_yaw_integrator_boundary_ex1=1
nav_yaw_derivative_boundary_ex1=360
flc_proportional_control=20
flc_integrator_control=1
flc_derivative_control=50
flc_integrator_boundary=100
flc_derivative_boundary=100
min_altitude_ref=-99900
max_altitude_ref=99900
max_vertical_speed_ref=9900
min_vertical_speed_ref=-9900
max_IAS_ref=990
min_IAS_ref=0
max_Mach_ref=3
min_Mach_ref=0
altitude_english_slow_increment=100
altitude_english_fast_increment=200
altitude_english_fastest_increment=1000
altitude_metric_slow_increment=50
altitude_metric_fast_increment=100
altitude_metric_fastest_increment=1000
metric_VS_increment=50
english_VS_increment=100
IAS_slow_increment=1
IAS_fast_increment=5
IAS_fastest_increment=10
mach_increment=0.01
flc_min_pitch_low_alt=0
flc_min_low_alt_limit=0
alt_mode_slot_index=0
min_feet_for_athr=-1000
min_feet_for_ap=-1000
auto_throttle_hold_vs=1
auto_max_bank_override=0
auto_max_bank_velocity_table=0:3
FBWHighSpeedRollSpeedScalar=1
yaw_damper_max_speed=0.5
yaw_damper_rudder_gain=0
1 Like

Hello @SWS-AlexVletsas

I am not able to replicate the issue with version 1.0.7.0 of your package
When heading mode is engaged, AP follows the selected heading on the heading indicator

Is this something that used to work but is no longer working in your latest development version?

Regards,
Sylvain

Hello @FlyingRaccoon

I put a native 2024 version up on the Marketplace and will send a development build via PM if it helps.

Heading Hold toggles on and off normally, but the autopilot doesn’t turn. NAV and other modes work.

If I start in the default 172 with KAP140 and then switch using the aircraft selector, the Airvan’s HDG mode works.

Hello @SWS-AlexVletsas

This does not seem to be a 100% repro.
Sometimes, it does work.

It seems to be an issue with multiple gauges handling the autopilot.
In one of the occurrences I traced, the AS430 was the one receiving the heading hold key event, but it was the AS530 writing the bank hold simvar based on the incorrect mode.

You probably want to add <DisableAutopilot>True</DisableAutopilot> in the AS430 section of your panel.xml.

You can trace who’s receiving and processing the AP key events through the Coherent Debugger.
You seem to be supporting instrument hot swap, so there a lot of gauges to track, and be aware that V2 of Working Title gauges are not particularly designed to support this, so some side effects can be expected.

Another way to debug this can be to disable everything but KAP140 & AS530, and add gauge one at a time until the issue reappears.

Regards,
Sylvain

2 Likes

@FlyingRaccoon the issue has been identified as the panel.xml file not being initialised correctly. This caused both the GNS530 and GNS430 to run with an index of 1 and cancelling each other’s autopilot commands.

The solution was to move panel.xml from our Function_Interior to the Common folder.

I should ask though, shouldn’t the panel.xml file be merged, just like the panel.cfg file? Or is it that, because “Function_Interior” isn’t directly called by our presets, the panel.xml file gets ignored?

Hello @SWS-AlexVletsas

Ok, this is because of one of the merge rule: Modular SimObject Merging

  • A version of the file must exist in at least one of the Common or Preset or Attachment folders for a merge to occur. For all CFG files with no file present in the Common folder, an “empty” file will be generated, and a merge will always occur between the rest of the CFG files present in the Preset and Attachment folders. For checklist, panel, and sound XML files, a copy of the file is required in the Presets folder, even if this is an “empty” file with just a top level element, which must also have the AutoMerge attribute, for example:
<PlaneHTMLConfig AutoMerge="1">
</PlaneHTMLConfig>

There is no panel.xml in your preset folder, so no xml to merge to.
I understand how tricky this can be to track. We will have a look at what kind of debug or edition tool we can have to help diagnose merging issues.

Regards,
Sylvain

2 Likes