1
0
Fork 0

FG1000: FLC, NAV GPS Autopilot modes

This commit is contained in:
Stuart Buchanan 2019-02-17 21:35:32 +00:00
parent c91b7e25f8
commit 8cb8121231
8 changed files with 650 additions and 252 deletions

View file

@ -57,4 +57,15 @@ to Flight Director mode, by simply setting the passive-mode flag.
</condition>
</transition>
<!-- Changing to GA mode automatically disables the autopilot -->
<transition>
<name>ON-OFF</name>
<source>ON</source>
<target>OFF</target>
<exclude-target>false</exclude-target>
<condition>
<equals><property>/autopilot/AP-mode-button</property><value>GA</value></equals>
</condition>
</transition>
</PropertyList>

View file

@ -156,6 +156,155 @@
</enter>
</state>
<!-- Common state for NAV from which the NAV source is used to transition to GPS, NAV1 or NAV2 autopilots -->
<state>
<name>NAV-SRC</name>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/lateral-mode-button</property>
<value></value>
</enter>
</state>
<transition>
<name>NAV-GPS</name>
<source>NAV-SRC</source>
<target>GPS-ARM</target>
<condition>
<equals>
<property>/autopilot/settings/nav-mode-source</property>
<value>GPS</value>
</equals>
</condition>
</transition>
<transition>
<name>NAV-LOC</name>
<source>NAV-SRC</source>
<target>LOC-ARM</target>
<condition>
<or>
<equals>
<property>/autopilot/settings/nav-mode-source</property>
<value>NAV1</value>
</equals>
<equals>
<property>/autopilot/settings/nav-mode-source</property>
<value>NAV2</value>
</equals>
</or>
</condition>
</transition>
<state>
<name>GPS-ARM</name>
<!-- GPS isn't referenced directly. Instead we slave it to Nav1 and use the Nav1 autopilot -->
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value>GPS</value>
</enter>
</state>
<transition>
<name>GPS-ARM - GPS</name>
<source>GPS-ARM</source>
<target>GPS</target>
<condition>
<and>
<less-than>
<property>/instrumentation/gps/wp/wp[1]/course-error-nm</property>
<value>0.5</value>
</less-than>
<greater-than>
<property>/instrumentation/gps/wp/wp[1]/course-error-nm</property>
<value>-0.5</value>
</greater-than>
</and>
</condition>
</transition>
<state>
<name>LOC-ARM</name>
<enter>
<command>property-assign</command>
<property>/instrumentation/nav[0]/slaved-to-gps</property>
<value>0</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value>LOC</value>
</enter>
</state>
<state>
<name>VOR-ARM</name>
<enter>
<command>property-assign</command>
<property>/instrumentation/nav[0]/slaved-to-gps</property>
<value>0</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value>VOR</value>
</enter>
</state>
<state>
<name>GPS</name>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode</property>
<value>GPS</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/instrumentation/nav[0]/slaved-to-gps</property>
<value>1</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/heading</property>
<value>nav-hold</value>
</enter>
</state>
<state>
<name>LOC</name>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode</property>
<value>LOC</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value></value>
</enter>
</state>
<state>
<name>VOR</name>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode</property>
<value>VOR</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/lateral-mode-armed</property>
<value></value>
</enter>
</state>
<!-- From the OFF state, pressing any of FD, AP, CWS, NAV, BC, APR, changes to ROL mode -->
<transition>
<name>OFF-ROL</name>
@ -265,4 +414,32 @@
</condition>
</transition>
<!-- From (just about) any state, pressing NAV goes to NAV mode-->
<transition>
<name>To NAV</name>
<target>NAV-SRC</target>
<exclude-target>true</exclude-target>
<condition>
<and>
<equals><property>/autopilot/lateral-mode-button</property><value>NAV</value></equals>
<not><equals><property>/autopilot/locks/heading</property><value>nav-hold</value></equals></not>
</and>
</condition>
</transition>
<transition>
<name>From NAV</name>
<source>GPS-ARM</source>
<source>VOR-ARM</source>
<source>LOC-ARM</source>
<source>GPS</source>
<source>VOR</source>
<source>LOC</source>
<target>ROL</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/lateral-mode-button</property><value>NAV</value></equals>
</condition>
</transition>
</PropertyList>

View file

@ -56,6 +56,11 @@
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
@ -87,6 +92,11 @@
<property>/autopilot/locks/altitude</property>
<value>pitch-hold</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
@ -126,6 +136,11 @@
<property>/autopilot/locks/altitude</property>
<value>vertical-speed-hold</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
@ -201,6 +216,11 @@
<property>/autopilot/locks/altitude</property>
<value>altitude-hold2</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
@ -215,6 +235,7 @@
<source>PIT</source>
<source>GA</source>
<source>VS</source>
<source>FLC</source>
<target>ALTS-ARM</target>
<!-- Transitions must have a condition element. So set it to True -->
<condition>
@ -267,6 +288,11 @@
<property>/autopilot/locks/altitude</property>
<value>altitude-hold2</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value></value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
@ -285,6 +311,46 @@
<state>
<name>FLC</name>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode</property>
<value>FLC</value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/annunciator/vertical-mode-armed</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/settings/target-speed-kt</property>
<property n="1">/autopilot/internal/filtered-airspeed</property>
</enter>
<enter>
<command>nasal</command>
<script>
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%i kt", getprop("/autopilot/settings/target-speed-kt"))
);
</script>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/altitude</property>
<value></value>
</enter>
<enter>
<command>property-assign</command>
<property>/autopilot/locks/speed</property>
<value>speed-with-pitch-trim</value>
</enter>
<enter>
<!-- Reset button to avoid triggering next transition immediately -->
<command>property-assign</command>
<property>/autopilot/vertical-mode-button</property>
<value></value>
</enter>
</state>
<!-- From the OFF state, pressing any of FD, AP, CWS, NAV, BC, APR, HDG changes to PIT mode -->
@ -306,25 +372,6 @@
</condition>
</transition>
<!-- From most vertical modes, pressing the mode key again returns to PIT mode -->
<transition>
<name>VS-PIT</name>
<source>VS</source>
<target>PIT</target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
</condition>
</transition>
<transition>
<name>GA-PIT</name>
<source>GA</source>
<target>PIT</target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
</condition>
</transition>
<!-- AP/FD logic is somewhat complex:
1) Pressing AP toggles the autopilot on/off
Handled by a separate FSM. We could use a series of transitions
@ -351,13 +398,13 @@
<target>VS</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<not><equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals></not>
</and>
</condition>
</transition>
<!-- Transitions to switch off various AP modes, which return to PIT mode -->
<!-- From any state, pressing GA goes to GA mode -->
<transition>
<name>GA</name>
@ -386,14 +433,34 @@
</binding>
</transition>
<!-- From any state pressing FLC changes to FLC mode, if not already enabled -->
<transition>
<name>FLC-ON</name>
<target>FLC</target>
<exclude-target>true</exclude-target>
<condition>
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
<not><equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals></not>
</and>
</condition>
</transition>
<!-- Transitions to switch off various AP modes, which return to PIT mode. This is complicated as in many cases they may be in ALTS-ARM -->
<!-- From VS state pressing VS changes back to to PIT mode -->
<transition>
<name>VS-OFF</name>
<source>VS</source>
<source>ALTS-ARM</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>VS</value></equals>
<equals><property>/autopilot/locks/altitude</property><value>vertical-speed-hold</value></equals>
</and>
</condition>
</transition>
@ -408,7 +475,7 @@
</condition>
</transition>
<!-- From VNV state pressing ALT changes back to to PIT mode -->
<!-- From VNV state pressing VNV changes back to to PIT mode -->
<transition>
<name>VNV-OFF</name>
<source>VNV</source>
@ -430,14 +497,28 @@
</condition>
</transition>
<!-- From BC state pressing BC changes back to to PIT mode -->
<!-- From FLC state pressing FLC changes back to to PIT mode. Note that we could be in ALTS-ARM mode as well, so check the AP setting -->
<transition>
<name>FLC-OFF</name>
<source>FLC</source>
<source>ALTS-ARM</source>
<target>PIT</target>
<exclude-target>true</exclude-target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
<and>
<equals><property>/autopilot/vertical-mode-button</property><value>FLC</value></equals>
<equals><property>/autopilot/locks/speed</property><value>speed-with-pitch-trim</value></equals>
</and>
</condition>
</transition>
<!-- From GA state, pressing GA returns to PIT mode -->
<transition>
<name>GA-OFF</name>
<source>GA</source>
<target>PIT</target>
<condition>
<equals><property>/autopilot/vertical-mode-button</property><value>GA</value></equals>
</condition>
</transition>

View file

@ -88,6 +88,44 @@
<gain>1.0</gain>
</filter>
<filter>
<name>nav2 heading error computer/normalizer</name>
<debug>false</debug>
<type>gain</type>
<input>
<property>/instrumentation/nav[1]/radials/target-auto-hdg-deg</property>
<offset>
<property>/orientation/heading-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/autopilot/internal/nav2-heading-error-deg</output>
<period>
<min>-180</min>
<max>180</max>
</period>
<gain>1.0</gain>
</filter>
<filter>
<name>nav2 selected course error computer/normalizer</name>
<debug>false</debug>
<type>gain</type>
<input>
<property>/instrumentation/nav[1]/radials/selected-deg</property>
<offset>
<property>/orientation/heading-magnetic-deg</property>
<scale>-1.0</scale>
</offset>
</input>
<output>/autopilot/internal/nav2-course-error</output>
<period>
<min>-180</min>
<max>180</max>
</period>
<gain>1.0</gain>
</filter>
<filter>
<name>vertical speed fpm computer</name>
<debug>false</debug>
@ -169,6 +207,19 @@
<max>22.0</max>
</filter>
<filter>
<name>limited-airspeed</name>
<debug>false</debug>
<type>gain</type>
<input>
<property>/instrumentation/airspeed-indicator/indicated-speed-kt</property>
</input>
<gain>1.0</gain>
<output>/autopilot/internal/filtered-airspeed</output>
<min>80.0</min>
<max>140.0</max>
</filter>
<filter>
<name>ALTS-delta</name>
<debug>false</debug>
@ -234,7 +285,7 @@
</equals>
<equals>
<property>/autopilot/locks/heading</property>
<value>nav1-hold</value>
<value>nav-hold</value>
</equals>
</or>
<equals>
@ -343,11 +394,28 @@
<!-- Stage #1 sets target roll based on diff between current heading -->
<!-- and target heading. -->
<pid-controller>
<name>Nav1 Hold Stage 1</name>
<name>Nav1/GPS Hold Stage 1</name>
<debug>false</debug>
<enable>
<prop>/autopilot/locks/heading</prop>
<value>nav1-hold</value>
<condition>
<and>
<equals>
<property>/autopilot/locks/heading</property>
<value>nav-hold</value>
</equals>
<or>
<equals>
<property>/autopilot/settings/nav-mode-source</property>
<value>NAV1</value>
</equals>
<equals>
<!-- GPS is also slaved to NAV1 -->
<property>/autopilot/settings/nav-mode-source</property>
<value>GPS</value>
</equals>
</or>
</and>
</condition>
</enable>
<input>
<prop>/autopilot/internal/nav1-heading-error-deg</prop>
@ -356,7 +424,7 @@
<value>0.0</value>
</reference>
<output>
<prop>/autopilot/internal/target-roll-deg</prop>
<prop>/autopilot/settings/target-roll-deg</prop>
</output>
<config>
<Kp>-1.0</Kp> <!-- proportional gain -->
@ -371,6 +439,47 @@
</config>
</pid-controller>
<pid-controller>
<name>Nav2 Hold Stage 1</name>
<debug>false</debug>
<enable>
<condition>
<and>
<equals>
<property>/autopilot/locks/heading</property>
<value>nav-hold</value>
</equals>
<equals>
<property>/autopilot/settings/nav-mode-source</property>
<value>NAV2</value>
</equals>
</and>
</condition>
</enable>
<input>
<prop>/autopilot/internal/nav2-heading-error-deg</prop>
</input>
<reference>
<value>0.0</value>
</reference>
<output>
<prop>/autopilot/settings/target-roll-deg</prop>
</output>
<config>
<Kp>-1.0</Kp> <!-- proportional gain -->
<beta>1.0</beta> <!-- input value weighing factor -->
<alpha>0.1</alpha> <!-- low pass filter weighing factor -->
<gamma>0.0</gamma> <!-- input value weighing factor for -->
<!-- unfiltered derivative error -->
<Ti>10.0</Ti> <!-- integrator time -->
<Td>0.00001</Td> <!-- derivator time -->
<u_min>-20.0</u_min> <!-- minimum output clamp -->
<u_max>20.0</u_max> <!-- maximum output clamp -->
</config>
</pid-controller>
<!-- =============================================================== -->
<!-- Pitch Axis Modes -->
<!-- =============================================================== -->

File diff suppressed because it is too large Load diff

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View file

@ -69,12 +69,24 @@ handleNoseUpDown : func(value) {
}
if (vertical_mode == "FLC") {
me._speed_setting.setValue(me._speed_setting.getValue() + (value * 1));
# Note that the button is NOSE UP / NOSE DN, so pressing NOSE DN _increases_
# speed, while NOSE UP _decreases_ speed. So the speed setting is reversed
# in comparison with setting direct pitch.
me._speed_setting.setValue(me._speed_setting.getValue() - (value * 1));
setprop("/autopilot/annunciator/vertical-mode-target",
sprintf("%i kt", me._speed_setting.getValue())
);
}
return emesary.Transmitter.ReceiptStatus_Finished;
},
setAPNavSource : func(src) {
setprop("/autopilot/settings/nav-mode-source", src);
# Also need to do something to trigger a NAV change if we're in NAV mode already.
return emesary.Transmitter.ReceiptStatus_Finished;
},
RegisterWithEmesary : func()
{
if (me._recipient == nil){
@ -107,6 +119,17 @@ RegisterWithEmesary : func()
if (id == fg1000.FASCIA.NOSE_UP) return controller.handleNoseUpDown(1);
if (id == fg1000.FASCIA.NOSE_DOWN) return controller.handleNoseUpDown(-1);
}
if (notification.NotificationType == notifications.PFDEventNotification.DefaultType and
notification.Event_Id == notifications.PFDEventNotification.FMSData and
notification.EventParameter != nil)
{
foreach(var key; keys(notification.EventParameter)) {
var val = notification.EventParameter[key];
if (key == "AutopilotNAVSource") return controller.setAPNavSource(val);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}

View file

@ -179,6 +179,17 @@ var PFDInstrumentsController =
me._CDISource = math.mod(me._CDISource + 1, size(PFDInstrumentsController.CDI_SOURCE));
var src = PFDInstrumentsController.CDI_SOURCE[me._CDISource];
# Indicate the change for CDI source to the autopilot
var data = {};
data["AutopilotNAVSource"] = src;
var notification = notifications.PFDEventNotification.new(
"MFD",
me._page.mfd.getDeviceID(),
notifications.PFDEventNotification.FMSData,
data);
me.transmitter.NotifyAll(notification);
# If we're changing to NAV1 or NAV2, we also change the selected NAV.
if ((src == "NAV1") or (src == "NAV2")) {
var data = {};

View file

@ -111,6 +111,8 @@ var Surround =
obj.addTextElements(["HeaderAPLateralArmed", "HeaderAPLateralActive", "HeaderAPVerticalArmed", "HeaderAPVerticalActive", "HeaderAPVerticalReference"]);
obj._apStatus = PFD.TextElement.new(obj.pageName, svg, "HeaderAPStatus", "", AP_STATUS_STYLE);
obj._apStatusTimer = nil;
obj._apHeadingModeTimer = nil;
obj._apAltitudeModeTimer = nil;
obj._dto = PFD.HighlightElement.new(obj.pageName, svg, "HeaderDTO", "DTO");
obj._leg = PFD.HighlightElement.new(obj.pageName, svg, "HeaderActiveLeg", "Leg");
} else {
@ -263,6 +265,7 @@ var Surround =
me._dto.setVisible(1);
} else {
me._dto.setVisible(0);
me.setTextElement("HeaderFrom", data["FMSPreviousLegID"]);
}
}
}