Control: Fix incorrect handling of stick inputs in roll bank protection

This commit is contained in:
Joshua Davidson 2018-06-04 22:20:26 -04:00
parent b716c4e337
commit b301edbc76
2 changed files with 22 additions and 2 deletions

View file

@ -226,7 +226,15 @@ var update_loop = func {
var fbw_loop = func {
var ail = getprop("/controls/flight/aileron");
if (ail > 0.4 or ail < -0.4) {
if (ail > 0.4 and getprop("/orientation/roll-deg") >= -33.5) {
setprop("/it-fbw/roll-lim", "67");
if (getprop("/it-fbw/roll-back") == 1 and getprop("/orientation/roll-deg") <= 33.5 and getprop("/orientation/roll-deg") >= -33.5) {
setprop("/it-fbw/roll-back", 0);
}
if (getprop("/it-fbw/roll-back") == 0 and (getprop("/orientation/roll-deg") > 33.5 or getprop("/orientation/roll-deg") < -33.5)) {
setprop("/it-fbw/roll-back", 1);
}
} else if (ail < -0.4 and getprop("/orientation/roll-deg") <= 33.5) {
setprop("/it-fbw/roll-lim", "67");
if (getprop("/it-fbw/roll-back") == 1 and getprop("/orientation/roll-deg") <= 33.5 and getprop("/orientation/roll-deg") >= -33.5) {
setprop("/it-fbw/roll-back", 0);

View file

@ -329,7 +329,7 @@
</function>
</fcs_function>
<fcs_function name="fbw/roll/r-r-rb">
<fcs_function name="fbw/roll/r-r-rb-f">
<function>
<table>
<independentVar lookup="row">attitude/roll-rad</independentVar>
@ -345,6 +345,18 @@
</function>
</fcs_function>
<switch name="fbw/roll/r-r-rb">
<default value="fbw/roll/r-r-rb-f"/>
<test logic="AND" value="fbw/roll/r-r-33">
attitude/roll-rad lt 0
fbw/roll/r-r-33 ge fbw/roll/r-r-rb-f
</test>
<test logic="AND" value="fbw/roll/r-r-33">
attitude/roll-rad gt 0
fbw/roll/r-r-33 le fbw/roll/r-r-rb-f
</test>
</switch>
<fcs_function name="fbw/roll/r-r-os-nrb">
<function>
<sum>