1
0
Fork 0

Control: Add reworked Generic Autopilot

Rework of the generic autopilot

https://sourceforge.net/p/flightgear/fgdata/merge-requests/284/

Control: Improve FPA engagement smoothness

Control: Generic autopilot logical improvement
This commit is contained in:
Josh Davidson 2022-02-08 13:35:29 -05:00 committed by Stuart Buchanan
parent 7cbc34b355
commit 25c46a69bc
4 changed files with 1438 additions and 671 deletions

View file

@ -1,4 +1,5 @@
<?xml version="1.0"?>
<!-- No longer required by generic-autopilot.xml, left in for compatibility reasons -->
<!--
These are the autopilot helpers, currently implemented
in the c++ code of xmlauto.cxx.

File diff suppressed because it is too large Load diff

View file

@ -2,14 +2,16 @@
<PropertyList>
<!-- heading -->
<!-- Roll -->
<label>
<width>60</width>
<height>10</height>
<box>true</box>
<format>ROLL</format>
<halign>left</halign>
<format>ROLL %3.1f</format>
<halign>center</halign>
<input>
<property>/autopilot/settings/target-roll-deg</property>
</input>
<condition>
<equals>
<property>/autopilot/locks/heading</property>
@ -18,13 +20,12 @@
</condition>
</label>
<label>
<width>60</width>
<height>10</height>
<box>true</box>
<format>HDG %03d</format>
<halign>left</halign>
<halign>center</halign>
<input>
<property>/autopilot/settings/heading-bug-deg</property>
</input>
@ -41,7 +42,7 @@
<height>10</height>
<box>true</box>
<format>HDG %03d</format>
<halign>left</halign>
<halign>center</halign>
<input>
<property>/autopilot/settings/true-heading-deg</property>
</input>
@ -53,54 +54,33 @@
</condition>
</label>
<!-- altitude -->
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<box>true</box>
<format>ALT %04d</format>
<halign>left</halign>
<input>
<property>/autopilot/settings/target-altitude-ft</property>
</input>
<format>NAV1 CDI</format>
<halign>center</halign>
<condition>
<equals>
<property>/autopilot/locks/altitude</property>
<value>altitude-hold</value>
<property>/autopilot/locks/heading</property>
<value>nav1-hold</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<box>true</box>
<format>PTCH</format>
<halign>left</halign>
<condition>
<equals>
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</equals>
</condition>
</label>
<!-- Pitch -->
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<box>true</box>
<format>V/S %d</format>
<halign>left</halign>
<halign>center</halign>
<input>
<property>/autopilot/settings/vertical-speed-fpm</property>
</input>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>vertical-speed-hold</value>
@ -112,13 +92,71 @@
<x>60</x>
<width>60</width>
<height>10</height>
<format>AGL %04d</format>
<halign>left</halign>
<box>true</box>
<format>PITCH %3.1f</format>
<halign>center</halign>
<input>
<property>/autopilot/settings/target-pitch-deg</property>
</input>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<box>true</box>
<format>FPA %3.1f</format>
<halign>center</halign>
<input>
<property>/autopilot/settings/target-fpa-deg</property>
</input>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>fpa-hold</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<box>true</box>
<format>ALT %03d</format>
<halign>center</halign>
<input>
<property>/autopilot/settings/target-altitude-ft</property>
</input>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>altitude-hold</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<format>AGL %03d</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-agl-ft</property>
</input>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>agl-hold</value>
@ -126,13 +164,65 @@
</condition>
</label>
<!-- speed -->
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<format>NAV1 G/S</format>
<halign>center</halign>
<box>true</box>
<condition>
<not><property>/autopilot/internal/speed-on-pitch-active</property></not>
<equals>
<property>/autopilot/locks/altitude</property>
<value>gs1-hold</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<format>IAS %3d</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-speed-kt</property>
</input>
<condition>
<equals>
<property>/autopilot/locks/speed</property>
<value>speed-with-pitch-trim</value>
</equals>
</condition>
</label>
<label>
<x>60</x>
<width>60</width>
<height>10</height>
<format>MACH %4.3f</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-speed-mach</property>
</input>
<condition>
<equals>
<property>/autopilot/locks/speed</property>
<value>mach-with-pitch-trim</value>
</equals>
</condition>
</label>
<!-- Speed -->
<label>
<x>120</x>
<width>60</width>
<height>10</height>
<format>IAS %3dkt</format>
<halign>left</halign>
<format>IAS %3d</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-speed-kt</property>
@ -149,8 +239,8 @@
<x>120</x>
<width>60</width>
<height>10</height>
<format>MACH %1.2f</format>
<halign>left</halign>
<format>MACH %4.3f</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-speed-mach</property>
@ -167,17 +257,20 @@
<x>120</x>
<width>60</width>
<height>10</height>
<format>PITCH %3dkt</format>
<halign>left</halign>
<format>UNLOCKED</format>
<halign>center</halign>
<box>true</box>
<input>
<property>/autopilot/settings/target-speed-mach</property>
</input>
<condition>
<or>
<equals>
<property>/autopilot/locks/speed</property>
<value>speed-with-pitch-trim</value>
</equals>
<equals>
<property>/autopilot/locks/speed</property>
<value>mach-with-pitch-trim</value>
</equals>
</or>
</condition>
</label>

View file

@ -6,13 +6,14 @@
/autopilot/locks/altitude
/autopilot/locks/heading
/autopilot/locks/speed
/autopilot/locks/passive-mode
/autopilot/settings/heading-bug-deg
/autopilot/settings/target-roll-deg
/autopilot/settings/target-agl-ft
/autopilot/settings/target-altitude-ft
/autopilot/settings/target-aoa-deg
/autopilot/settings/target-fpa-deg
/autopilot/settings/target-pitch-deg
/autopilot/settings/target-speed-kt
/autopilot/settings/target-speed-mach
/autopilot/settings/true-heading-deg
/autopilot/settings/vertical-speed-fpm
-->
@ -117,9 +118,9 @@
## create and initialize input field properties if necessary
#
var apset = props.globals.getNode("/autopilot/settings", 1);
foreach (var p; ["heading-bug-deg", "true-heading-deg", "vertical-speed-fpm",
"target-pitch-deg", "target-aoa-deg", "target-altitude-ft",
"target-agl-ft", "target-speed-kt"]) {
foreach (var p; ["heading-bug-deg", "target-roll-deg", "true-heading-deg", "vertical-speed-fpm",
"target-pitch-deg", "target-fpa-deg", "target-altitude-ft",
"target-agl-ft", "target-speed-kt", "target-speed-mach"]) {
if ((var n = apset.getNode(p)) == nil or n.getType() == "NONE") {
apset.getNode(p, 1).setDoubleValue(0);
@ -136,7 +137,7 @@
var hdg = Group.new("heading", ["dg-heading-hold", "wing-leveler", "true-heading-hold", "nav1-hold"]);
var vel = Group.new("speed", ["speed-with-throttle", "speed-with-pitch-trim"]);
var alt = Group.new("altitude", ["altitude-hold", "vertical-speed-hold", "pitch-hold",
"aoa-hold", "agl-hold", "gs1-hold"]);
"fpa-hold", "agl-hold", "gs1-hold"]);
</open>
<close>
hdg.del();
@ -421,7 +422,7 @@
</binding>
</input>
<text>
<label>AoA Hold</label>
<label>FPA Hold</label>
<halign>right</halign>
<row>2</row>
<col>0</col>
@ -429,17 +430,17 @@
<radio>
<row>2</row>
<col>1</col>
<property>/sim/gui/dialogs/autopilot/aoa-hold</property>
<property>/sim/gui/dialogs/autopilot/fpa-hold</property>
<live>true</live>
<binding>
<command>nasal</command>
<script>alt.set("aoa-hold")</script>
<script>alt.set("fpa-hold")</script>
</binding>
</radio>
<input>
<row>2</row>
<col>2</col>
<property>/autopilot/settings/target-aoa-deg</property>
<property>/autopilot/settings/target-fpa-deg</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
@ -518,23 +519,6 @@
</group>
<!-- End of Pitch/Altitude VBox -->
</group>
<hrule/>
<group>
<!-- Passive Mode Toggle -->
<layout>hbox</layout>
<checkbox>
<label>FlightDirector Mode</label>
<halign>center</halign>
<property>/autopilot/locks/passive-mode</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
<binding>
<command>property-toggle</command>
</binding>
</checkbox>
</group>
<hrule/>