1
0
Fork 0

Control: Add and enumerate proper second input sidestick

This commit is contained in:
Josh Davidson 2021-04-28 19:09:15 -04:00
parent 1861a5f659
commit bfeb003c41
5 changed files with 84 additions and 15 deletions

View file

@ -936,9 +936,12 @@
<test-btn-2 type="bool">0</test-btn-2> <test-btn-2 type="bool">0</test-btn-2>
</fire> </fire>
<flight> <flight>
<aileron n="1" type="double">0</aileron>
<aileron-drives-tiller type="bool">0</aileron-drives-tiller> <aileron-drives-tiller type="bool">0</aileron-drives-tiller>
<aileron-input type="double">0</aileron-input> <aileron-input type="double">0</aileron-input>
<elevator n="1" type="double">0</elevator>
<elevator-input type="double">0</elevator-input> <elevator-input type="double">0</elevator-input>
<rudder n="1" type="double">0</rudder>
<speedbrake-arm type="bool">0</speedbrake-arm> <speedbrake-arm type="bool">0</speedbrake-arm>
<slats type="double">0</slats> <slats type="double">0</slats>
</flight> </flight>
@ -4654,7 +4657,6 @@
<file>Aircraft/A320-family/Nasal/Libraries/libraries.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/libraries.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/buttons.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/buttons.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/controls-override.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/controls-override.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/custom-views.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/shake.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/shake.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/sounds.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/sounds.nas</file>
<file>Aircraft/A320-family/Nasal/Libraries/view-controller.nas</file> <file>Aircraft/A320-family/Nasal/Libraries/view-controller.nas</file>

View file

@ -91,6 +91,9 @@ var FBW = {
overspeedRoll: props.globals.getNode("/it-fbw/protections/overspeed-roll-back"), overspeedRoll: props.globals.getNode("/it-fbw/protections/overspeed-roll-back"),
overspeed: props.globals.getNode("/it-fbw/protections/overspeed"), overspeed: props.globals.getNode("/it-fbw/protections/overspeed"),
}, },
Sidestick: {
active: [props.globals.getNode("/fdm/jsbsim/fbw/sidestick/active[0]"), props.globals.getNode("/fdm/jsbsim/fbw/sidestick/active[1]")],
},
Switches: { Switches: {
elac1Sw: props.globals.getNode("/controls/fctl/switches/elac1"), elac1Sw: props.globals.getNode("/controls/fctl/switches/elac1"),
elac2Sw: props.globals.getNode("/controls/fctl/switches/elac2"), elac2Sw: props.globals.getNode("/controls/fctl/switches/elac2"),
@ -124,6 +127,8 @@ var FBW = {
me.Computers.sec3.setBoolValue(0); me.Computers.sec3.setBoolValue(0);
me.Computers.fac1.setBoolValue(0); me.Computers.fac1.setBoolValue(0);
me.Computers.fac2.setBoolValue(0); me.Computers.fac2.setBoolValue(0);
me.Sidestick.active[0].setBoolValue(1); # Change to reset stick priority?
me.Sidestick.active[1].setBoolValue(1); # Change to reset stick priority?
me.degradeLaw.setValue(0); me.degradeLaw.setValue(0);
me.activeLaw.setValue(0); me.activeLaw.setValue(0);
me.override.setValue(0); me.override.setValue(0);

View file

@ -6,8 +6,11 @@
# Sim # Sim
var Controls = { var Controls = {
aileron: props.globals.getNode("/controls/flight/aileron", 1), aileron: props.globals.getNode("/controls/flight/aileron", 1),
aileron2: props.globals.getNode("/controls/flight/aileron[1]", 1),
elevator: props.globals.getNode("/controls/flight/elevator", 1), elevator: props.globals.getNode("/controls/flight/elevator", 1),
elevator2: props.globals.getNode("/controls/flight/elevator[1]", 1),
rudder: props.globals.getNode("/controls/flight/rudder", 1), rudder: props.globals.getNode("/controls/flight/rudder", 1),
rudder2: props.globals.getNode("/controls/flight/rudder[1]", 1),
}; };
var FPLN = { var FPLN = {
@ -348,7 +351,7 @@ var ITAF = {
# Misc # Misc
if (Output.ap1Temp == 1 or Output.ap2Temp == 1) { # Trip AP off if (Output.ap1Temp == 1 or Output.ap2Temp == 1) { # Trip AP off
if (abs(Controls.aileron.getValue()) >= 0.2 or abs(Controls.elevator.getValue()) >= 0.2 or abs(Controls.rudder.getValue()) >= 0.2) { if (abs(Controls.aileron.getValue()) >= 0.2 or abs(Controls.elevator.getValue()) >= 0.2 or abs(Controls.rudder.getValue()) >= 0.2 or abs(Controls.aileron2.getValue()) >= 0.2 or abs(Controls.elevator2.getValue()) >= 0.2 or abs(Controls.rudder2.getValue()) >= 0.2) {
fcu.apOff("hard", 0); fcu.apOff("hard", 0);
} }
} }

View file

@ -9,8 +9,10 @@
<property value="0">fbw/pitch/g-pi</property> <property value="0">fbw/pitch/g-pi</property>
<property value="0">fbw/pitch/pid</property> <property value="0">fbw/pitch/pid</property>
<property value="0">fbw/yaw/tc-pd</property> <property value="0">fbw/yaw/tc-pd</property>
<property value="0">fbw/spoiler-output</property>
<property value="1">fbw/mixer/sidestick-gain-feedback</property> <property value="1">fbw/mixer/sidestick-gain-feedback</property>
<property value="1">fbw/sidestick/active[0]</property>
<property value="1">fbw/sidestick/active[1]</property>
<property value="0">fbw/spoiler-output</property>
<!-- Default gains for tuning --> <!-- Default gains for tuning -->
<property value="0">fbw/roll/p-gain</property> <property value="0">fbw/roll/p-gain</property>
@ -238,6 +240,63 @@
</table> </table>
</function> </function>
</fcs_function> </fcs_function>
<fcs_function name="fbw/sidestick/roll-input">
<function>
<sum>
<product>
<property>/controls/flight/aileron[0]</property>
<property>fbw/sidestick/active[0]</property>
</product>
<product>
<property>/controls/flight/aileron[1]</property>
<property>fbw/sidestick/active[1]</property>
</product>
</sum>
</function>
<clipto>
<min>-1.0</min>
<max>1.0</max>
</clipto>
</fcs_function>
<fcs_function name="fbw/sidestick/pitch-input">
<function>
<sum>
<product>
<property>/controls/flight/elevator[0]</property>
<property>fbw/sidestick/active[0]</property>
</product>
<product>
<property>/controls/flight/elevator[1]</property>
<property>fbw/sidestick/active[1]</property>
</product>
</sum>
</function>
<clipto>
<min>-1.0</min>
<max>1.0</max>
</clipto>
</fcs_function>
<fcs_function name="fbw/sidestick/yaw-input">
<function>
<sum>
<product>
<property>/controls/flight/rudder[0]</property>
<property>fbw/sidestick/active[0]</property>
</product>
<product>
<property>/controls/flight/rudder[1]</property>
<property>fbw/sidestick/active[1]</property>
</product>
</sum>
</function>
<clipto>
<min>-1.0</min>
<max>1.0</max>
</clipto>
</fcs_function>
</channel> </channel>
@ -472,7 +531,7 @@
<channel name="FBW: Roll"> <channel name="FBW: Roll">
<switch name="fbw/roll/a-i-f"> <switch name="fbw/roll/a-i-f">
<default value="/controls/flight/aileron"/> <default value="fbw/sidestick/roll-input"/>
<test value="0"> <test value="0">
fbw/fmgc/enabled eq 1 fbw/fmgc/enabled eq 1
</test> </test>
@ -496,7 +555,7 @@
<fcs_function name="fbw/roll/aileron-nul"> <fcs_function name="fbw/roll/aileron-nul">
<function> <function>
<table> <table>
<independentVar lookup="row">/controls/flight/aileron</independentVar> <independentVar lookup="row">fbw/sidestick/roll-input</independentVar>
<tableData> <tableData>
-1.00 -1 -1.00 -1
-0.04 0 -0.04 0
@ -862,7 +921,7 @@
</switch> </switch>
<lag_filter name="fbw/aileron-sidestick"> <lag_filter name="fbw/aileron-sidestick">
<input>/controls/flight/aileron</input> <input>fbw/sidestick/roll-input</input>
<c1>20</c1> <c1>20</c1>
</lag_filter> </lag_filter>
@ -879,7 +938,7 @@
</switch> </switch>
<switch name="fbw/pitch/e-i-f"> <switch name="fbw/pitch/e-i-f">
<default value="/controls/flight/elevator"/> <default value="fbw/sidestick/pitch-input"/>
<test value="0"> <test value="0">
fbw/fmgc/enabled eq 1 fbw/fmgc/enabled eq 1
</test> </test>
@ -907,7 +966,7 @@
<fcs_function name="fbw/pitch/elevator-nul"> <fcs_function name="fbw/pitch/elevator-nul">
<function> <function>
<table> <table>
<independentVar lookup="row">/controls/flight/elevator</independentVar> <independentVar lookup="row">fbw/sidestick/pitch-input</independentVar>
<tableData> <tableData>
-1.00 -1 -1.00 -1
-0.04 0 -0.04 0
@ -1304,7 +1363,7 @@
</switch> </switch>
<lag_filter name="fbw/elevator-sidestick"> <lag_filter name="fbw/elevator-sidestick">
<input>/controls/flight/elevator</input> <input>fbw/sidestick/pitch-input</input>
<c1>20</c1> <c1>20</c1>
</lag_filter> </lag_filter>
@ -1527,7 +1586,7 @@
<fcs_function name="fbw/yaw/rudder-nul"> <fcs_function name="fbw/yaw/rudder-nul">
<function> <function>
<table> <table>
<independentVar lookup="row">/controls/flight/rudder</independentVar> <independentVar lookup="row">fbw/sidestick/yaw-input</independentVar>
<independentVar lookup="column">fbw/fmgc/enabled</independentVar> <independentVar lookup="column">fbw/fmgc/enabled</independentVar>
<tableData> <tableData>
0 1 0 1
@ -1647,7 +1706,7 @@
</switch> </switch>
<lag_filter name="fbw/rudder-pedal"> <lag_filter name="fbw/rudder-pedal">
<input>/controls/flight/rudder</input> <input>fbw/sidestick/yaw-input</input>
<c1>20</c1> <c1>20</c1>
</lag_filter> </lag_filter>

View file

@ -942,14 +942,14 @@
<channel name="Tiller"> <channel name="Tiller">
<switch name="/controls/gear/steering-switched"> <switch name="/controls/gear/steering-switched">
<default value="/controls/flight/rudder"/> <default value="fbw/sidestick/yaw-input"/>
<test value="0"> <test value="0">
/gear/gear[0]/wow ne 1 /gear/gear[0]/wow ne 1
</test> </test>
<test value="/controls/gear/steering"> <test value="/controls/gear/steering">
/systems/acconfig/options/seperate-tiller-axis eq 1 /systems/acconfig/options/seperate-tiller-axis eq 1
</test> </test>
<test value="/controls/flight/aileron"> <test value="fbw/sidestick/roll-input">
/controls/flight/aileron-drives-tiller eq 1 /controls/flight/aileron-drives-tiller eq 1
</test> </test>
</switch> </switch>
@ -1003,8 +1003,8 @@
</scheduled_gain> </scheduled_gain>
<switch name="hydraulics/tiller/rudder-cmd-input"> <switch name="hydraulics/tiller/rudder-cmd-input">
<default value="/controls/flight/rudder"/> <default value="fbw/sidestick/yaw-input"/>
<test value="/controls/flight/aileron"> <test value="fbw/sidestick/roll-input">
/controls/flight/aileron-drives-tiller eq 1 /controls/flight/aileron-drives-tiller eq 1
</test> </test>
</switch> </switch>