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>
|
||||
<umin>-0.30</umin>
|
||||
<umax>0.30</umax>
|
||||
<kp>-0.05</kp>
|
||||
<kp>-0.04</kp>
|
||||
<ti>10.0</ti>
|
||||
<td>0.0001</td>
|
||||
<kp-cws>-0.07</kp-cws>
|
||||
|
@ -250,7 +250,7 @@
|
|||
<alt>0.025</alt>
|
||||
<vs>0.07</vs>
|
||||
<fpa>0.30</fpa>
|
||||
<flch>-0.35</flch>
|
||||
<flch>-0.60</flch>
|
||||
<gs>0.10</gs>
|
||||
</cmd>
|
||||
<autoland>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# IT AUTOFLIGHT System Controller by Joshua Davidson (it0uchpods/411).
|
||||
# V3.0.0 Build 127
|
||||
# V3.0.0 Build 130
|
||||
# This program is 100% GPL!
|
||||
|
||||
print("IT-AUTOFLIGHT: Please Wait!");
|
||||
|
@ -161,19 +161,23 @@ var lateral = func {
|
|||
if (latset == 0) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 0);
|
||||
setprop("/it-autoflight/mode/lat", "HDG");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
} else if (latset == 1) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 1);
|
||||
setprop("/it-autoflight/mode/lat", "LNAV");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
if (getprop("/autopilot/route-manager/route/num") > 0) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.start();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
setprop("/it-autoflight/output/lat", 1);
|
||||
setprop("/it-autoflight/mode/lat", "LNAV");
|
||||
setprop("/it-autoflight/mode/arm", " ");
|
||||
}
|
||||
} else if (latset == 2) {
|
||||
setprop("/instrumentation/nav/signal-quality-norm", 0);
|
||||
setprop("/it-autoflight/output/loc-armed", 1);
|
||||
|
@ -182,6 +186,7 @@ var lateral = func {
|
|||
} else if (latset == 3) {
|
||||
alandt.stop();
|
||||
alandt1.stop();
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/loc-armed", 0);
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
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/arm", " ");
|
||||
} else if (latset == 4) {
|
||||
lnavwptt.stop();
|
||||
setprop("/it-autoflight/output/lat", 4);
|
||||
setprop("/it-autoflight/mode/lat", "ALGN");
|
||||
} else if (latset == 5) {
|
||||
lnavwptt.stop();
|
||||
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 {
|
||||
setprop("/it-autoflight/output/appr-armed", 0);
|
||||
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
|
||||
setlistener("/it-autoflight/input/toga", func {
|
||||
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
|
||||
setlistener("/it-autoflight/output/vert", func {
|
||||
var vertm = getprop("/it-autoflight/output/vert");
|
||||
|
@ -482,6 +503,24 @@ var altcapt = func {
|
|||
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
|
||||
var thrustmode = func {
|
||||
var calt = getprop("/instrumentation/altimeter/indicated-altitude-ft");
|
||||
|
@ -511,24 +550,7 @@ var thrustmode = func {
|
|||
}
|
||||
}
|
||||
|
||||
# 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();
|
||||
}
|
||||
}
|
||||
|
||||
# ILS and Autoland
|
||||
# Retard
|
||||
setlistener("/controls/flight/flaps", func {
|
||||
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
|
||||
var update_arms = func {
|
||||
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
|
||||
var altcaptt = maketimer(0.5, altcapt);
|
||||
var thrustmodet = maketimer(0.5, thrustmode);
|
||||
|
@ -719,3 +741,4 @@ var cwspitcht = maketimer(0.1, cwspitch);
|
|||
var reduct = maketimer(0.5, toga_reduc);
|
||||
var latarmt = maketimer(0.5, latarms);
|
||||
var fpa_calct = maketimer(0.1, fpa_calc);
|
||||
var lnavwptt = maketimer(1, lnavwpt);
|
||||
|
|
|
@ -313,7 +313,7 @@
|
|||
<value>1</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<value>-30</value>
|
||||
<value>-20</value>
|
||||
</u_min>
|
||||
<u_max>
|
||||
<condition>
|
||||
|
@ -331,7 +331,7 @@
|
|||
<value>1</value>
|
||||
</equals>
|
||||
</condition>
|
||||
<value>30</value>
|
||||
<value>20</value>
|
||||
</u_max>
|
||||
</filter>
|
||||
|
||||
|
@ -369,6 +369,19 @@
|
|||
</config>
|
||||
</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>
|
||||
<name>IT-CONTROLLER: ROLL</name>
|
||||
<debug>false</debug>
|
||||
|
@ -390,7 +403,7 @@
|
|||
<property>/orientation/roll-deg</property>
|
||||
</input>
|
||||
<reference>
|
||||
<property>/it-autoflight/internal/target-roll-deg</property>
|
||||
<property>/it-autoflight/internal/roll-deg-cmd</property>
|
||||
</reference>
|
||||
<output>
|
||||
<property>/it-autoflight/internal/aileron-cmd</property>
|
||||
|
@ -465,7 +478,7 @@
|
|||
</input>
|
||||
<output>/controls/flight/aileron</output>
|
||||
<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>
|
||||
|
||||
<!-- =============================================================== -->
|
||||
|
@ -692,7 +705,7 @@
|
|||
</equals>
|
||||
</condition>
|
||||
<property>/it-autoflight/internal/lookahead-10-sec-mach</property>
|
||||
<scale>1000.0</scale>
|
||||
<scale>500.0</scale>
|
||||
</input>
|
||||
<reference>
|
||||
<condition>
|
||||
|
@ -711,7 +724,7 @@
|
|||
</equals>
|
||||
</condition>
|
||||
<property>/it-autoflight/input/spd-mach</property>
|
||||
<scale>1000.0</scale>
|
||||
<scale>500.0</scale>
|
||||
</reference>
|
||||
<output>
|
||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
||||
|
@ -732,7 +745,7 @@
|
|||
<property>/instrumentation/altimeter/indicated-altitude-ft</property>
|
||||
</greater-than>
|
||||
</condition>
|
||||
<value>1.5</value>
|
||||
<value>2</value>
|
||||
</u_min>
|
||||
<u_min>
|
||||
<condition>
|
||||
|
@ -811,13 +824,26 @@
|
|||
<Ti>10.0</Ti>
|
||||
<Td>0.00001</Td>
|
||||
<u_min>
|
||||
<value>1.5</value>
|
||||
<value>2</value>
|
||||
</u_min>
|
||||
<u_max>
|
||||
<value>25.0</value>
|
||||
</u_max>
|
||||
</config>
|
||||
</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>
|
||||
<name>IT-CONTROLLER: PITCH</name>
|
||||
|
@ -840,7 +866,7 @@
|
|||
<property>/orientation/pitch-deg</property>
|
||||
</input>
|
||||
<reference>
|
||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
||||
<property>/it-autoflight/internal/pitch-deg-cmd</property>
|
||||
</reference>
|
||||
<output>
|
||||
<property>/it-autoflight/internal/elevator-cmd</property>
|
||||
|
@ -1260,7 +1286,7 @@
|
|||
<input>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/target-roll-deg</property>
|
||||
<property>/it-autoflight/internal/roll-deg-cmd</property>
|
||||
<property>/orientation/roll-deg</property>
|
||||
</dif>
|
||||
</expression>
|
||||
|
@ -1277,7 +1303,7 @@
|
|||
<input>
|
||||
<expression>
|
||||
<dif>
|
||||
<property>/it-autoflight/internal/target-pitch-deg</property>
|
||||
<property>/it-autoflight/internal/pitch-deg-cmd</property>
|
||||
<property>/orientation/pitch-deg</property>
|
||||
</dif>
|
||||
</expression>
|
||||
|
|
Reference in a new issue