ITAF B130
This commit is contained in:
parent
2e64524f3c
commit
a7078ddc2f
3 changed files with 99 additions and 50 deletions
|
@ -239,7 +239,7 @@
|
||||||
<pitch>
|
<pitch>
|
||||||
<umin>-0.30</umin>
|
<umin>-0.30</umin>
|
||||||
<umax>0.30</umax>
|
<umax>0.30</umax>
|
||||||
<kp>-0.05</kp>
|
<kp>-0.04</kp>
|
||||||
<ti>10.0</ti>
|
<ti>10.0</ti>
|
||||||
<td>0.0001</td>
|
<td>0.0001</td>
|
||||||
<kp-cws>-0.07</kp-cws>
|
<kp-cws>-0.07</kp-cws>
|
||||||
|
@ -250,7 +250,7 @@
|
||||||
<alt>0.025</alt>
|
<alt>0.025</alt>
|
||||||
<vs>0.07</vs>
|
<vs>0.07</vs>
|
||||||
<fpa>0.30</fpa>
|
<fpa>0.30</fpa>
|
||||||
<flch>-0.35</flch>
|
<flch>-0.60</flch>
|
||||||
<gs>0.10</gs>
|
<gs>0.10</gs>
|
||||||
</cmd>
|
</cmd>
|
||||||
<autoland>
|
<autoland>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# IT AUTOFLIGHT System Controller by Joshua Davidson (it0uchpods/411).
|
# IT AUTOFLIGHT System Controller by Joshua Davidson (it0uchpods/411).
|
||||||
# V3.0.0 Build 127
|
# V3.0.0 Build 130
|
||||||
# This program is 100% GPL!
|
# This program is 100% GPL!
|
||||||
|
|
||||||
print("IT-AUTOFLIGHT: Please Wait!");
|
print("IT-AUTOFLIGHT: Please Wait!");
|
||||||
|
@ -161,19 +161,23 @@ var lateral = func {
|
||||||
if (latset == 0) {
|
if (latset == 0) {
|
||||||
alandt.stop();
|
alandt.stop();
|
||||||
alandt1.stop();
|
alandt1.stop();
|
||||||
|
lnavwptt.stop();
|
||||||
setprop("/it-autoflight/output/loc-armed", 0);
|
setprop("/it-autoflight/output/loc-armed", 0);
|
||||||
setprop("/it-autoflight/output/appr-armed", 0);
|
setprop("/it-autoflight/output/appr-armed", 0);
|
||||||
setprop("/it-autoflight/output/lat", 0);
|
setprop("/it-autoflight/output/lat", 0);
|
||||||
setprop("/it-autoflight/mode/lat", "HDG");
|
setprop("/it-autoflight/mode/lat", "HDG");
|
||||||
setprop("/it-autoflight/mode/arm", " ");
|
setprop("/it-autoflight/mode/arm", " ");
|
||||||
} else if (latset == 1) {
|
} else if (latset == 1) {
|
||||||
alandt.stop();
|
if (getprop("/autopilot/route-manager/route/num") > 0) {
|
||||||
alandt1.stop();
|
alandt.stop();
|
||||||
setprop("/it-autoflight/output/loc-armed", 0);
|
alandt1.stop();
|
||||||
setprop("/it-autoflight/output/appr-armed", 0);
|
lnavwptt.start();
|
||||||
setprop("/it-autoflight/output/lat", 1);
|
setprop("/it-autoflight/output/loc-armed", 0);
|
||||||
setprop("/it-autoflight/mode/lat", "LNAV");
|
setprop("/it-autoflight/output/appr-armed", 0);
|
||||||
setprop("/it-autoflight/mode/arm", " ");
|
setprop("/it-autoflight/output/lat", 1);
|
||||||
|
setprop("/it-autoflight/mode/lat", "LNAV");
|
||||||
|
setprop("/it-autoflight/mode/arm", " ");
|
||||||
|
}
|
||||||
} else if (latset == 2) {
|
} else if (latset == 2) {
|
||||||
setprop("/instrumentation/nav/signal-quality-norm", 0);
|
setprop("/instrumentation/nav/signal-quality-norm", 0);
|
||||||
setprop("/it-autoflight/output/loc-armed", 1);
|
setprop("/it-autoflight/output/loc-armed", 1);
|
||||||
|
@ -182,6 +186,7 @@ var lateral = func {
|
||||||
} else if (latset == 3) {
|
} else if (latset == 3) {
|
||||||
alandt.stop();
|
alandt.stop();
|
||||||
alandt1.stop();
|
alandt1.stop();
|
||||||
|
lnavwptt.stop();
|
||||||
setprop("/it-autoflight/output/loc-armed", 0);
|
setprop("/it-autoflight/output/loc-armed", 0);
|
||||||
setprop("/it-autoflight/output/appr-armed", 0);
|
setprop("/it-autoflight/output/appr-armed", 0);
|
||||||
var hdgnow = int(getprop("/orientation/heading-magnetic-deg")+0.5);
|
var hdgnow = int(getprop("/orientation/heading-magnetic-deg")+0.5);
|
||||||
|
@ -190,9 +195,11 @@ var lateral = func {
|
||||||
setprop("/it-autoflight/mode/lat", "HDG");
|
setprop("/it-autoflight/mode/lat", "HDG");
|
||||||
setprop("/it-autoflight/mode/arm", " ");
|
setprop("/it-autoflight/mode/arm", " ");
|
||||||
} else if (latset == 4) {
|
} else if (latset == 4) {
|
||||||
|
lnavwptt.stop();
|
||||||
setprop("/it-autoflight/output/lat", 4);
|
setprop("/it-autoflight/output/lat", 4);
|
||||||
setprop("/it-autoflight/mode/lat", "ALGN");
|
setprop("/it-autoflight/mode/lat", "ALGN");
|
||||||
} else if (latset == 5) {
|
} else if (latset == 5) {
|
||||||
|
lnavwptt.stop();
|
||||||
setprop("/it-autoflight/output/lat", 5);
|
setprop("/it-autoflight/output/lat", 5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,6 +347,18 @@ var vertical = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Helpers
|
||||||
|
var lnavwpt = func {
|
||||||
|
if (getprop("/autopilot/route-manager/route/num") > 0) {
|
||||||
|
if (getprop("/autopilot/route-manager/wp/dist") <= 1.0) {
|
||||||
|
var wptnum = getprop("/autopilot/route-manager/current-wp");
|
||||||
|
if ((wptnum + 1) < getprop("/autopilot/route-manager/route/num")) {
|
||||||
|
setprop("/autopilot/route-manager/current-wp", wptnum + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var flch_on = func {
|
var flch_on = func {
|
||||||
setprop("/it-autoflight/output/appr-armed", 0);
|
setprop("/it-autoflight/output/appr-armed", 0);
|
||||||
setprop("/it-autoflight/output/vert", 4);
|
setprop("/it-autoflight/output/vert", 4);
|
||||||
|
@ -376,6 +395,14 @@ setlistener("/it-autoflight/input/kts-mach", func {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
# Takeoff Modes
|
||||||
|
# Lat Active
|
||||||
|
var latarms = func {
|
||||||
|
if (getprop("/position/gear-agl-ft") >= getprop("/it-autoflight/settings/lat-agl-ft")) {
|
||||||
|
setprop("/it-autoflight/input/lat", getprop("/it-autoflight/input/lat-arm"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# TOGA
|
# TOGA
|
||||||
setlistener("/it-autoflight/input/toga", func {
|
setlistener("/it-autoflight/input/toga", func {
|
||||||
if (getprop("/it-autoflight/input/toga") == 1) {
|
if (getprop("/it-autoflight/input/toga") == 1) {
|
||||||
|
@ -417,12 +444,6 @@ var toga_reduc = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var latarms = func {
|
|
||||||
if (getprop("/position/gear-agl-ft") >= getprop("/it-autoflight/settings/lat-agl-ft")) {
|
|
||||||
setprop("/it-autoflight/input/lat", getprop("/it-autoflight/input/lat-arm"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Altitude Capture and FPA Timer Logic
|
# Altitude Capture and FPA Timer Logic
|
||||||
setlistener("/it-autoflight/output/vert", func {
|
setlistener("/it-autoflight/output/vert", func {
|
||||||
var vertm = getprop("/it-autoflight/output/vert");
|
var vertm = getprop("/it-autoflight/output/vert");
|
||||||
|
@ -482,6 +503,24 @@ var altcapt = func {
|
||||||
setprop("/it-autoflight/internal/alt", altinput);
|
setprop("/it-autoflight/internal/alt", altinput);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Min and Max Pitch Reset
|
||||||
|
var minmax = func {
|
||||||
|
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
|
var alt = getprop("/it-autoflight/internal/alt");
|
||||||
|
var dif = calt - alt;
|
||||||
|
if (dif < 100 and dif > -100) {
|
||||||
|
setprop("/it-autoflight/internal/max-pitch", 8);
|
||||||
|
setprop("/it-autoflight/internal/min-pitch", -5);
|
||||||
|
var vertmode = getprop("/it-autoflight/output/vert");
|
||||||
|
if (vertmode == 1 or vertmode == 2 or vertmode == 4 or vertmode == 5 or vertmode == 6 or vertmode == 7) {
|
||||||
|
# Do not change the vertical mode because we are not trying to capture altitude.
|
||||||
|
} else {
|
||||||
|
setprop("/it-autoflight/mode/vert", "ALT HLD");
|
||||||
|
}
|
||||||
|
minmaxtimer.stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Thrust Mode Selector
|
# Thrust Mode Selector
|
||||||
var thrustmode = func {
|
var thrustmode = func {
|
||||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||||
|
@ -511,24 +550,7 @@ var thrustmode = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Min and Max Pitch Reset
|
# ILS and Autoland
|
||||||
var minmax = func {
|
|
||||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
|
||||||
var alt = getprop("/it-autoflight/internal/alt");
|
|
||||||
var dif = calt - alt;
|
|
||||||
if (dif < 100 and dif > -100) {
|
|
||||||
setprop("/it-autoflight/internal/max-pitch", 8);
|
|
||||||
setprop("/it-autoflight/internal/min-pitch", -5);
|
|
||||||
var vertmode = getprop("/it-autoflight/output/vert");
|
|
||||||
if (vertmode == 1 or vertmode == 2 or vertmode == 4 or vertmode == 5 or vertmode == 6 or vertmode == 7) {
|
|
||||||
# Do not change the vertical mode because we are not trying to capture altitude.
|
|
||||||
} else {
|
|
||||||
setprop("/it-autoflight/mode/vert", "ALT HLD");
|
|
||||||
}
|
|
||||||
minmaxtimer.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Retard
|
# Retard
|
||||||
setlistener("/controls/flight/flaps", func {
|
setlistener("/controls/flight/flaps", func {
|
||||||
var flapc = getprop("/controls/flight/flaps");
|
var flapc = getprop("/controls/flight/flaps");
|
||||||
|
@ -575,11 +597,6 @@ var atoffchk = func{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# For Canvas Nav Display.
|
|
||||||
setlistener("/it-autoflight/input/hdg", func {
|
|
||||||
setprop("/autopilot/settings/heading-bug-deg", getprop("/it-autoflight/input/hdg"));
|
|
||||||
});
|
|
||||||
|
|
||||||
# LOC and G/S arming
|
# LOC and G/S arming
|
||||||
var update_arms = func {
|
var update_arms = func {
|
||||||
update_locarmelec();
|
update_locarmelec();
|
||||||
|
@ -706,6 +723,11 @@ var cwspitch = func {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# For Canvas Nav Display.
|
||||||
|
setlistener("/it-autoflight/input/hdg", func {
|
||||||
|
setprop("/autopilot/settings/heading-bug-deg", getprop("/it-autoflight/input/hdg"));
|
||||||
|
});
|
||||||
|
|
||||||
# Timers
|
# Timers
|
||||||
var altcaptt = maketimer(0.5, altcapt);
|
var altcaptt = maketimer(0.5, altcapt);
|
||||||
var thrustmodet = maketimer(0.5, thrustmode);
|
var thrustmodet = maketimer(0.5, thrustmode);
|
||||||
|
@ -719,3 +741,4 @@ var cwspitcht = maketimer(0.1, cwspitch);
|
||||||
var reduct = maketimer(0.5, toga_reduc);
|
var reduct = maketimer(0.5, toga_reduc);
|
||||||
var latarmt = maketimer(0.5, latarms);
|
var latarmt = maketimer(0.5, latarms);
|
||||||
var fpa_calct = maketimer(0.1, fpa_calc);
|
var fpa_calct = maketimer(0.1, fpa_calc);
|
||||||
|
var lnavwptt = maketimer(1, lnavwpt);
|
||||||
|
|
|
@ -313,7 +313,7 @@
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
</condition>
|
</condition>
|
||||||
<value>-30</value>
|
<value>-20</value>
|
||||||
</u_min>
|
</u_min>
|
||||||
<u_max>
|
<u_max>
|
||||||
<condition>
|
<condition>
|
||||||
|
@ -331,7 +331,7 @@
|
||||||
<value>1</value>
|
<value>1</value>
|
||||||
</equals>
|
</equals>
|
||||||
</condition>
|
</condition>
|
||||||
<value>30</value>
|
<value>20</value>
|
||||||
</u_max>
|
</u_max>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
|
@ -369,6 +369,19 @@
|
||||||
</config>
|
</config>
|
||||||
</pid-controller>
|
</pid-controller>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<name>IT-CONTROLLER: TARGET ROLL CMD</name>
|
||||||
|
<debug>false</debug>
|
||||||
|
<feedback-if-disabled>true</feedback-if-disabled>
|
||||||
|
<initialize-to>output</initialize-to>
|
||||||
|
<input>
|
||||||
|
<property>/it-autoflight/internal/target-roll-deg</property>
|
||||||
|
</input>
|
||||||
|
<output>/it-autoflight/internal/roll-deg-cmd</output>
|
||||||
|
<type>noise-spike</type>
|
||||||
|
<max-rate-of-change>10</max-rate-of-change>
|
||||||
|
</filter>
|
||||||
|
|
||||||
<pid-controller>
|
<pid-controller>
|
||||||
<name>IT-CONTROLLER: ROLL</name>
|
<name>IT-CONTROLLER: ROLL</name>
|
||||||
<debug>false</debug>
|
<debug>false</debug>
|
||||||
|
@ -390,7 +403,7 @@
|
||||||
<property>/orientation/roll-deg</property>
|
<property>/orientation/roll-deg</property>
|
||||||
</input>
|
</input>
|
||||||
<reference>
|
<reference>
|
||||||
<property>/it-autoflight/internal/target-roll-deg</property>
|
<property>/it-autoflight/internal/roll-deg-cmd</property>
|
||||||
</reference>
|
</reference>
|
||||||
<output>
|
<output>
|
||||||
<property>/it-autoflight/internal/aileron-cmd</property>
|
<property>/it-autoflight/internal/aileron-cmd</property>
|
||||||
|
@ -465,7 +478,7 @@
|
||||||
</input>
|
</input>
|
||||||
<output>/controls/flight/aileron</output>
|
<output>/controls/flight/aileron</output>
|
||||||
<type>noise-spike</type>
|
<type>noise-spike</type>
|
||||||
<max-rate-of-change>0.9</max-rate-of-change>
|
<max-rate-of-change>0.8</max-rate-of-change>
|
||||||
</filter>
|
</filter>
|
||||||
|
|
||||||
<!-- =============================================================== -->
|
<!-- =============================================================== -->
|
||||||
|
@ -692,7 +705,7 @@
|
||||||
</equals>
|
</equals>
|
||||||
</condition>
|
</condition>
|
||||||
<property>/it-autoflight/internal/lookahead-10-sec-mach</property>
|
<property>/it-autoflight/internal/lookahead-10-sec-mach</property>
|
||||||
<scale>1000.0</scale>
|
<scale>500.0</scale>
|
||||||
</input>
|
</input>
|
||||||
<reference>
|
<reference>
|
||||||
<condition>
|
<condition>
|
||||||
|
@ -711,7 +724,7 @@
|
||||||
</equals>
|
</equals>
|
||||||
</condition>
|
</condition>
|
||||||
<property>/it-autoflight/input/spd-mach</property>
|
<property>/it-autoflight/input/spd-mach</property>
|
||||||
<scale>1000.0</scale>
|
<scale>500.0</scale>
|
||||||
</reference>
|
</reference>
|
||||||
<output>
|
<output>
|
||||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
<property>/it-autoflight/internal/target-pitch-deg</property>
|
||||||
|
@ -732,7 +745,7 @@
|
||||||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||||
</greater-than>
|
</greater-than>
|
||||||
</condition>
|
</condition>
|
||||||
<value>1.5</value>
|
<value>2</value>
|
||||||
</u_min>
|
</u_min>
|
||||||
<u_min>
|
<u_min>
|
||||||
<condition>
|
<condition>
|
||||||
|
@ -811,13 +824,26 @@
|
||||||
<Ti>10.0</Ti>
|
<Ti>10.0</Ti>
|
||||||
<Td>0.00001</Td>
|
<Td>0.00001</Td>
|
||||||
<u_min>
|
<u_min>
|
||||||
<value>1.5</value>
|
<value>2</value>
|
||||||
</u_min>
|
</u_min>
|
||||||
<u_max>
|
<u_max>
|
||||||
<value>25.0</value>
|
<value>25.0</value>
|
||||||
</u_max>
|
</u_max>
|
||||||
</config>
|
</config>
|
||||||
</pid-controller>
|
</pid-controller>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<name>IT-CONTROLLER: TARGET PITCH CMD</name>
|
||||||
|
<debug>false</debug>
|
||||||
|
<feedback-if-disabled>true</feedback-if-disabled>
|
||||||
|
<initialize-to>output</initialize-to>
|
||||||
|
<input>
|
||||||
|
<property>/it-autoflight/internal/target-pitch-deg</property>
|
||||||
|
</input>
|
||||||
|
<output>/it-autoflight/internal/pitch-deg-cmd</output>
|
||||||
|
<type>noise-spike</type>
|
||||||
|
<max-rate-of-change>10</max-rate-of-change>
|
||||||
|
</filter>
|
||||||
|
|
||||||
<pid-controller>
|
<pid-controller>
|
||||||
<name>IT-CONTROLLER: PITCH</name>
|
<name>IT-CONTROLLER: PITCH</name>
|
||||||
|
@ -840,7 +866,7 @@
|
||||||
<property>/orientation/pitch-deg</property>
|
<property>/orientation/pitch-deg</property>
|
||||||
</input>
|
</input>
|
||||||
<reference>
|
<reference>
|
||||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
<property>/it-autoflight/internal/pitch-deg-cmd</property>
|
||||||
</reference>
|
</reference>
|
||||||
<output>
|
<output>
|
||||||
<property>/it-autoflight/internal/elevator-cmd</property>
|
<property>/it-autoflight/internal/elevator-cmd</property>
|
||||||
|
@ -1260,7 +1286,7 @@
|
||||||
<input>
|
<input>
|
||||||
<expression>
|
<expression>
|
||||||
<dif>
|
<dif>
|
||||||
<property>/it-autoflight/internal/target-roll-deg</property>
|
<property>/it-autoflight/internal/roll-deg-cmd</property>
|
||||||
<property>/orientation/roll-deg</property>
|
<property>/orientation/roll-deg</property>
|
||||||
</dif>
|
</dif>
|
||||||
</expression>
|
</expression>
|
||||||
|
@ -1277,7 +1303,7 @@
|
||||||
<input>
|
<input>
|
||||||
<expression>
|
<expression>
|
||||||
<dif>
|
<dif>
|
||||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
<property>/it-autoflight/internal/pitch-deg-cmd</property>
|
||||||
<property>/orientation/pitch-deg</property>
|
<property>/orientation/pitch-deg</property>
|
||||||
</dif>
|
</dif>
|
||||||
</expression>
|
</expression>
|
||||||
|
|
Reference in a new issue