Rewrite adjust FlyByWire, fix many bugs, fix AP Pitch Kp

This commit is contained in:
Joshua Davidson 2017-04-17 19:02:43 -04:00
parent 22a661adbc
commit 1044240550
4 changed files with 69 additions and 58 deletions

View file

@ -258,16 +258,16 @@
<kp-cws>0.09</kp-cws>
</roll>
<pitch>
<umin>-0.40</umin>
<umax>0.40</umax>
<kp>-0.09</kp>
<umin>-0.60</umin>
<umax>0.60</umax>
<kp>-0.12</kp>
<ti>10.0</ti>
<td>0.0001</td>
<kp-cws>-0.09</kp-cws>
<kp-cws>-0.12</kp-cws>
</pitch>
<cmd>
<roll-kp>-1.9</roll-kp>
<roll-scale>1.5</roll-scale>
<roll-kp>-1.0</roll-kp>
<roll-scale>1.4</roll-scale>
<vorloc>-4.0</vorloc>
<alt>0.025</alt>
<vs>0.10</vs>

View file

@ -31,10 +31,22 @@
<group>
<layout>vbox</layout>
<checkbox>
<label>Define Custom FBW Mode</label>
<halign>left</halign>
<property>/it-fbw/override</property>
<binding>
<command>dialog-apply</command>
</binding>
<live>true</live>
</checkbox>
<button>
<halign>center</halign>
<legend>Use NORMAL Law</legend>
<pref-width>140</pref-width>
<enable>
<property>/it-fbw/override</property>
</enable>
<binding>
<command>nasal</command>
<script>
@ -47,6 +59,9 @@
<halign>center</halign>
<legend>Use ALTERNATE Law</legend>
<pref-width>140</pref-width>
<enable>
<property>/it-fbw/override</property>
</enable>
<binding>
<command>nasal</command>
<script>
@ -59,6 +74,9 @@
<halign>center</halign>
<legend>Use DIRECT Law</legend>
<pref-width>140</pref-width>
<enable>
<property>/it-fbw/override</property>
</enable>
<binding>
<command>nasal</command>
<script>
@ -71,6 +89,9 @@
<halign>center</halign>
<legend>Use BACKUP Law</legend>
<pref-width>140</pref-width>
<enable>
<property>/it-fbw/override</property>
</enable>
<binding>
<command>nasal</command>
<script>

View file

@ -22,9 +22,12 @@ var roll_input = func {
setprop("/it-fbw/roll-deg", "-33");
}
}
} else {
} else if (getprop("/it-fbw/law") == 1) {
setprop("/it-fbw/roll-lim-max", "160");
setprop("/it-fbw/roll-lim-min", "-160");
} else {
setprop("/it-fbw/roll-lim-max", "33");
setprop("/it-fbw/roll-lim-min", "-33");
}
if (getprop("/gear/gear[0]/wow") == 1) {
@ -41,11 +44,19 @@ var pitch_input = func {
var elev = getprop("/controls/flight/elevator");
if (getprop("/it-fbw/law") == 0) {
setprop("/it-fbw/pitch-lim-max", "30");
setprop("/it-fbw/pitch-lim-min", "-15");
} else {
if (getprop("/position/gear-agl-ft") <= 30) {
setprop("/it-fbw/pitch-lim-max", "15");
setprop("/it-fbw/pitch-lim-min", "-5");
} else {
setprop("/it-fbw/pitch-lim-max", "30");
setprop("/it-fbw/pitch-lim-min", "-15");
}
} else if (getprop("/it-fbw/law") == 1) {
setprop("/it-fbw/pitch-lim-max", "160");
setprop("/it-fbw/pitch-lim-min", "-160");
} else {
setprop("/it-fbw/pitch-lim-max", "15");
setprop("/it-fbw/pitch-lim-min", "-15");
}
if (getprop("/gear/gear[0]/wow") == 1) {
@ -59,31 +70,8 @@ var pitch_input = func {
# Various Other Functions #
###########################
setlistener("/it-autoflight/output/ap1", func {
if (getprop("/it-autoflight/output/ap1") == 0) {
setprop("/it-fbw/roll-deg", getprop("/orientation/roll-deg"));
setprop("/it-fbw/pitch-deg", getprop("/orientation/pitch-deg"));
}
});
setlistener("/it-autoflight/output/ap2", func {
if (getprop("/it-autoflight/output/ap2") == 0) {
setprop("/it-fbw/roll-deg", getprop("/orientation/roll-deg"));
setprop("/it-fbw/pitch-deg", getprop("/orientation/pitch-deg"));
}
});
setlistener("/it-fbw/law", func {
if (getprop("/it-fbw/law") == 0) {
setprop("/it-fbw/roll-deg", getprop("/orientation/roll-deg"));
setprop("/it-fbw/pitch-deg", getprop("/orientation/pitch-deg"));
} else if (getprop("/it-fbw/law") == 1) {
setprop("/it-fbw/roll-deg", getprop("/orientation/roll-deg"));
setprop("/it-fbw/pitch-deg", getprop("/orientation/pitch-deg"));
}
});
setlistener("/sim/signals/fdm-initialized", func {
setprop("/it-fbw/override", 0);
setprop("/it-fbw/law", 2);
update_roll.start();
update_pitch.start();
@ -91,13 +79,15 @@ setlistener("/sim/signals/fdm-initialized", func {
});
setlistener("/systems/electrical/bus/ac-ess", func {
if (getprop("/systems/electrical/bus/ac-ess") >= 110) {
if (getprop("/it-fbw/law") != 0) {
setprop("/it-fbw/law", 0);
}
} else {
if (getprop("/it-fbw/law") != 2) {
setprop("/it-fbw/law", 2);
if (getprop("/it-fbw/override") == 0) {
if (getprop("/systems/electrical/bus/ac-ess") >= 110) {
if (getprop("/it-fbw/law") != 0) {
setprop("/it-fbw/law", 0);
}
} else {
if (getprop("/it-fbw/law") != 2) {
setprop("/it-fbw/law", 2);
}
}
}
});

View file

@ -4,10 +4,10 @@
<property value="0">/it-fbw/law</property>
<property value="0">/it-fbw/roll-deg</property>
<property value="0">/it-fbw/pitch-deg</property>
<property value="30">/it-fbw/roll-lim-max</property>
<property value="30">/it-fbw/roll-lim-min</property>
<property value="33">/it-fbw/roll-lim-max</property>
<property value="-33">/it-fbw/roll-lim-min</property>
<property value="30">/it-fbw/pitch-lim-max</property>
<property value="30">/it-fbw/pitch-lim-min</property>
<property value="-15">/it-fbw/pitch-lim-min</property>
<channel name="FBW Aileron">
<fcs_function name="/it-fbw/roll-deg">
@ -42,23 +42,23 @@
<table>
<independentVar lookup="row">/controls/flight/aileron</independentVar>
<tableData>
-1.0 -0.3
-0.7 -0.2
-0.5 -0.1
-0.3 -0.05
-0.15 -0.01
-0.05 -0.005
-1.0 -0.15
-0.7 -0.1
-0.5 -0.05
-0.3 -0.01
-0.15 -0.005
-0.05 -0.001
0.00 0.00
0.05 0.005
0.15 0.01
0.3 0.05
0.5 0.1
0.7 0.2
1.0 0.3
0.05 0.001
0.15 0.005
0.3 0.01
0.5 0.05
0.7 0.1
1.0 0.15
</tableData>
</table>
</sum>
<v>0</v>
<property>/orientation/roll-deg</property>
</ifthen>
</function>
<clipto>
@ -112,7 +112,7 @@
</tableData>
</table>
</sum>
<v>0</v>
<property>/orientation/pitch-deg</property>
</ifthen>
</function>
<clipto>