Roy Vegard Ovesen:
Here is the KAP140 Two Axis Autopilot update. I think it's fairly complete now, all the modes are working. I tested the localizer and glideslope hold and it was pretty stable all the way down to the middle marker. In the pilot guide for backcourse hold (REV) mode it says to reset the heading bug to the _front course_. I haven't figured out how to implement this so for the time beeing one should reset the heading bug to the _backcourse_. Apart from this the panel should operate identical to the way the pilot guide describes.
This commit is contained in:
parent
a9a359055b
commit
8ab947db84
3 changed files with 610 additions and 51 deletions
|
@ -220,6 +220,93 @@ properties' values.
|
|||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>APR-ARM Anunciator</name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/autopilot/KAP140/annunciators/apr-arm</property>
|
||||
<value>on</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<texture>
|
||||
<path>Aircraft/Instruments/Textures/KAP140.rgb</path>
|
||||
<x1>0.13671875</x1>
|
||||
<x2>0.265625</x2>
|
||||
<y1>0.939453125</y1>
|
||||
<y2>1.0</y2>
|
||||
</texture>
|
||||
<w>64</w>
|
||||
<h>30</h>
|
||||
<transformations>
|
||||
<transformation>
|
||||
<type>x-shift</type>
|
||||
<offset>-145</offset>
|
||||
</transformation>
|
||||
<transformation>
|
||||
<type>y-shift</type>
|
||||
<offset>15</offset>
|
||||
</transformation>
|
||||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>REV Anunciator</name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/autopilot/KAP140/annunciators/rev</property>
|
||||
<value>on</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<texture>
|
||||
<path>Aircraft/Instruments/Textures/KAP140.rgb</path>
|
||||
<x1>0.4375</x1>
|
||||
<x2>0.54296875</x2>
|
||||
<y1>0.802734375</y1>
|
||||
<y2>0.845703125</y2>
|
||||
</texture>
|
||||
<w>53</w>
|
||||
<h>21</h>
|
||||
<transformations>
|
||||
<transformation>
|
||||
<type>x-shift</type>
|
||||
<offset>-150</offset>
|
||||
</transformation>
|
||||
<transformation>
|
||||
<type>y-shift</type>
|
||||
<offset>40</offset>
|
||||
</transformation>
|
||||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>REV-ARM Anunciator</name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/autopilot/KAP140/annunciators/rev-arm</property>
|
||||
<value>on</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<texture>
|
||||
<path>Aircraft/Instruments/Textures/KAP140.rgb</path>
|
||||
<x1>0.2734375</x1>
|
||||
<x2>0.40234375</x2>
|
||||
<y1>0.939453125</y1>
|
||||
<y2>1.0</y2>
|
||||
</texture>
|
||||
<w>64</w>
|
||||
<h>30</h>
|
||||
<transformations>
|
||||
<transformation>
|
||||
<type>x-shift</type>
|
||||
<offset>-145</offset>
|
||||
</transformation>
|
||||
<transformation>
|
||||
<type>y-shift</type>
|
||||
<offset>15</offset>
|
||||
</transformation>
|
||||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>VS Anunciator</name>
|
||||
<condition>
|
||||
|
@ -343,6 +430,64 @@ properties' values.
|
|||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>GS Anunciator</name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/autopilot/KAP140/annunciators/gs</property>
|
||||
<value>on</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<texture>
|
||||
<path>Aircraft/Instruments/Textures/KAP140.rgb</path>
|
||||
<x1>0.791015625</x1>
|
||||
<x2>0.85546875</x2>
|
||||
<y1>0.802734375</y1>
|
||||
<y2>0.845703125</y2>
|
||||
</texture>
|
||||
<w>31</w>
|
||||
<h>21</h>
|
||||
<transformations>
|
||||
<transformation>
|
||||
<type>x-shift</type>
|
||||
<offset>-47</offset>
|
||||
</transformation>
|
||||
<transformation>
|
||||
<type>y-shift</type>
|
||||
<offset>40</offset>
|
||||
</transformation>
|
||||
</transformations>
|
||||
</layer>
|
||||
|
||||
<layer>
|
||||
<name>GS-ARM Anunciator</name>
|
||||
<condition>
|
||||
<equals>
|
||||
<property>/autopilot/KAP140/annunciators/gs-arm</property>
|
||||
<value>on</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<texture>
|
||||
<path>Aircraft/Instruments/Textures/KAP140.rgb</path>
|
||||
<x1>0.548828125</x1>
|
||||
<x2>0.640625</x2>
|
||||
<y1>0.939453125</y1>
|
||||
<y2>1.0</y2>
|
||||
</texture>
|
||||
<w>45</w>
|
||||
<h>30</h>
|
||||
<transformations>
|
||||
<transformation>
|
||||
<type>x-shift</type>
|
||||
<offset>-136</offset>
|
||||
</transformation>
|
||||
<transformation>
|
||||
<type>y-shift</type>
|
||||
<offset>15</offset>
|
||||
</transformation>
|
||||
</transformations>
|
||||
</layer>
|
||||
|
||||
</layers>
|
||||
|
||||
<!-- Actions -->
|
||||
|
@ -424,6 +569,21 @@ properties' values.
|
|||
</binding>
|
||||
</action>
|
||||
|
||||
<action>
|
||||
<name>REV Button</name>
|
||||
<button>0</button>
|
||||
<x>30</x>
|
||||
<y>-54</y>
|
||||
<w>30</w>
|
||||
<h>20</h>
|
||||
<binding>
|
||||
<command>nasal</command>
|
||||
<script>
|
||||
kap140.rev_button();
|
||||
</script>
|
||||
</binding>
|
||||
</action>
|
||||
|
||||
<action>
|
||||
<name>DN Button</name>
|
||||
<button>0</button>
|
||||
|
|
|
@ -32,12 +32,12 @@
|
|||
<prop>/autopilot/KAP140/settings/target-intercept-angle</prop>
|
||||
</output>
|
||||
<config>
|
||||
<Kp>7.0</Kp> <!-- proportional gain -->
|
||||
<Kp>2.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 -->
|
||||
<Ti>15.0</Ti> <!-- integrator time -->
|
||||
<Td>0.0</Td> <!-- derivator time -->
|
||||
<u_min>-45.0</u_min> <!-- minimum output clamp -->
|
||||
<u_max>45.0</u_max> <!-- maximum output clamp -->
|
||||
|
@ -47,7 +47,7 @@
|
|||
<!-- Approach hold (APR) Mode-->
|
||||
<pid-controller>
|
||||
<name>Approach hold (APR) Mode</name>
|
||||
<debug>true</debug>
|
||||
<debug>false</debug>
|
||||
<enable>
|
||||
<prop>/autopilot/KAP140/locks/apr-hold</prop>
|
||||
<value>apr</value>
|
||||
|
@ -62,12 +62,43 @@
|
|||
<prop>/autopilot/KAP140/settings/target-intercept-angle</prop>
|
||||
</output>
|
||||
<config>
|
||||
<Kp>7.0</Kp> <!-- proportional gain -->
|
||||
<Kp>2.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 -->
|
||||
<Ti>15.0</Ti> <!-- integrator time -->
|
||||
<Td>0.001</Td> <!-- derivator time -->
|
||||
<u_min>-45.0</u_min> <!-- minimum output clamp -->
|
||||
<u_max>45.0</u_max> <!-- maximum output clamp -->
|
||||
</config>
|
||||
</pid-controller>
|
||||
|
||||
<!-- Backcourse hold (REV) Mode-->
|
||||
<pid-controller>
|
||||
<name>Backcourse hold (REV) Mode</name>
|
||||
<debug>false</debug>
|
||||
<enable>
|
||||
<prop>/autopilot/KAP140/locks/rev-hold</prop>
|
||||
<value>rev</value>
|
||||
</enable>
|
||||
<input>
|
||||
<prop>/radios/nav/heading-needle-deflection</prop>
|
||||
<scale>-1.0</scale>
|
||||
</input>
|
||||
<reference>
|
||||
<value>0.0</value>
|
||||
</reference>
|
||||
<output>
|
||||
<prop>/autopilot/KAP140/settings/target-intercept-angle</prop>
|
||||
</output>
|
||||
<config>
|
||||
<Kp>2.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>15.0</Ti> <!-- integrator time -->
|
||||
<Td>0.0</Td> <!-- derivator time -->
|
||||
<u_min>-45.0</u_min> <!-- minimum output clamp -->
|
||||
<u_max>45.0</u_max> <!-- maximum output clamp -->
|
||||
|
@ -84,7 +115,8 @@
|
|||
<value>hdg</value>
|
||||
</enable>
|
||||
<input>
|
||||
<prop>/autopilot/internal/heading-bug-error-deg</prop>
|
||||
<prop>/autopilot/internal/heading-bug-error-deg</prop> -->
|
||||
<!-- <prop>/instrumentation/gps/true-bug-error-deg</prop> -->
|
||||
</input>
|
||||
<reference>
|
||||
<prop>/autopilot/KAP140/settings/target-intercept-angle</prop>
|
||||
|
@ -173,7 +205,7 @@
|
|||
<!-- Glideslope Hold (GS) Mode -->
|
||||
<pid-controller>
|
||||
<name>Glideslope Hold (GS) Mode</name>
|
||||
<debug>true</debug>
|
||||
<debug>false</debug>
|
||||
<enable>
|
||||
<prop>/autopilot/KAP140/locks/gs-hold</prop>
|
||||
<value>gs</value>
|
||||
|
|
455
Nasal/kap140.nas
455
Nasal/kap140.nas
|
@ -79,6 +79,7 @@ ap_button = func {
|
|||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "rol");
|
||||
setprop(Locks, "pitch-axis", "vs");
|
||||
|
@ -106,6 +107,7 @@ ap_button = func {
|
|||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "roll-axis", "off");
|
||||
setprop(Locks, "roll-mode", "off");
|
||||
setprop(Locks, "pitch-axis", "off");
|
||||
|
@ -120,16 +122,19 @@ ap_button = func {
|
|||
setprop(Annunciators, "hdg", "off");
|
||||
setprop(Annunciators, "nav", "off");
|
||||
setprop(Annunciators, "nav-arm", "off");
|
||||
setprop(Annunciators, "apr", "off");
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
setprop(Annunciators, "rev", "off");
|
||||
setprop(Annunciators, "rev-arm", "off");
|
||||
setprop(Annunciators, "vs", "off");
|
||||
setprop(Annunciators, "vs-number", "off");
|
||||
setprop(Annunciators, "fpm", "off");
|
||||
setprop(Annunciators, "alt", "off");
|
||||
setprop(Annunciators, "apr", "off");
|
||||
setprop(Annunciators, "gs", "off");
|
||||
setprop(Annunciators, "gs-arm", "off");
|
||||
|
||||
flasher("ap", 1.0, 5, "off");
|
||||
|
||||
setprop(Internal, "ft", 0.1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,6 +152,7 @@ hdg_button = func {
|
|||
{
|
||||
setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
|
@ -174,10 +180,12 @@ hdg_button = func {
|
|||
elsif (getprop(Locks, "roll-mode") == "rol" or
|
||||
getprop(Locks, "roll-mode") == "nav" or
|
||||
getprop(Locks, "roll-mode") == "nav-arm" or
|
||||
getprop(Locks, "roll-mode") == "rev")
|
||||
getprop(Locks, "roll-mode") == "rev" or
|
||||
getprop(Locks, "roll-mode") == "rev-arm")
|
||||
{
|
||||
#setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
|
@ -191,6 +199,7 @@ hdg_button = func {
|
|||
setprop(Annunciators, "hdg", "on");
|
||||
setprop(Annunciators, "nav", "off");
|
||||
setprop(Annunciators, "rol", "off");
|
||||
setprop(Annunciators, "rev", "off");
|
||||
|
||||
setprop(Settings, "target-intercept-angle", 0.0);
|
||||
}
|
||||
|
@ -204,6 +213,7 @@ hdg_button = func {
|
|||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "rol");
|
||||
|
@ -222,8 +232,10 @@ hdg_button = func {
|
|||
# If we are in APR mode we also have to change pitch mode.
|
||||
# TODO: Should we switch to VS or ALT mode? (currently VS)
|
||||
##
|
||||
elsif (getprop(Locks, "roll-mode") == "apr" and
|
||||
getprop(Locks, "pitch-mode") == "gs")
|
||||
elsif (getprop(Locks, "roll-mode") == "apr" or
|
||||
getprop(Locks, "roll-mode") == "apr-arm" or
|
||||
getprop(Locks, "pitch-mode") == "gs" or
|
||||
getprop(Locks, "pitch-mode") == "gs-arm")
|
||||
{
|
||||
setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
|
@ -236,10 +248,12 @@ hdg_button = func {
|
|||
setprop(Locks, "pitch-mode", "vs");
|
||||
|
||||
setprop(Annunciators, "alt", "off");
|
||||
setprop(Annunciators, "apr", "off");
|
||||
setprop(Annunciators, "gs", "off");
|
||||
setprop(Annunciators, "hdg", "on");
|
||||
setprop(Annunciators, "nav", "off");
|
||||
setprop(Annunciators, "apr", "off");
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
setprop(Annunciators, "gs", "off");
|
||||
setprop(Annunciators, "gs-arm", "off");
|
||||
setprop(Annunciators, "vs", "on");
|
||||
setprop(Annunciators, "vs-number", "on");
|
||||
setprop(Annunciators, "fpm", "on");
|
||||
|
@ -253,12 +267,17 @@ hdg_button = func {
|
|||
|
||||
nav_button = func {
|
||||
#print("nav_button");
|
||||
|
||||
##
|
||||
# If we are in HDG mode we switch to the 45 degree angle intercept NAV mode
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") == "hdg")
|
||||
{
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
|
@ -266,12 +285,16 @@ nav_button = func {
|
|||
|
||||
nav_arm_from_hdg();
|
||||
}
|
||||
##
|
||||
# If we are in ROL mode we switch to the all angle intercept NAV mode.
|
||||
##
|
||||
elsif (getprop(Locks, "roll-mode") == "rol")
|
||||
{
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
|
@ -279,26 +302,19 @@ nav_button = func {
|
|||
|
||||
nav_arm_from_rol();
|
||||
}
|
||||
elsif (getprop(Locks, "roll-mode") == "apr" and
|
||||
getprop(Locks, "pitch-mode") == "gs")
|
||||
{
|
||||
setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "nav");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "nav");
|
||||
setprop(Locks, "pitch-axis", "vs");
|
||||
setprop(Locks, "pitch-mode", "vs");
|
||||
|
||||
setprop(Settings, "target-pressure-rate", getprop(Internal,
|
||||
"pressure-rate"));
|
||||
}
|
||||
##
|
||||
# TODO:
|
||||
# NAV mode can only be armed if we are in HDG or ROL mode.
|
||||
# Can anyone verify that this is correct?
|
||||
##
|
||||
}
|
||||
|
||||
nav_arm_from_hdg = func
|
||||
{
|
||||
##
|
||||
# Abort the NAV-ARM mode if something has changed the roll mode to something
|
||||
# else than NAV-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "nav-arm")
|
||||
{
|
||||
setprop(Annunciators, "nav-arm", "off");
|
||||
|
@ -306,21 +322,33 @@ nav_arm_from_hdg = func
|
|||
}
|
||||
|
||||
setprop(Annunciators, "nav-arm", "on");
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
print("flashing...");
|
||||
settimer(nav_arm_from_hdg, 2.5);
|
||||
return;
|
||||
}
|
||||
|
||||
##
|
||||
# Activate the nav-hold controller and check the needle deviation.
|
||||
##
|
||||
setprop(Locks, "nav-hold", "nav");
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(nav_arm_from_hdg, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the NAV-ARM annunciator
|
||||
# and show the NAV annunciator. End of NAV-ARM sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
|
@ -331,12 +359,18 @@ nav_arm_from_hdg = func
|
|||
|
||||
nav_arm_from_rol = func
|
||||
{
|
||||
##
|
||||
# Abort the NAV-ARM mode if something has changed the roll mode to something
|
||||
# else than NAV-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "nav-arm")
|
||||
{
|
||||
setprop(Annunciators, "nav-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
setprop(Annunciators, "nav-arm", "on");
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
|
@ -345,17 +379,26 @@ nav_arm_from_rol = func
|
|||
settimer(nav_arm_from_rol, 2.5);
|
||||
return;
|
||||
}
|
||||
|
||||
##
|
||||
# Turn the ROL annunciator back on and activate the ROL mode.
|
||||
##
|
||||
setprop(Annunciators, "rol", "on");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Settings, "target-turn-rate", 0.0);
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(nav_arm_from_rol, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the NAV-ARM annunciator
|
||||
# and show the NAV annunciator. End of NAV-ARM sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
|
@ -365,6 +408,7 @@ nav_arm_from_rol = func
|
|||
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "nav");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
|
@ -374,37 +418,360 @@ nav_arm_from_rol = func
|
|||
|
||||
apr_button = func {
|
||||
#print("apr_button");
|
||||
if (getprop(Locks, "roll-mode") == "hdg" or
|
||||
getprop(Locks, "roll-mode") == "rol" or
|
||||
getprop(Locks, "roll-mode") == "rev" or
|
||||
#getprop(Locks, "roll-mode") == "apr" or
|
||||
getprop(Locks, "pitch-mode") == "nav")
|
||||
##
|
||||
# If we are in HDG mode we switch to the 45 degree intercept angle APR mode
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") == "hdg")
|
||||
{
|
||||
setprop(Locks, "alt-hold", "off");
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
#setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "apr");
|
||||
setprop(Locks, "gs-hold", "gs");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "apr-arm");
|
||||
#setprop(Locks, "pitch-axis", "vs");
|
||||
#setprop(Locks, "pitch-mode", "gs");
|
||||
|
||||
apr_arm_from_hdg();
|
||||
}
|
||||
elsif (getprop(Locks, "roll-mode") == "rol")
|
||||
{
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
#setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "apr");
|
||||
setprop(Locks, "pitch-axis", "vs");
|
||||
setprop(Locks, "pitch-mode", "gs");
|
||||
setprop(Locks, "roll-mode", "apr-arm");
|
||||
#setprop(Locks, "pitch-axis", "vs");
|
||||
#setprop(Locks, "pitch-mode", "vs");
|
||||
|
||||
apr_arm_from_rol();
|
||||
}
|
||||
elsif (getprop(Locks, "roll-mode") == "apr" and
|
||||
getprop(Locks, "pitch-mode") == "gs")
|
||||
}
|
||||
|
||||
apr_arm_from_hdg = func
|
||||
{
|
||||
##
|
||||
# Abort the APR-ARM mode if something has changed the roll mode to something
|
||||
# else than APR-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "apr-arm")
|
||||
{
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
setprop(Annunciators, "apr-arm", "on");
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
print("flashing...");
|
||||
settimer(apr_arm_from_hdg, 2.5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# Activate the apr-hold controller and check the needle deviation.
|
||||
##
|
||||
setprop(Locks, "apr-hold", "apr");
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(apr_arm_from_hdg, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the APR-ARM annunciator
|
||||
# and show the APR annunciator. End of APR-ARM sequence. Start the GS-ARM
|
||||
# sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
setprop(Annunciators, "apr", "on");
|
||||
setprop(Locks, "pitch-mode", "gs-arm");
|
||||
|
||||
gs_arm();
|
||||
}
|
||||
}
|
||||
|
||||
apr_arm_from_rol = func
|
||||
{
|
||||
##
|
||||
# Abort the APR-ARM mode if something has changed the roll mode to something
|
||||
# else than APR-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "apr-arm")
|
||||
{
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
setprop(Annunciators, "apr-arm", "on");
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
print("flashing...");
|
||||
setprop(Annunciators, "rol", "off");
|
||||
settimer(apr_arm_from_rol, 2.5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# Turn the ROL annunciator back on and activate the ROL mode.
|
||||
##
|
||||
setprop(Annunciators, "rol", "on");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Settings, "target-turn-rate", 0.0);
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(apr_arm_from_rol, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the APR-ARM annunciator
|
||||
# and show the APR annunciator. End of APR-ARM sequence. Start the GS-ARM
|
||||
# sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
setprop(Annunciators, "rol", "off");
|
||||
setprop(Annunciators, "apr-arm", "off");
|
||||
setprop(Annunciators, "apr", "on");
|
||||
|
||||
setprop(Locks, "apr-hold", "apr");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "apr");
|
||||
setprop(Locks, "pitch-mode", "gs-arm");
|
||||
|
||||
gs_arm();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
gs_arm = func {
|
||||
##
|
||||
# Abort the GS-ARM mode if something has changed the pitch mode to something
|
||||
# else than GS-ARM.
|
||||
##
|
||||
if (getprop(Locks, "pitch-mode") != "gs-arm")
|
||||
{
|
||||
setprop(Annunciators, "gs-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
setprop(Annunciators, "gs-arm", "on");
|
||||
|
||||
deviation = getprop("/radios/nav/gs-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 1 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 1.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(gs_arm, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn off the GS-ARM annunciator
|
||||
# and show the GS annunciator. Activate the GS pitch mode.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
setprop(Annunciators, "alt", "off");
|
||||
setprop(Annunciators, "vs", "off");
|
||||
setprop(Annunciators, "vs-number", "off");
|
||||
setprop(Annunciators, "fpm", "off");
|
||||
setprop(Annunciators, "gs-arm", "off");
|
||||
setprop(Annunciators, "gs", "on");
|
||||
|
||||
setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "gs-hold", "gs");
|
||||
setprop(Locks, "pitch-mode", "gs");
|
||||
#setprop(Locks, "hdg-hold", "hdg");
|
||||
#setprop(Locks, "nav-hold", "off");
|
||||
#setprop(Locks, "roll-axis", "trn");
|
||||
#setprop(Locks, "roll-mode", "apr");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
rev_button = func {
|
||||
#print("rev_button");
|
||||
##
|
||||
# If we are in HDG mode we switch to the 45 degree intercept angle REV mode
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") == "hdg")
|
||||
{
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
#setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "nav");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "nav");
|
||||
setprop(Locks, "pitch-axis", "vs");
|
||||
setprop(Locks, "pitch-mode", "vs");
|
||||
setprop(Locks, "roll-mode", "rev-arm");
|
||||
#setprop(Locks, "pitch-axis", "vs");
|
||||
#setprop(Locks, "pitch-mode", "gs");
|
||||
|
||||
setprop(Settings, "target-pressure-rate", getprop(Internal,
|
||||
"pressure-rate"));
|
||||
rev_arm_from_hdg();
|
||||
}
|
||||
elsif (getprop(Locks, "roll-mode") == "rol")
|
||||
{
|
||||
flasher("hdg", 0.5, 8, "off");
|
||||
|
||||
#setprop(Locks, "alt-hold", "off");
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "off");
|
||||
setprop(Locks, "hdg-hold", "off");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "rev-arm");
|
||||
#setprop(Locks, "pitch-axis", "vs");
|
||||
#setprop(Locks, "pitch-mode", "vs");
|
||||
|
||||
rev_arm_from_rol();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rev_arm_from_hdg = func
|
||||
{
|
||||
##
|
||||
# Abort the REV-ARM mode if something has changed the roll mode to something
|
||||
# else than REV-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "rev-arm")
|
||||
{
|
||||
setprop(Annunciators, "rev-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
setprop(Annunciators, "rev-arm", "on");
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
print("flashing...");
|
||||
settimer(rev_arm_from_hdg, 2.5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# Activate the rev-hold controller and check the needle deviation.
|
||||
##
|
||||
setprop(Locks, "rev-hold", "rev");
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(rev_arm_from_hdg, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the REV-ARM annunciator
|
||||
# and show the REV annunciator. End of REV-ARM sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
setprop(Annunciators, "rev-arm", "off");
|
||||
setprop(Annunciators, "rev", "on");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
rev_arm_from_rol = func
|
||||
{
|
||||
##
|
||||
# Abort the REV-ARM mode if something has changed the roll mode to something
|
||||
# else than REV-ARM.
|
||||
##
|
||||
if (getprop(Locks, "roll-mode") != "rev-arm")
|
||||
{
|
||||
setprop(Annunciators, "rev-arm", "off");
|
||||
return;
|
||||
}
|
||||
|
||||
setprop(Annunciators, "rev-arm", "on");
|
||||
##
|
||||
# Wait for the HDG annunciator flashing to finish.
|
||||
##
|
||||
if (flash_timer > -0.5)
|
||||
{
|
||||
print("flashing...");
|
||||
setprop(Annunciators, "rol", "off");
|
||||
settimer(rev_arm_from_rol, 2.5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# Turn the ROL annunciator back on and activate the ROL mode.
|
||||
##
|
||||
setprop(Annunciators, "rol", "on");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Settings, "target-turn-rate", 0.0);
|
||||
deviation = getprop("/radios/nav/heading-needle-deflection");
|
||||
##
|
||||
# If the deflection is more than 3 degrees wait 5 seconds and check again.
|
||||
##
|
||||
if (abs(deviation) > 3.0)
|
||||
{
|
||||
print("deviation");
|
||||
settimer(rev_arm_from_rol, 5);
|
||||
return;
|
||||
}
|
||||
##
|
||||
# If the deviation is less than 3 degrees turn of the REV-ARM annunciator
|
||||
# and show the REV annunciator. End of REV-ARM sequence.
|
||||
##
|
||||
elsif (abs(deviation) < 3.1)
|
||||
{
|
||||
print("capture");
|
||||
setprop(Annunciators, "rol", "off");
|
||||
setprop(Annunciators, "rev-arm", "off");
|
||||
setprop(Annunciators, "rev", "on");
|
||||
|
||||
setprop(Locks, "apr-hold", "off");
|
||||
setprop(Locks, "gs-hold", "off");
|
||||
setprop(Locks, "rev-hold", "rev");
|
||||
setprop(Locks, "hdg-hold", "hdg");
|
||||
setprop(Locks, "nav-hold", "off");
|
||||
setprop(Locks, "roll-axis", "trn");
|
||||
setprop(Locks, "roll-mode", "rev");
|
||||
#setprop(Locks, "pitch-mode", "gs-arm");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue