Added new implementation of the pushback
Signed-off-by: merspieler <merspieler@users.noreply.github.com>
This commit is contained in:
parent
d0a8057a38
commit
5f85d712aa
18 changed files with 839 additions and 61 deletions
|
@ -449,7 +449,6 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
|
||||||
</tank>
|
</tank>
|
||||||
</propulsion>
|
</propulsion>
|
||||||
|
|
||||||
<system file="pushback" />
|
|
||||||
<system file="electrical" />
|
<system file="electrical" />
|
||||||
<system file="fuel" />
|
<system file="fuel" />
|
||||||
<system file="glass-effect1" />
|
<system file="glass-effect1" />
|
||||||
|
|
|
@ -449,7 +449,6 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
|
||||||
</tank>
|
</tank>
|
||||||
</propulsion>
|
</propulsion>
|
||||||
|
|
||||||
<system file="pushback" />
|
|
||||||
<system file="fuel" />
|
<system file="fuel" />
|
||||||
<system file="electrical" />
|
<system file="electrical" />
|
||||||
<system file="glass-effect1" />
|
<system file="glass-effect1" />
|
||||||
|
|
|
@ -449,7 +449,6 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
|
||||||
</tank>
|
</tank>
|
||||||
</propulsion>
|
</propulsion>
|
||||||
|
|
||||||
<system file="pushback" />
|
|
||||||
<system file="electrical" />
|
<system file="electrical" />
|
||||||
<system file="fuel" />
|
<system file="fuel" />
|
||||||
<system file="glass-effect1" />
|
<system file="glass-effect1" />
|
||||||
|
|
|
@ -28,10 +28,27 @@
|
||||||
|
|
||||||
<model>
|
<model>
|
||||||
<pushback>
|
<pushback>
|
||||||
<kp type="double">5000</kp>
|
<enabled type="int"/>
|
||||||
<ki type="double">200</ki>
|
<available type="int">1</available>
|
||||||
<kd type="double">500</kd>
|
<yaw-deg alias="/fdm/jsbsim/fcs/steer-deg"/>
|
||||||
<position-norm type="double">0</position-norm>
|
<target-speed-km_h type="float">0.0</target-speed-km_h>
|
||||||
|
<K_p type="float">5000.0</K_p>
|
||||||
|
<K_i type="float">200.0</K_i>
|
||||||
|
<F_i type="float">25000.0</F_i>
|
||||||
|
<K_d type="float">500.0</K_d>
|
||||||
|
<driver>
|
||||||
|
<tow-distance-m type="float">-60.0</tow-distance-m>
|
||||||
|
<face-heading-deg type="float">0.0</face-heading-deg>
|
||||||
|
<steer-cmd-norm alias="/controls/flight/rudder"/>
|
||||||
|
<K_V_push type="float">5.0</K_V_push>
|
||||||
|
<F_V_push type="float">5.0</F_V_push>
|
||||||
|
<S_min-m type="float">5.0</S_min-m>
|
||||||
|
<K_psi_push type="float">0.05</K_psi_push>
|
||||||
|
<K_V_turn type="float">1.4</K_V_turn>
|
||||||
|
<F_V_turn type="float">7.0</F_V_turn>
|
||||||
|
<K_psi_turn type="float">0.2</K_psi_turn>
|
||||||
|
<V_min type="float">2.5</V_min>
|
||||||
|
</driver>
|
||||||
</pushback>
|
</pushback>
|
||||||
<icing>
|
<icing>
|
||||||
<iceable>
|
<iceable>
|
||||||
|
@ -231,7 +248,7 @@
|
||||||
<label>Pushback</label>
|
<label>Pushback</label>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-show</command>
|
<command>dialog-show</command>
|
||||||
<dialog-name>pushback</dialog-name>
|
<dialog-name>autopush</dialog-name>
|
||||||
</binding>
|
</binding>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -1455,6 +1472,22 @@
|
||||||
<icing>
|
<icing>
|
||||||
<file>Aircraft/IDG-A32X/Nasal/icing.nas</file>
|
<file>Aircraft/IDG-A32X/Nasal/icing.nas</file>
|
||||||
</icing>
|
</icing>
|
||||||
|
<autopush>
|
||||||
|
<file>Nasal/autopush.nas</file>
|
||||||
|
</autopush>
|
||||||
|
<autopush_driver>
|
||||||
|
<file>Nasal/autopush_driver.nas</file>
|
||||||
|
</autopush_driver>
|
||||||
</nasal>
|
</nasal>
|
||||||
|
<fdm>
|
||||||
|
<jsbsim>
|
||||||
|
<external_reactions>
|
||||||
|
<pushback>
|
||||||
|
<magnitude alias="/sim/model/pushback/force-lbf"/>
|
||||||
|
<x alias="/sim/model/pushback/force-x"/>
|
||||||
|
<y alias="/sim/model/pushback/force-y"/>
|
||||||
|
</pushback>
|
||||||
|
</external_reactions>
|
||||||
|
</jsbsim>
|
||||||
|
</fdm>
|
||||||
</PropertyList>
|
</PropertyList>
|
||||||
|
|
|
@ -449,7 +449,6 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
|
||||||
</tank>
|
</tank>
|
||||||
</propulsion>
|
</propulsion>
|
||||||
|
|
||||||
<system file="pushback" />
|
|
||||||
<system file="electrical" />
|
<system file="electrical" />
|
||||||
<system file="fuel" />
|
<system file="fuel" />
|
||||||
<system file="glass-effect1" />
|
<system file="glass-effect1" />
|
||||||
|
|
|
@ -449,7 +449,6 @@ xsi:noNamespaceSchemaLocation="http://jsbsim.sourceforge.net/JSBSim.xsd">
|
||||||
</tank>
|
</tank>
|
||||||
</propulsion>
|
</propulsion>
|
||||||
|
|
||||||
<system file="pushback" />
|
|
||||||
<system file="electrical" />
|
<system file="electrical" />
|
||||||
<system file="fuel" />
|
<system file="fuel" />
|
||||||
<system file="glass-effect1" />
|
<system file="glass-effect1" />
|
||||||
|
|
|
@ -316,7 +316,7 @@
|
||||||
<!-- Other non-aircraft models -->
|
<!-- Other non-aircraft models -->
|
||||||
<model>
|
<model>
|
||||||
<name>Pushback</name>
|
<name>Pushback</name>
|
||||||
<path>Models/Airport/Pushback/Goldhofert.xml</path>
|
<path>Models/Goldhofert-autopush.xml</path>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>5.55</x-m>
|
<x-m>5.55</x-m>
|
||||||
<y-m>0</y-m>
|
<y-m>0</y-m>
|
||||||
|
|
|
@ -348,7 +348,7 @@
|
||||||
<!-- Other non-aircraft models -->
|
<!-- Other non-aircraft models -->
|
||||||
<model>
|
<model>
|
||||||
<name>Pushback</name>
|
<name>Pushback</name>
|
||||||
<path>Models/Airport/Pushback/Goldhofert.xml</path>
|
<path>Models/Goldhofert-autopush.xml</path>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>5.55</x-m>
|
<x-m>5.55</x-m>
|
||||||
<y-m>0</y-m>
|
<y-m>0</y-m>
|
||||||
|
|
|
@ -344,7 +344,7 @@
|
||||||
<!-- Other non-aircraft models -->
|
<!-- Other non-aircraft models -->
|
||||||
<model>
|
<model>
|
||||||
<name>Pushback</name>
|
<name>Pushback</name>
|
||||||
<path>Models/Airport/Pushback/Goldhofert.xml</path>
|
<path>Models/Goldhofert-autopush.xml</path>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>5.55</x-m>
|
<x-m>5.55</x-m>
|
||||||
<y-m>0</y-m>
|
<y-m>0</y-m>
|
||||||
|
|
|
@ -325,7 +325,7 @@
|
||||||
<!-- Other non-aircraft models -->
|
<!-- Other non-aircraft models -->
|
||||||
<model>
|
<model>
|
||||||
<name>Pushback</name>
|
<name>Pushback</name>
|
||||||
<path>Models/Airport/Pushback/Goldhofert.xml</path>
|
<path>Models/Goldhofert-autopush.xml</path>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>5.55</x-m>
|
<x-m>5.55</x-m>
|
||||||
<y-m>0</y-m>
|
<y-m>0</y-m>
|
||||||
|
|
|
@ -325,7 +325,7 @@
|
||||||
<!-- Other non-aircraft models -->
|
<!-- Other non-aircraft models -->
|
||||||
<model>
|
<model>
|
||||||
<name>Pushback</name>
|
<name>Pushback</name>
|
||||||
<path>Models/Airport/Pushback/Goldhofert.xml</path>
|
<path>Models/Goldhofert-autopush.xml</path>
|
||||||
<offsets>
|
<offsets>
|
||||||
<x-m>5.55</x-m>
|
<x-m>5.55</x-m>
|
||||||
<y-m>0</y-m>
|
<y-m>0</y-m>
|
||||||
|
|
130
Models/Goldhofert-autopush.xml
Normal file
130
Models/Goldhofert-autopush.xml
Normal file
|
@ -0,0 +1,130 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
AUTOPUSH
|
||||||
|
|
||||||
|
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
|
||||||
|
Original code (c) FlightGear
|
||||||
|
Distribute under the terms of GPLv2.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<PropertyList>
|
||||||
|
<path>Models/Airport/Pushback/Goldhofert.ac</path>
|
||||||
|
|
||||||
|
<!-- Trucks models and artworks courtesy of XPGoodWay Team
|
||||||
|
(http://www.xpgoodwayteam.org/site_xpushback/) -->
|
||||||
|
|
||||||
|
<model>
|
||||||
|
<path>Models/Airport/Pushback/Goldhofert-warning-light.xml</path>
|
||||||
|
<offsets>
|
||||||
|
<x-m>-2.908</x-m>
|
||||||
|
<y-m>0.260</y-m>
|
||||||
|
<z-m>1.326</z-m>
|
||||||
|
<heading-deg>0</heading-deg>
|
||||||
|
</offsets>
|
||||||
|
</model>
|
||||||
|
|
||||||
|
<model>
|
||||||
|
<path>Models/Airport/Pushback/Goldhofert-warning-light.xml</path>
|
||||||
|
<offsets>
|
||||||
|
<x-m>-1.781</x-m>
|
||||||
|
<y-m>0.260</y-m>
|
||||||
|
<z-m>1.326</z-m>
|
||||||
|
<heading-deg>90</heading-deg>
|
||||||
|
</offsets>
|
||||||
|
</model>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>spin</type>
|
||||||
|
<object-name>wheelfl</object-name>
|
||||||
|
<object-name>wheelfr</object-name>
|
||||||
|
<!-- SETTING The aircraft's front wheel rollspeed in m/s. -->
|
||||||
|
<property>gear/gear[0]/rollspeed-ms</property>
|
||||||
|
<factor>-16.3</factor>
|
||||||
|
<center>
|
||||||
|
<x-m>-2.8976</x-m>
|
||||||
|
<y-m>0</y-m>
|
||||||
|
<z-m>0.5809</z-m>
|
||||||
|
</center>
|
||||||
|
<axis>
|
||||||
|
<x>0</x>
|
||||||
|
<y>1</y>
|
||||||
|
<z>0</z>
|
||||||
|
</axis>
|
||||||
|
</animation>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>spin</type>
|
||||||
|
<object-name>wheelrl</object-name>
|
||||||
|
<object-name>wheelrr</object-name>
|
||||||
|
<!-- SETTING The aircraft's front wheel rollspeed in m/s. -->
|
||||||
|
<property>gear/gear[0]/rollspeed-ms</property>
|
||||||
|
<factor>-16.3</factor>
|
||||||
|
<center>
|
||||||
|
<x-m>2.0501</x-m>
|
||||||
|
<y-m>0</y-m>
|
||||||
|
<z-m>0.5735</z-m>
|
||||||
|
</center>
|
||||||
|
<axis>
|
||||||
|
<x>0</x>
|
||||||
|
<y>1</y>
|
||||||
|
<z>0</z>
|
||||||
|
</axis>
|
||||||
|
</animation>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>select</type>
|
||||||
|
<condition>
|
||||||
|
<!-- SETTING Whether connected. -->
|
||||||
|
<property>sim/model/pushback/connected</property>
|
||||||
|
</condition>
|
||||||
|
</animation>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>rotate</type>
|
||||||
|
<!-- SETTING Normalized steering. -->
|
||||||
|
<property>gear/gear/steering-norm</property>
|
||||||
|
<!-- SETTING Max steering. -->
|
||||||
|
<factor>70.0</factor>
|
||||||
|
<center>
|
||||||
|
<x-m>0</x-m>
|
||||||
|
<y-m>0</y-m>
|
||||||
|
<z-m>0</z-m>
|
||||||
|
</center>
|
||||||
|
<axis>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<z>-1</z>
|
||||||
|
</axis>
|
||||||
|
</animation>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>translate</type>
|
||||||
|
<!-- SETTING Gear compression. -->
|
||||||
|
<property>gear/gear[0]/compression-ft</property>
|
||||||
|
<factor>0.3048</factor>
|
||||||
|
<axis>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<z>1</z>
|
||||||
|
</axis>
|
||||||
|
</animation>
|
||||||
|
|
||||||
|
<animation>
|
||||||
|
<type>rotate</type>
|
||||||
|
<!-- SETTING Aircraft pitch. -->
|
||||||
|
<property>orientation/pitch-deg</property>
|
||||||
|
<!-- SETTING Average ground pitch. -->
|
||||||
|
<offset-deg>2.0</offset-deg>
|
||||||
|
<center>
|
||||||
|
<x-m>0</x-m>
|
||||||
|
<y-m>0</y-m>
|
||||||
|
<z-m>0</z-m>
|
||||||
|
</center>
|
||||||
|
<axis>
|
||||||
|
<x>0</x>
|
||||||
|
<y>1</y>
|
||||||
|
<z>0</z>
|
||||||
|
</axis>
|
||||||
|
</animation>
|
||||||
|
</PropertyList>
|
117
Nasal/autopush-README.txt
Normal file
117
Nasal/autopush-README.txt
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
AUTOMATIC PUSHBACK FOR FLIGHTGEAR
|
||||||
|
Version 0.1.1
|
||||||
|
|
||||||
|
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
|
||||||
|
Some of the code (c) FlightGear
|
||||||
|
Distribute under the terms of GPLv2.
|
||||||
|
|
||||||
|
|
||||||
|
FILES
|
||||||
|
|
||||||
|
Nasal/autopush-README.txt this file
|
||||||
|
Models/Goldhofert-autopush.xml the animation for FGDATA's Goldhofer
|
||||||
|
Nasal/autopush.nas basic pushback logic
|
||||||
|
Nasal/autopush_driver.nas pushback driver
|
||||||
|
gui/dialogs/autopush.xml GUI dialog
|
||||||
|
|
||||||
|
|
||||||
|
INSTALLATION
|
||||||
|
|
||||||
|
Only the minimal working example is covered here. Later you will have
|
||||||
|
to implement correct steering in your FDM (driving the
|
||||||
|
"/sim/model/pushback/yaw-deg") and pushback availability
|
||||||
|
("/sim/model/pushback/available") -- because those are too
|
||||||
|
aircraft-specific.
|
||||||
|
|
||||||
|
1. Set up the pushback logic. Add the following tags in your set.xml.
|
||||||
|
Replace the "/fdm/jsbsim/gear/unit[0]/steering/pos-deg" with the
|
||||||
|
property for the front wheel steering degrees of your aircraft.
|
||||||
|
|
||||||
|
Under <sim><model>:
|
||||||
|
|
||||||
|
<pushback>
|
||||||
|
<enabled type="int"/>
|
||||||
|
<available type="int">1</available>
|
||||||
|
<yaw-deg alias="/fdm/jsbsim/gear/unit[0]/steering/pos-deg"/>
|
||||||
|
<target-speed-km_h type="float">0.0</target-speed-km_h>
|
||||||
|
<K_p type="float">100.0</K_p>
|
||||||
|
<K_i type="float">25.0</K_i>
|
||||||
|
<F_i type="float">25000.0</F_i>
|
||||||
|
<K_d type="float">0.0</K_d>
|
||||||
|
<driver>
|
||||||
|
<tow-distance-m type="float">-60.0</tow-distance-m>
|
||||||
|
<face-heading-deg type="float">0.0</face-heading-deg>
|
||||||
|
<steer-cmd-norm alias="/controls/flight/rudder"/>
|
||||||
|
<K_V_push type="float">10.0</K_V_push>
|
||||||
|
<F_V_push type="float">10.0</F_V_push>
|
||||||
|
<S_min-m type="float">5.0</S_min-m>
|
||||||
|
<K_psi_push type="float">0.05</K_psi_push>
|
||||||
|
<K_V_turn type="float">1.4</K_V_turn>
|
||||||
|
<F_V_turn type="float">7.0</F_V_turn>
|
||||||
|
<K_psi_turn type="float">0.2</K_psi_turn>
|
||||||
|
<V_min type="float">2.5</V_min>
|
||||||
|
</driver>
|
||||||
|
</pushback>
|
||||||
|
|
||||||
|
Under <nasal>:
|
||||||
|
|
||||||
|
<autopush>
|
||||||
|
<file>Nasal/autopush.nas</file>
|
||||||
|
</autopush>
|
||||||
|
<autopush_driver>
|
||||||
|
<file>Nasal/autopush_driver.nas</file>
|
||||||
|
</autopush_driver>
|
||||||
|
|
||||||
|
2. Connect the FDM's external force.
|
||||||
|
|
||||||
|
a) JSBSim:
|
||||||
|
|
||||||
|
a.1. Add the following under <external_reactions> of your
|
||||||
|
JSBSim XML. Change the coordinates under <location> to equal
|
||||||
|
those of your front bogey.
|
||||||
|
|
||||||
|
<force name="tractor" frame="BODY">
|
||||||
|
<location unit="M">
|
||||||
|
<x>0.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</location>
|
||||||
|
<direction>
|
||||||
|
<x>1.0</x>
|
||||||
|
<y>0.0</y>
|
||||||
|
<z>0.0</z>
|
||||||
|
</direction>
|
||||||
|
</force>
|
||||||
|
|
||||||
|
a.2. Add the following under <fdm><jsbsim><external_reactions> of
|
||||||
|
your set.xml.
|
||||||
|
|
||||||
|
<tractor>
|
||||||
|
<magnitude alias="/sim/model/pushback/force-lbf"/>
|
||||||
|
<x alias="/sim/model/pushback/force-x"/>
|
||||||
|
<y alias="/sim/model/pushback/force-y"/>
|
||||||
|
</tractor>
|
||||||
|
|
||||||
|
b) YASim: TODO
|
||||||
|
|
||||||
|
3. Copy the gui/dialogs/autopush.xml from the distribution to your
|
||||||
|
aircraft's gui/dialogs directory. Add it to the menu (see
|
||||||
|
FlightGear documentation for editing the menu).
|
||||||
|
|
||||||
|
4. Copy the Models/Goldhofert-autopush.xml to your aircraft's Models/
|
||||||
|
directory. Edit all the places marked by "SETTING" to match your
|
||||||
|
setup. Include it in your Model XML, with offsets equal to the
|
||||||
|
front wheel's contact point.
|
||||||
|
|
||||||
|
5. Add the following in your Model XML. Change the coordinates under
|
||||||
|
<offsets> to equal those of your front bogey.
|
||||||
|
|
||||||
|
<model>
|
||||||
|
<name>Pushback</name>
|
||||||
|
<path>Models/Airport/Pushback/Goldhofert-autopush.xml</path>
|
||||||
|
<offsets>
|
||||||
|
<x-m>0.0</x-m>
|
||||||
|
<y-m>0.0</y-m>
|
||||||
|
<z-m>0.0</z-m>
|
||||||
|
</offsets>
|
||||||
|
</model>
|
76
Nasal/autopush.nas
Normal file
76
Nasal/autopush.nas
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
# AUTOPUSH
|
||||||
|
# Basic pushback logic class.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
|
||||||
|
# Distribute under the terms of GPLv2.
|
||||||
|
|
||||||
|
|
||||||
|
var _K_p = nil;
|
||||||
|
var _K_i = nil;
|
||||||
|
var _K_d = nil;
|
||||||
|
var _F_i = nil;
|
||||||
|
var _int = nil;
|
||||||
|
var _deltaV_old = nil;
|
||||||
|
var _t_old = nil;
|
||||||
|
|
||||||
|
var loop = func() {
|
||||||
|
if(!getprop("/sim/model/pushback/available")){
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var force = 0.0;
|
||||||
|
# Rollspeed is only adequate if the wheel is touching the ground.
|
||||||
|
if(getprop("/gear/gear[0]/wow")){
|
||||||
|
var deltaV =
|
||||||
|
getprop("/sim/model/pushback/target-speed-km_h") -
|
||||||
|
getprop("/gear/gear[0]/rollspeed-ms") * 3.6;
|
||||||
|
var dV = deltaV - _deltaV_old;
|
||||||
|
var t = getprop("/sim/time/elapsed-sec");
|
||||||
|
var dt = math.max(t - _t_old, 0.0001);
|
||||||
|
_int = math.min(math.max(_int + dV * dt, -_F_i), _F_i);
|
||||||
|
force = (_K_p * deltaV + _K_d * dV / dt + _K_i * _int) * KG2LB;
|
||||||
|
_deltaV_old = deltaV;
|
||||||
|
_t_old = t;
|
||||||
|
var yaw = getprop("/sim/model/pushback/yaw-deg") * D2R;
|
||||||
|
setprop("/sim/model/pushback/force-x", math.cos(yaw));
|
||||||
|
setprop("/sim/model/pushback/force-y", math.sin(yaw));
|
||||||
|
}
|
||||||
|
setprop("/sim/model/pushback/force-lbf", force);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timer = maketimer(0.026, func{loop()});
|
||||||
|
|
||||||
|
var start = func() {
|
||||||
|
_K_p = getprop("/sim/model/pushback/K_p");
|
||||||
|
_K_i = getprop("/sim/model/pushback/K_i");
|
||||||
|
_K_d = getprop("/sim/model/pushback/K_d");
|
||||||
|
_F_i = getprop("/sim/model/pushback/F_i");
|
||||||
|
_int = 0.0;
|
||||||
|
_deltaV_old = 0.0;
|
||||||
|
_t_old = getprop("/sim/time/elapsed-sec");
|
||||||
|
setprop("/sim/model/pushback/connected", 1);
|
||||||
|
if(!timer.isRunning){
|
||||||
|
screen.log.write("(pushback): Release brakes.");
|
||||||
|
}
|
||||||
|
timer.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
var stop = func() {
|
||||||
|
if(timer.isRunning){
|
||||||
|
screen.log.write("(pushback): Pushback disconnected, bypass pin removed.");
|
||||||
|
}
|
||||||
|
timer.stop();
|
||||||
|
setprop("/sim/model/pushback/force-lbf", 0.0);
|
||||||
|
setprop("/sim/model/pushback/connected", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
var toggle = func(){
|
||||||
|
if(
|
||||||
|
getprop("/sim/model/pushback/enabled") *
|
||||||
|
getprop("/sim/model/pushback/available")
|
||||||
|
){
|
||||||
|
start();
|
||||||
|
}else{
|
||||||
|
stop();
|
||||||
|
}
|
||||||
|
}
|
113
Nasal/autopush_driver.nas
Normal file
113
Nasal/autopush_driver.nas
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
# AUTOPUSH
|
||||||
|
# Pushback driver class.
|
||||||
|
#
|
||||||
|
# Command the pushback to tow/push the aircract facing set heading.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
|
||||||
|
# Distribute under the terms of GPLv2.
|
||||||
|
|
||||||
|
|
||||||
|
# FIXME When facing, acccount for current steering position, to work without dry steering.
|
||||||
|
|
||||||
|
|
||||||
|
var _K_V_push = nil;
|
||||||
|
var _F_V_push = nil;
|
||||||
|
var _S_min = nil;
|
||||||
|
var _K_psi_push = nil;
|
||||||
|
var _K_V_turn = nil;
|
||||||
|
var _F_V_turn = nil;
|
||||||
|
var _K_psi_turn = nil;
|
||||||
|
var _V_min = nil;
|
||||||
|
|
||||||
|
var _turning = nil;
|
||||||
|
var _sign = nil;
|
||||||
|
var _target = nil;
|
||||||
|
var _psi_parking = nil;
|
||||||
|
var _psi_turn = nil;
|
||||||
|
|
||||||
|
var loop = func() {
|
||||||
|
if(!getprop("/sim/model/pushback/connected")){
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var V = 0.0;
|
||||||
|
var steering = 0.0;
|
||||||
|
var deltapsi = 0.0;
|
||||||
|
var psi = getprop("/orientation/heading-deg");
|
||||||
|
if(!_turning){
|
||||||
|
# Initially follow a straight line parallel to our initial heading.
|
||||||
|
var (A, S) = courseAndDistance(_target);
|
||||||
|
S *= NM2M;
|
||||||
|
# Stop when the bearing flips, guarante against infinite pushing.
|
||||||
|
if(
|
||||||
|
(abs(S) < _S_min) +
|
||||||
|
(abs(saw180(_psi_parking - A - math.min(_sign, 0.0) * 180.0) > 90.0))
|
||||||
|
){
|
||||||
|
_turning = 1;
|
||||||
|
screen.log.write("(pushback): Turning to face heading " ~ int(_psi_turn) ~ ".");
|
||||||
|
}
|
||||||
|
deltapsi = saw180(_psi_parking - psi);
|
||||||
|
V = math.min(math.max(_K_V_push * _sign * (S / _S_min), -_F_V_push), _F_V_push);
|
||||||
|
steering = math.min(math.max(_K_psi_push * _sign * deltapsi, -1.0), 1.0);
|
||||||
|
}else{
|
||||||
|
# Turn (almost) in place.
|
||||||
|
deltapsi = saw180(_psi_turn - psi);
|
||||||
|
V = math.min(math.max(_K_V_turn * _sign * abs(deltapsi), -_F_V_turn), _F_V_turn);
|
||||||
|
# We are done when the heading error is small.
|
||||||
|
if(abs(V) < _V_min){
|
||||||
|
stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
steering = math.min(math.max(_K_psi_turn * _sign * deltapsi, -1.0), 1.0);
|
||||||
|
}
|
||||||
|
setprop("/sim/model/pushback/target-speed-km_h", V);
|
||||||
|
setprop("/sim/model/pushback/driver/steer-cmd-norm", steering);
|
||||||
|
}
|
||||||
|
|
||||||
|
var timer = maketimer(0.051, func{loop()});
|
||||||
|
|
||||||
|
var start = func() {
|
||||||
|
_K_V_push = getprop("/sim/model/pushback/driver/K_V_push");
|
||||||
|
_F_V_push = getprop("/sim/model/pushback/driver/F_V_push");
|
||||||
|
_S_min = getprop("/sim/model/pushback/driver/S_min-m");
|
||||||
|
_K_psi_push = getprop("/sim/model/pushback/driver/K_psi_push");
|
||||||
|
_K_V_turn = getprop("/sim/model/pushback/driver/K_V_turn");
|
||||||
|
_F_V_turn = getprop("/sim/model/pushback/driver/F_V_turn");
|
||||||
|
_K_psi_turn = getprop("/sim/model/pushback/driver/K_psi_turn");
|
||||||
|
_V_min = getprop("/sim/model/pushback/driver/V_min");
|
||||||
|
if(!getprop("/sim/model/pushback/connected")){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
towdist = getprop("/sim/model/pushback/driver/tow-distance-m");
|
||||||
|
_target = geo.aircraft_position();
|
||||||
|
_psi_parking = getprop("/orientation/heading-deg");
|
||||||
|
_target.apply_course_distance(_psi_parking, towdist);
|
||||||
|
_psi_turn = getprop("/sim/model/pushback/driver/face-heading-deg");
|
||||||
|
_sign = 1.0 - 2.0 * (towdist < 0.0);
|
||||||
|
_turning = 0;
|
||||||
|
timer.start();
|
||||||
|
if(_sign < 0.0){
|
||||||
|
screen.log.write("(pushback): Pushing back.");
|
||||||
|
}else{
|
||||||
|
screen.log.write("(pushback): Towing.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var stop = func() {
|
||||||
|
if(timer.isRunning){
|
||||||
|
screen.log.write("(pushback): Done.");
|
||||||
|
}
|
||||||
|
timer.stop();
|
||||||
|
setprop("/sim/model/pushback/target-speed-km_h", 0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Sawtooth: -180..+180 deg.
|
||||||
|
var saw180 = func(p) {
|
||||||
|
while (p <= -180.0){
|
||||||
|
p += 360.0;
|
||||||
|
}
|
||||||
|
while (p > 180.0){
|
||||||
|
p -= 360.0;
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
|
@ -1,45 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8' ?>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
##############################################
|
|
||||||
# Copyright (c) Joshua Davidson (it0uchpods) #
|
|
||||||
##############################################
|
|
||||||
-->
|
|
||||||
|
|
||||||
<system name="pushback">
|
|
||||||
<property>/sim/model/pushback/target-speed-fps</property>
|
|
||||||
<channel name="Pushback">
|
|
||||||
|
|
||||||
<switch name="systems/pushback/linked">
|
|
||||||
<default value="-1"/>
|
|
||||||
<test value="0">
|
|
||||||
/sim/model/pushback/position-norm gt 0.95
|
|
||||||
/gear/gear/wow == 1
|
|
||||||
gear/unit[0]/wheel-speed-fps lt 50
|
|
||||||
</test>
|
|
||||||
</switch>
|
|
||||||
|
|
||||||
<summer name="systems/pushback/speed-error">
|
|
||||||
<input>/sim/model/pushback/target-speed-fps</input>
|
|
||||||
<input>-gear/unit[0]/wheel-speed-fps</input>
|
|
||||||
</summer>
|
|
||||||
|
|
||||||
<pid name="systems/pushback/force">
|
|
||||||
<input>systems/pushback/speed-error</input>
|
|
||||||
<kp>/sim/model/pushback/kp</kp>
|
|
||||||
<ki>/sim/model/pushback/ki</ki>
|
|
||||||
<kd>/sim/model/pushback/kd</kd>
|
|
||||||
<trigger>systems/pushback/linked</trigger>
|
|
||||||
<output>/sim/model/pushback/force</output>
|
|
||||||
</pid>
|
|
||||||
|
|
||||||
<switch name="systems/pushback/force-output">
|
|
||||||
<default value="0"/>
|
|
||||||
<test value="systems/pushback/force">
|
|
||||||
systems/pushback/linked == 0
|
|
||||||
</test>
|
|
||||||
<output>external_reactions/pushback/magnitude</output>
|
|
||||||
</switch>
|
|
||||||
|
|
||||||
</channel>
|
|
||||||
</system>
|
|
158
gui/dialogs/autopush.xml
Normal file
158
gui/dialogs/autopush.xml
Normal file
|
@ -0,0 +1,158 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!--
|
||||||
|
|
||||||
|
AUTOPUSH
|
||||||
|
Pushback dialog.
|
||||||
|
|
||||||
|
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
|
||||||
|
Original code (c) FlightGear
|
||||||
|
Distribute under the terms of GPLv2.
|
||||||
|
|
||||||
|
-->
|
||||||
|
<PropertyList>
|
||||||
|
|
||||||
|
<name>autopush</name>
|
||||||
|
<layout>vbox</layout>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Pushback</label>
|
||||||
|
</text>
|
||||||
|
<empty>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
</empty>
|
||||||
|
<button>
|
||||||
|
<legend/>
|
||||||
|
<key>Esc</key>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<pref-height>16</pref-height>
|
||||||
|
<border>2</border>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-close</command>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<hrule/>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
<layout>vbox</layout>
|
||||||
|
<halign>center</halign>
|
||||||
|
<valign>top</valign>
|
||||||
|
|
||||||
|
<checkbox>
|
||||||
|
<halign>left</halign>
|
||||||
|
<label>Connect</label>
|
||||||
|
<property>/sim/model/pushback/enabled</property>
|
||||||
|
<binding><command>dialog-apply</command></binding>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>autopush.toggle();</script>
|
||||||
|
</binding>
|
||||||
|
</checkbox>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Speed:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>-15</min>
|
||||||
|
<max>15</max>
|
||||||
|
<property>/sim/model/pushback/target-speed-km_h</property>
|
||||||
|
<live>true</live>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/sim/model/pushback/target-speed-km_h</property>
|
||||||
|
<format>%3.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
<label> km/h</label>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<hrule/>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Distance:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>-100</min>
|
||||||
|
<max>100</max>
|
||||||
|
<property>/sim/model/pushback/driver/tow-distance-m</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/sim/model/pushback/driver/tow-distance-m</property>
|
||||||
|
<format>%4.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
<label> m</label>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Facing:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>0</min>
|
||||||
|
<max>360</max>
|
||||||
|
<property>/sim/model/pushback/driver/face-heading-deg</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/sim/model/pushback/driver/face-heading-deg</property>
|
||||||
|
<format>%3.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<button>
|
||||||
|
<legend>Tow / push back</legend>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
autopush_driver.start();
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
<button>
|
||||||
|
<legend>Stop</legend>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
autopush_driver.stop();
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</PropertyList>
|
201
gui/dialogs/pushback.xml
Normal file
201
gui/dialogs/pushback.xml
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<PropertyList>
|
||||||
|
|
||||||
|
<name>pushback</name>
|
||||||
|
<layout>vbox</layout>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Uncomment for default FG pushback.
|
||||||
|
-->
|
||||||
|
<nasal>
|
||||||
|
<open>
|
||||||
|
var pushback_position = aircraft.door.new("sim/model/pushback", 10.0);
|
||||||
|
pushback_position.setpos(pushback_position.getpos());
|
||||||
|
props.globals.getNode("/sim/model/pushback/enabled", 1 ).setBoolValue(1);
|
||||||
|
props.globals.initNode("/sim/model/pushback/target-speed-fps", 0.0 );
|
||||||
|
</open>
|
||||||
|
<close>
|
||||||
|
pushback_position.setpos(0);
|
||||||
|
setprop("/sim/model/pushback/enabled", 0 );
|
||||||
|
setprop("/sim/model/pushback/target-speed-fps", 0 );
|
||||||
|
setprop("/sim/model/pushback/force", 0);
|
||||||
|
</close>
|
||||||
|
</nasal>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Pushback</label>
|
||||||
|
</text>
|
||||||
|
<empty>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
</empty>
|
||||||
|
<button>
|
||||||
|
<legend/>
|
||||||
|
<key>Esc</key>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<pref-height>16</pref-height>
|
||||||
|
<border>2</border>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-close</command>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<hrule/>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
<layout>vbox</layout>
|
||||||
|
<halign>center</halign>
|
||||||
|
<valign>top</valign>
|
||||||
|
|
||||||
|
<checkbox>
|
||||||
|
<halign>left</halign>
|
||||||
|
<label>Connect</label>
|
||||||
|
<!-- Uncomment for Tu-144 pushback.
|
||||||
|
<property>/sim/model/pushback/enabled</property>
|
||||||
|
<binding><command>dialog-apply</command></binding>
|
||||||
|
-->
|
||||||
|
<!-- Uncomment for default FG pushback.
|
||||||
|
-->
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>pushback_position.toggle();</script>
|
||||||
|
</binding>
|
||||||
|
</checkbox>
|
||||||
|
|
||||||
|
<!-- Uncomment for Tu-144 pushback.
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Speed:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>-15</min>
|
||||||
|
<max>15</max>
|
||||||
|
<property>/sim/model/pushback/target-speed-km_h</property>
|
||||||
|
<live>true</live>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/sim/model/pushback/target-speed-km_h</property>
|
||||||
|
<format>%3.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
<label> km/h</label>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- Uncomment for default FG pushback.
|
||||||
|
-->
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Speed:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>-25</min>
|
||||||
|
<max>25</max>
|
||||||
|
<property>/sim/model/pushback/target-speed-fps</property>
|
||||||
|
<live>true</live>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/sim/model/pushback/target-speed-fps</property>
|
||||||
|
<format>%3.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
<label> fps</label>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<hrule/>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Distance:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>-100</min>
|
||||||
|
<max>100</max>
|
||||||
|
<property>/nasal/pushback_driver/tow-distance-m</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/nasal/pushback_driver/tow-distance-m</property>
|
||||||
|
<format>%4.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
<text>
|
||||||
|
<label> m</label>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<text>
|
||||||
|
<label>Facing:</label>
|
||||||
|
</text>
|
||||||
|
<slider>
|
||||||
|
<row>0</row>
|
||||||
|
<col>2</col>
|
||||||
|
<min>0</min>
|
||||||
|
<max>360</max>
|
||||||
|
<property>/nasal/pushback_driver/face-heading-deg</property>
|
||||||
|
<binding>
|
||||||
|
<command>dialog-apply</command>
|
||||||
|
</binding>
|
||||||
|
</slider>
|
||||||
|
<text>
|
||||||
|
<pref-width>16</pref-width>
|
||||||
|
<property>/nasal/pushback_driver/face-heading-deg</property>
|
||||||
|
<format>%3.0f</format>
|
||||||
|
<live>true</live>
|
||||||
|
</text>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
<group>
|
||||||
|
<layout>hbox</layout>
|
||||||
|
<button>
|
||||||
|
<legend>Tow / push back</legend>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
pushback_driver.start();
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
<button>
|
||||||
|
<legend>Stop</legend>
|
||||||
|
<binding>
|
||||||
|
<command>nasal</command>
|
||||||
|
<script>
|
||||||
|
pushback_driver.stop();
|
||||||
|
</script>
|
||||||
|
</binding>
|
||||||
|
</button>
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</PropertyList>
|
Reference in a new issue