Merge branch 'autopush' of github.com:merspieler/IDG-A32X into autopush-chk

This commit is contained in:
Joshua Davidson 2018-08-24 08:45:49 -04:00
commit cc1622c33b
17 changed files with 2097 additions and 96 deletions

View file

@ -28,10 +28,31 @@
<model>
<pushback>
<kp type="double">5000</kp>
<ki type="double">200</ki>
<kd type="double">500</kd>
<position-norm type="double">0</position-norm>
<position-norm>0</position-norm>
<enabled type="int"/>
<available type="int">1</available>
<chocks alias="/controls/gear/wheel-chocks"/>
<steer-cmd-norm alias="/controls/flight/rudder"/>
<yaw alias="/gear/gear[0]/steering-norm"/>
<yaw-mult type="float">1.0</yaw-mult>
<target-speed-km_h type="float">0.0</target-speed-km_h>
<K_p type="float">1.0</K_p>
<F_p type="float">0.1</F_p>
<K_i type="float">0.01</K_i>
<F_i type="float">2.0</F_i>
<K_d type="float">0.0</K_d>
<F_d type="float">0.0</F_d>
<driver>
<K_V type="float">5.5</K_V>
<F_V type="float">5.5</F_V>
<D_min-m type="float">5.0</D_min-m>
<K_psi type="float">0.03</K_psi>
<debug type="bool">true</debug>
</driver>
<route>
<show type="bool"/>
<view type="string">Model View</view>
</route>
</pushback>
<icing>
<iceable>
@ -221,8 +242,11 @@
<item>
<label>Pushback</label>
<binding>
<command>dialog-show</command>
<dialog-name>pushback</dialog-name>
<command>nasal</command>
<script>
var autopush_dlg = gui.Dialog.new("sim/gui/dialogs/announce/dialog", "Aircraft/IDG-A32X/AircraftConfig/autopush.xml");
autopush_dlg.open();
</script>
</binding>
</item>
<item>
@ -1500,6 +1524,28 @@
<icing>
<file>Aircraft/IDG-A32X/Nasal/icing.nas</file>
</icing>
<autopush>
<file>Nasal/autopush.nas</file>
</autopush>
<autopush_driver>
<file>Nasal/autopush_driver.nas</file>
</autopush_driver>
<dynarr>
<file>Nasal/dynarr.nas</file>
</dynarr>
<autopush_route>
<file>Nasal/autopush_route.nas</file>
</autopush_route>
</nasal>
<fdm>
<jsbsim>
<external_reactions>
<tractor>
<magnitude alias="/sim/model/pushback/force-lbf"/>
<x alias="/sim/model/pushback/force-x"/>
<y alias="/sim/model/pushback/force-y"/>
</tractor>
</external_reactions>
</jsbsim>
</fdm>
</PropertyList>

329
AircraftConfig/autopush.xml Normal file
View file

@ -0,0 +1,329 @@
<?xml version="1.0"?>
<!--
AUTOPUSH
Pushback dialog.
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://gitlab.com/merspieler
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>
<halign>right</halign>
<pref-width>16</pref-width>
<pref-height>16</pref-height>
<legend/>
<key>Esc</key>
<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>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<group>
<layout>table</layout>
<text>
<row>0</row>
<col>0</col>
<label>Steering:</label>
<halign>left</halign>
</text>
<button>
<row>0</row>
<col>1</col>
<pref-width>25</pref-width>
<pref-height>25</pref-height>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/sim/model/pushback/steer-cmd-norm</property>
<min>-1.0</min>
<max>1.0</max>
<step>-0.02</step>
<wrap>false</wrap>
</binding>
</button>
<slider>
<row>0</row>
<col>2</col>
<min>-1.0</min>
<max>1.0</max>
<property>/sim/model/pushback/steer-cmd-norm</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<button>
<row>0</row>
<col>3</col>
<pref-width>25</pref-width>
<pref-height>25</pref-height>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/sim/model/pushback/steer-cmd-norm</property>
<min>-1.0</min>
<max>1.0</max>
<step>0.02</step>
<wrap>false</wrap>
</binding>
</button>
<button>
<row>0</row>
<col>4</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Center</legend>
<binding>
<command>property-assign</command>
<property>/sim/model/pushback/steer-cmd-norm</property>
<value>0</value>
</binding>
</button>
<text>
<row>1</row>
<col>0</col>
<label>Speed:</label>
<halign>left</halign>
</text>
<button>
<row>1</row>
<col>1</col>
<pref-width>25</pref-width>
<pref-height>25</pref-height>
<legend>&lt;</legend>
<binding>
<command>property-adjust</command>
<property>/sim/model/pushback/target-speed-km_h</property>
<min>-25</min>
<max>25</max>
<step>-1</step>
<wrap>false</wrap>
</binding>
</button>
<slider>
<row>1</row>
<col>2</col>
<min>-25</min>
<max>25</max>
<property>/sim/model/pushback/target-speed-km_h</property>
<live>true</live>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<button>
<row>1</row>
<col>3</col>
<pref-width>25</pref-width>
<pref-height>25</pref-height>
<legend>&gt;</legend>
<binding>
<command>property-adjust</command>
<property>/sim/model/pushback/target-speed-km_h</property>
<min>-25</min>
<max>25</max>
<step>1</step>
<wrap>false</wrap>
</binding>
</button>
<button>
<row>1</row>
<col>4</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Stop</legend>
<binding>
<command>property-assign</command>
<property>/sim/model/pushback/target-speed-km_h</property>
<value>0</value>
</binding>
</button>
<text>
<row>1</row>
<col>5</col>
<pref-width>16</pref-width>
<property>/sim/model/pushback/target-speed-km_h</property>
<format>%3.0f</format>
<live>true</live>
<halign>right</halign>
</text>
<text>
<row>1</row>
<col>6</col>
<label> km/h</label>
<halign>left</halign>
</text>
</group>
<hrule/>
<group>
<layout>table</layout>
<text>
<row>0</row>
<col>0</col>
<label>Auto push:</label>
<halign>left</halign>
</text>
<button>
<row>0</row>
<col>1</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Start</legend>
<binding>
<command>nasal</command>
<script>autopush_driver.start();</script>
</binding>
</button>
<button>
<row>0</row>
<col>2</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Stop</legend>
<binding>
<command>nasal</command>
<script>autopush_driver.stop();</script>
</binding>
</button>
<text>
<row>1</row>
<col>0</col>
<label>Route:</label>
<halign>left</halign>
</text>
<button>
<row>1</row>
<col>1</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Enter</legend>
<binding>
<command>nasal</command>
<script>autopush_route.enter();</script>
</binding>
</button>
<button>
<row>1</row>
<col>2</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Done</legend>
<binding>
<command>nasal</command>
<script>autopush_route.done();</script>
</binding>
</button>
<checkbox>
<row>1</row>
<col>3</col>
<halign>left</halign>
<label>Show</label>
<property>/sim/model/pushback/route/show</property>
<binding>
<command>dialog-apply</command>
</binding>
</checkbox>
<text>
<row>2</row>
<col>0</col>
<label>Last point:</label>
<halign>left</halign>
</text>
<button>
<row>2</row>
<col>1</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Sharp</legend>
<binding>
<command>nasal</command>
<script>autopush_route.toggle_node();</script>
</binding>
</button>
<button>
<row>2</row>
<col>2</col>
<pref-width>50</pref-width>
<pref-height>25</pref-height>
<legend>Delete</legend>
<binding>
<command>nasal</command>
<script>autopush_route.delete_last();</script>
</binding>
</button>
</group>
</group>
</PropertyList>

View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
AUTOPUSH
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://github.com/merspieler
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: /sim/model/pushback/connected -->
<property>sim/model/pushback/connected</property>
</condition>
</animation>
<animation>
<type>rotate</type>
<property>sim/model/pushback/yaw</property>
<!-- SETTING The value of /sim/model/pushback/yaw-mult. -->
<factor>60.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>-7.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>

589
Models/Autopush/cursor.ac Normal file
View file

@ -0,0 +1,589 @@
AC3Db
MATERIAL "autopush cursor" rgb 0.0000 0.0000 0.0000 amb 0.0000 0.0000 0.0000 emis 1.000 0.173 0.545 spec 0.0000 0.0000 0.0000 shi 50 trans 0.0000
OBJECT world
name "Blender_exporter_v2.26__cursor.ac"
kids 1
OBJECT poly
name "Circle"
data 11
Circle.mesh
crease 40.0
numvert 128
0 0.2 -0.75
0 0.2 -1
-0.09802 0.2 -0.99518
-0.19509 0.2 -0.98079
-0.29028 0.2 -0.95694
-0.38268 0.2 -0.92388
-0.4714 0.2 -0.88192
-0.55557 0.2 -0.83147
-0.63439 0.2 -0.77301
-0.70711 0.2 -0.70711
-0.77301 0.2 -0.63439
-0.83147 0.2 -0.55557
-0.88192 0.2 -0.4714
-0.92388 0.2 -0.38268
-0.95694 0.2 -0.29028
-0.98079 0.2 -0.19509
-0.99518 0.2 -0.09802
-1 0.2 0
-0.99518 0.2 0.09802
-0.98079 0.2 0.19509
-0.95694 0.2 0.29028
-0.92388 0.2 0.38268
-0.88192 0.2 0.4714
-0.83147 0.2 0.55557
-0.77301 0.2 0.63439
-0.70711 0.2 0.70711
-0.63439 0.2 0.77301
-0.55557 0.2 0.83147
-0.4714 0.2 0.88192
-0.38268 0.2 0.92388
-0.29028 0.2 0.95694
-0.19509 0.2 0.98079
-0.09802 0.2 0.99518
0 0.2 1
0.09802 0.2 0.99518
0.19509 0.2 0.98079
0.29029 0.2 0.95694
0.38268 0.2 0.92388
0.4714 0.2 0.88192
0.55557 0.2 0.83147
0.63439 0.2 0.77301
0.70711 0.2 0.70711
0.77301 0.2 0.63439
0.83147 0.2 0.55557
0.88192 0.2 0.4714
0.92388 0.2 0.38268
0.95694 0.2 0.29028
0.98079 0.2 0.19509
0.99518 0.2 0.09802
1 0.2 0
0.99518 0.2 -0.09802
0.98079 0.2 -0.19509
0.95694 0.2 -0.29028
0.92388 0.2 -0.38268
0.88192 0.2 -0.4714
0.83147 0.2 -0.55557
0.77301 0.2 -0.63439
0.70711 0.2 -0.70711
0.6344 0.2 -0.77301
0.55557 0.2 -0.83147
0.4714 0.2 -0.88192
0.38269 0.2 -0.92388
0.29029 0.2 -0.95694
0.19509 0.2 -0.98078
0.09802 0.2 -0.99518
-0.07351 0.2 -0.74639
-0.14632 0.2 -0.73559
-0.21771 0.2 -0.71771
-0.28701 0.2 -0.69291
-0.35355 0.2 -0.66144
-0.41668 0.2 -0.6236
-0.47579 0.2 -0.57976
-0.53033 0.2 -0.53033
-0.57976 0.2 -0.47579
-0.6236 0.2 -0.41668
-0.66144 0.2 -0.35355
-0.69291 0.2 -0.28701
-0.71771 0.2 -0.21771
-0.73559 0.2 -0.14632
-0.74639 0.2 -0.07351
-0.75 0.2 0
-0.74639 0.2 0.07351
-0.73559 0.2 0.14632
-0.71771 0.2 0.21771
-0.69291 0.2 0.28701
-0.66144 0.2 0.35355
-0.6236 0.2 0.41668
-0.57976 0.2 0.4758
-0.53033 0.2 0.53033
-0.47579 0.2 0.57976
-0.41668 0.2 0.6236
-0.35355 0.2 0.66144
-0.28701 0.2 0.69291
-0.21771 0.2 0.71771
-0.14632 0.2 0.73559
-0.07351 0.2 0.74639
0 0.2 0.75
0.07351 0.2 0.74639
0.14632 0.2 0.73559
0.21771 0.2 0.71771
0.28701 0.2 0.69291
0.35355 0.2 0.66144
0.41668 0.2 0.6236
0.4758 0.2 0.57976
0.53033 0.2 0.53033
0.57976 0.2 0.47579
0.6236 0.2 0.41668
0.66144 0.2 0.35355
0.69291 0.2 0.28701
0.71771 0.2 0.21771
0.73559 0.2 0.14632
0.74639 0.2 0.07351
0.75 0.2 0
0.74639 0.2 -0.07351
0.73559 0.2 -0.14632
0.71771 0.2 -0.21771
0.69291 0.2 -0.28701
0.66144 0.2 -0.35355
0.6236 0.2 -0.41668
0.57976 0.2 -0.47579
0.53033 0.2 -0.53033
0.4758 0.2 -0.57976
0.41668 0.2 -0.6236
0.35355 0.2 -0.66144
0.28701 0.2 -0.69291
0.21772 0.2 -0.7177
0.14632 0.2 -0.73559
0.07352 0.2 -0.74639
numsurf 64
SURF 0X10
mat 0
refs 4
25 0.080806 0.323223
88 0.091854 0.367417
87 0.088765 0.381051
24 0.076687 0.341402
SURF 0X10
mat 0
refs 4
12 0.06988 0.617849
75 0.08366 0.588387
74 0.086025 0.604169
11 0.073033 0.638893
SURF 0X10
mat 0
refs 4
51 0.186299 0.548772
114 0.170974 0.536579
113 0.171649 0.518378
50 0.187199 0.524504
SURF 0X10
mat 0
refs 4
64 0.131126 0.748796
127 0.129595 0.686597
126 0.134145 0.683897
63 0.137193 0.745196
SURF 0X10
mat 0
refs 4
11 0.073033 0.638893
74 0.086025 0.604169
73 0.088765 0.618949
10 0.076687 0.658598
SURF 0X10
mat 0
refs 4
24 0.076687 0.341402
87 0.088765 0.381051
86 0.086025 0.39583
23 0.073033 0.361107
SURF 0X10
mat 0
refs 4
37 0.148918 0.26903
100 0.142938 0.326773
99 0.138607 0.320574
36 0.143143 0.260765
SURF 0X10
mat 0
refs 4
50 0.187199 0.524504
113 0.171649 0.518378
112 0.171875 0.5
49 0.1875 0.5
SURF 0X10
mat 0
refs 4
63 0.137193 0.745196
126 0.134145 0.683897
125 0.138607 0.679426
62 0.143143 0.739235
SURF 0X10
mat 0
refs 4
10 0.076687 0.658598
73 0.088765 0.618949
72 0.091854 0.632583
9 0.080806 0.676777
SURF 0X10
mat 0
refs 4
23 0.073033 0.361107
86 0.086025 0.39583
85 0.08366 0.411613
22 0.06988 0.382151
SURF 0X10
mat 0
refs 4
36 0.143143 0.260765
99 0.138607 0.320574
98 0.134145 0.316103
35 0.137193 0.254804
SURF 0X10
mat 0
refs 4
49 0.1875 0.5
112 0.171875 0.5
111 0.171649 0.481622
48 0.187199 0.475496
SURF 0X10
mat 0
refs 4
62 0.143143 0.739235
125 0.138607 0.679426
124 0.142938 0.673227
61 0.148918 0.73097
SURF 0X10
mat 0
refs 4
9 0.080806 0.676777
72 0.091854 0.632583
71 0.095263 0.644939
8 0.08535 0.693253
SURF 0X10
mat 0
refs 4
22 0.06988 0.382151
85 0.08366 0.411613
84 0.081693 0.428247
21 0.067258 0.404329
SURF 0X10
mat 0
refs 4
35 0.137193 0.254804
98 0.134145 0.316103
97 0.129595 0.313403
34 0.131126 0.251204
SURF 0X10
mat 0
refs 4
48 0.187199 0.475496
111 0.171649 0.481622
110 0.170974 0.463421
47 0.186299 0.451227
SURF 0X10
mat 0
refs 4
61 0.148918 0.73097
124 0.142938 0.673227
123 0.147097 0.66536
60 0.154463 0.72048
SURF 0X10
mat 0
refs 4
8 0.08535 0.693253
71 0.095263 0.644939
70 0.098958 0.6559
7 0.090277 0.707867
SURF 0X10
mat 0
refs 4
21 0.067258 0.404329
84 0.081693 0.428247
83 0.080143 0.445572
20 0.065191 0.427429
SURF 0X10
mat 0
refs 4
34 0.131126 0.251204
97 0.129595 0.313403
96 0.125 0.3125
33 0.125 0.25
SURF 0X10
mat 0
refs 4
47 0.186299 0.451227
110 0.170974 0.463421
109 0.169857 0.445572
46 0.184809 0.427429
SURF 0X10
mat 0
refs 4
60 0.154463 0.72048
123 0.147097 0.66536
122 0.151043 0.6559
59 0.159723 0.707867
SURF 0X10
mat 0
refs 4
7 0.090277 0.707867
70 0.098958 0.6559
69 0.102903 0.66536
6 0.095538 0.72048
SURF 0X10
mat 0
refs 4
20 0.065191 0.427429
83 0.080143 0.445572
82 0.079026 0.46342
19 0.063701 0.451227
SURF 0X10
mat 0
refs 4
33 0.125 0.25
96 0.125 0.3125
95 0.120406 0.313403
32 0.118874 0.251204
SURF 0X10
mat 0
refs 4
46 0.184809 0.427429
109 0.169857 0.445572
108 0.168307 0.428247
45 0.182743 0.404329
SURF 0X10
mat 0
refs 4
59 0.159723 0.707867
122 0.151043 0.6559
121 0.154737 0.644939
58 0.16465 0.693252
SURF 0X10
mat 0
refs 4
6 0.095538 0.72048
69 0.102903 0.66536
68 0.107062 0.673227
5 0.101082 0.73097
SURF 0X10
mat 0
refs 4
19 0.063701 0.451227
82 0.079026 0.46342
81 0.078351 0.481622
18 0.062801 0.475496
SURF 0X10
mat 0
refs 4
32 0.118874 0.251204
95 0.120406 0.313403
94 0.115855 0.316103
31 0.112807 0.254804
SURF 0X10
mat 0
refs 4
45 0.182743 0.404329
108 0.168307 0.428247
107 0.16634 0.411613
44 0.18012 0.382151
SURF 0X10
mat 0
refs 4
58 0.16465 0.693252
121 0.154737 0.644939
120 0.158146 0.632582
57 0.169194 0.676776
SURF 0X10
mat 0
refs 4
5 0.101082 0.73097
68 0.107062 0.673227
67 0.111393 0.679426
4 0.106857 0.739235
SURF 0X10
mat 0
refs 4
18 0.062801 0.475496
81 0.078351 0.481622
80 0.078125 0.5
17 0.0625 0.5
SURF 0X10
mat 0
refs 4
31 0.112807 0.254804
94 0.115855 0.316103
93 0.111393 0.320574
30 0.106857 0.260765
SURF 0X10
mat 0
refs 4
44 0.18012 0.382151
107 0.16634 0.411613
106 0.163975 0.395831
43 0.176967 0.361108
SURF 0X10
mat 0
refs 4
57 0.169194 0.676776
120 0.158146 0.632582
119 0.161235 0.618949
56 0.173313 0.658598
SURF 0X10
mat 0
refs 4
4 0.106857 0.739235
67 0.111393 0.679426
66 0.115855 0.683897
3 0.112807 0.745196
SURF 0X10
mat 0
refs 4
17 0.0625 0.5
80 0.078125 0.5
79 0.078351 0.518378
16 0.062801 0.524504
SURF 0X10
mat 0
refs 4
30 0.106857 0.260765
93 0.111393 0.320574
92 0.107062 0.326772
29 0.101082 0.26903
SURF 0X10
mat 0
refs 4
43 0.176967 0.361108
106 0.163975 0.395831
105 0.161235 0.381051
42 0.173313 0.341402
SURF 0X10
mat 0
refs 4
56 0.173313 0.658598
119 0.161235 0.618949
118 0.163975 0.604169
55 0.176967 0.638892
SURF 0X10
mat 0
refs 4
3 0.112807 0.745196
66 0.115855 0.683897
65 0.120406 0.686597
2 0.118874 0.748796
SURF 0X10
mat 0
refs 4
16 0.062801 0.524504
79 0.078351 0.518378
78 0.079026 0.536579
15 0.063701 0.548773
SURF 0X10
mat 0
refs 4
29 0.101082 0.26903
92 0.107062 0.326772
91 0.102903 0.33464
28 0.095538 0.27952
SURF 0X10
mat 0
refs 4
42 0.173313 0.341402
105 0.161235 0.381051
104 0.158146 0.367418
41 0.169194 0.323223
SURF 0X10
mat 0
refs 4
55 0.176967 0.638892
118 0.163975 0.604169
117 0.16634 0.588387
54 0.18012 0.617849
SURF 0X10
mat 0
refs 4
15 0.063701 0.548773
78 0.079026 0.536579
77 0.080143 0.554428
14 0.065191 0.572571
SURF 0X10
mat 0
refs 4
28 0.095538 0.27952
91 0.102903 0.33464
90 0.098958 0.344099
27 0.090277 0.292132
SURF 0X10
mat 0
refs 4
41 0.169194 0.323223
104 0.158146 0.367418
103 0.154737 0.355061
40 0.16465 0.306747
SURF 0X10
mat 0
refs 4
54 0.18012 0.617849
117 0.16634 0.588387
116 0.168307 0.571753
53 0.182743 0.595671
SURF 0X10
mat 0
refs 4
0 0.125 0.6875
1 0.125 0.75
2 0.118874 0.748796
65 0.120406 0.686597
SURF 0X10
mat 0
refs 4
14 0.065191 0.572571
77 0.080143 0.554428
76 0.081693 0.571753
13 0.067258 0.595671
SURF 0X10
mat 0
refs 4
27 0.090277 0.292132
90 0.098958 0.344099
89 0.095263 0.35506
26 0.08535 0.306747
SURF 0X10
mat 0
refs 4
40 0.16465 0.306747
103 0.154737 0.355061
102 0.151042 0.344099
39 0.159723 0.292133
SURF 0X10
mat 0
refs 4
53 0.182743 0.595671
116 0.168307 0.571753
115 0.169857 0.554428
52 0.184809 0.572571
SURF 0X10
mat 0
refs 4
13 0.067258 0.595671
76 0.081693 0.571753
75 0.08366 0.588387
12 0.06988 0.617849
SURF 0X10
mat 0
refs 4
26 0.08535 0.306747
89 0.095263 0.35506
88 0.091854 0.367417
25 0.080806 0.323223
SURF 0X10
mat 0
refs 4
39 0.159723 0.292133
102 0.151042 0.344099
101 0.147097 0.33464
38 0.154462 0.27952
SURF 0X10
mat 0
refs 4
52 0.184809 0.572571
115 0.169857 0.554428
114 0.170974 0.536579
51 0.186299 0.548772
SURF 0X10
mat 0
refs 4
1 0.125 0.75
0 0.125 0.6875
127 0.129595 0.686597
64 0.131126 0.748796
SURF 0X10
mat 0
refs 4
38 0.154462 0.27952
101 0.147097 0.33464
100 0.142938 0.326773
37 0.148918 0.26903
kids 0

BIN
Models/Autopush/cursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 B

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
AUTOPUSH
Cursor model.
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://gitlab.com/merspieler
Distribute under the terms of GPLv2.
-->
<PropertyList>
<path>cursor.ac</path>
<animation>
<enable-hot>false</enable-hot>
</animation>
<animation>
<type>scale</type>
<property>/sim/model/pushback/driver/D_min-m</property>
<z-factor>0.0</z-factor>
<z-min>1.0</z-min>
</animation>
</PropertyList>

View file

@ -0,0 +1,67 @@
AC3Db
MATERIAL "autopush cursor" rgb 0.0000 0.0000 0.0000 amb 0.0000 0.0000 0.0000 emis 1.000 0.173 0.545 spec 0.0000 0.0000 0.0000 shi 50 trans 0.0000
OBJECT world
name "Blender_exporter_v2.26__cursor_sharp.ac"
kids 1
OBJECT poly
name "Circle"
data 11
Circle.mesh
crease 40.0
numvert 12
0 0.2 -0.75
0 0.2 -1
0.64952 0.2 -0.375
0.86603 0.2 -0.5
0.64952 0.2 0.375
0.86603 0.2 0.5
0 0.2 0.75
0 0.2 1
-0.64952 0.2 0.375
-0.86603 0.2 0.5
-0.64952 0.2 -0.375
-0.86603 0.2 -0.5
numsurf 6
SURF 0X10
mat 0
refs 4
0 0.125 0.6875
2 0.171875 0.59375
3 0.1875 0.625
1 0.125 0.75
SURF 0X10
mat 0
refs 4
2 0.171875 0.59375
4 0.171875 0.40625
5 0.1875 0.375
3 0.1875 0.625
SURF 0X10
mat 0
refs 4
4 0.171875 0.40625
6 0.125 0.3125
7 0.125 0.25
5 0.1875 0.375
SURF 0X10
mat 0
refs 4
6 0.125 0.3125
8 0.078125 0.40625
9 0.0625 0.375
7 0.125 0.25
SURF 0X10
mat 0
refs 4
8 0.078125 0.40625
10 0.078125 0.59375
11 0.0625 0.625
9 0.0625 0.375
SURF 0X10
mat 0
refs 4
10 0.078125 0.59375
0 0.125 0.6875
1 0.125 0.75
11 0.0625 0.625
kids 0

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
AUTOPUSH
Cursor model.
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://gitlab.com/merspieler
Distribute under the terms of GPLv2.
-->
<PropertyList>
<path>cursor_sharp.ac</path>
<animation>
<enable-hot>false</enable-hot>
</animation>
<animation>
<type>scale</type>
<property>/sim/model/pushback/driver/D_min-m</property>
<z-factor>0.0</z-factor>
<z-min>1.0</z-min>
</animation>
</PropertyList>

238
Models/Autopush/waypoint.ac Normal file
View file

@ -0,0 +1,238 @@
AC3Db
MATERIAL "autopush cursor" rgb 0.0000 0.0000 0.0000 amb 0.0000 0.0000 0.0000 emis 1.000 0.173 0.545 spec 0.0000 0.0000 0.0000 shi 50 trans 0.0000
OBJECT world
name "Blender_exporter_v2.26__waypoint.ac"
kids 1
OBJECT poly
name "Circle"
data 11
Circle.mesh
crease 40.0
numvert 33
0.03902 0.2 -0.19616
0.07654 0.2 -0.18478
0.11111 0.2 -0.16629
0.14142 0.2 -0.14142
0.16629 0.2 -0.11111
0.18478 0.2 -0.07654
0.19616 0.2 -0.03902
0.2 0.2 -0
0.19616 0.2 0.03902
0.18478 0.2 0.07654
0.16629 0.2 0.11111
0.14142 0.2 0.14142
0.11111 0.2 0.16629
0.07654 0.2 0.18478
0.03902 0.2 0.19616
0 0.2 0.2
-0.03902 0.2 0.19616
-0.07654 0.2 0.18478
-0.11111 0.2 0.16629
-0.14142 0.2 0.14142
-0.16629 0.2 0.11111
-0.18478 0.2 0.07654
-0.19616 0.2 0.03902
-0.2 0.2 0
-0.19616 0.2 -0.03902
-0.18478 0.2 -0.07654
-0.16629 0.2 -0.11111
-0.14142 0.2 -0.14142
-0.11111 0.2 -0.16629
-0.07654 0.2 -0.18478
-0.03902 0.2 -0.19616
0 0.2 -0.2
0 0.2 0
numsurf 32
SURF 0X0
mat 0
refs 3
32 0.125 0.5
18 0.090277 0.292133
17 0.101082 0.26903
SURF 0X0
mat 0
refs 3
32 0.125 0.5
31 0.125 0.75
30 0.112807 0.745197
SURF 0X0
mat 0
refs 3
32 0.125 0.5
4 0.176967 0.638893
3 0.169194 0.676777
SURF 0X0
mat 0
refs 3
32 0.125 0.5
17 0.101082 0.26903
16 0.112807 0.254804
SURF 0X0
mat 0
refs 3
32 0.125 0.5
30 0.112807 0.745197
29 0.101082 0.73097
SURF 0X0
mat 0
refs 3
32 0.125 0.5
3 0.169194 0.676777
2 0.159723 0.707868
SURF 0X0
mat 0
refs 3
32 0.125 0.5
16 0.112807 0.254804
15 0.125 0.25
SURF 0X0
mat 0
refs 3
32 0.125 0.5
29 0.101082 0.73097
28 0.090277 0.707868
SURF 0X0
mat 0
refs 3
32 0.125 0.5
2 0.159723 0.707868
1 0.148918 0.73097
SURF 0X0
mat 0
refs 3
32 0.125 0.5
15 0.125 0.25
14 0.137193 0.254804
SURF 0X0
mat 0
refs 3
32 0.125 0.5
28 0.090277 0.707868
27 0.080806 0.676777
SURF 0X0
mat 0
refs 3
32 0.125 0.5
1 0.148918 0.73097
0 0.137193 0.745197
SURF 0X0
mat 0
refs 3
32 0.125 0.5
14 0.137193 0.254804
13 0.148918 0.26903
SURF 0X0
mat 0
refs 3
32 0.125 0.5
27 0.080806 0.676777
26 0.073033 0.638893
SURF 0X0
mat 0
refs 3
32 0.125 0.5
0 0.137193 0.745197
31 0.125 0.75
SURF 0X0
mat 0
refs 3
32 0.125 0.5
13 0.148918 0.26903
12 0.159723 0.292133
SURF 0X0
mat 0
refs 3
32 0.125 0.5
26 0.073033 0.638893
25 0.067258 0.595671
SURF 0X0
mat 0
refs 3
32 0.125 0.5
12 0.159723 0.292133
11 0.169194 0.323224
SURF 0X0
mat 0
refs 3
32 0.125 0.5
25 0.067258 0.595671
24 0.063701 0.548773
SURF 0X0
mat 0
refs 3
32 0.125 0.5
11 0.169194 0.323224
10 0.176967 0.361108
SURF 0X0
mat 0
refs 3
32 0.125 0.5
24 0.063701 0.548773
23 0.0625 0.5
SURF 0X0
mat 0
refs 3
32 0.125 0.5
10 0.176967 0.361108
9 0.182743 0.404329
SURF 0X0
mat 0
refs 3
32 0.125 0.5
23 0.0625 0.5
22 0.063701 0.451228
SURF 0X0
mat 0
refs 3
32 0.125 0.5
9 0.182743 0.404329
8 0.186299 0.451228
SURF 0X0
mat 0
refs 3
32 0.125 0.5
22 0.063701 0.451228
21 0.067258 0.404329
SURF 0X0
mat 0
refs 3
32 0.125 0.5
8 0.186299 0.451228
7 0.1875 0.5
SURF 0X0
mat 0
refs 3
32 0.125 0.5
21 0.067258 0.404329
20 0.073033 0.361108
SURF 0X0
mat 0
refs 3
32 0.125 0.5
7 0.1875 0.5
6 0.186299 0.548773
SURF 0X0
mat 0
refs 3
32 0.125 0.5
20 0.073033 0.361108
19 0.080806 0.323223
SURF 0X0
mat 0
refs 3
32 0.125 0.5
6 0.186299 0.548773
5 0.182742 0.595671
SURF 0X0
mat 0
refs 3
32 0.125 0.5
19 0.080806 0.323223
18 0.090277 0.292133
SURF 0X0
mat 0
refs 3
32 0.125 0.5
5 0.182742 0.595671
4 0.176967 0.638893
kids 0

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
AUTOPUSH
Waypoint model.
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://gitlab.com/merspieler
Distribute under the terms of GPLv2.
-->
<PropertyList>
<path>waypoint.ac</path>
<animation>
<enable-hot>false</enable-hot>
</animation>
<animation>
<type>scale</type>
<property>/sim/model/pushback/driver/D_min-m</property>
<z-factor>0.0</z-factor>
<z-min>1.0</z-min>
</animation>
</PropertyList>

View file

@ -79,24 +79,6 @@
</axis>
</animation>
<!-- change heading of the pushback when driving the arc -->
<animation>
<type>rotate</type>
<property>sim/model/pushback/position-norm</property>
<factor>-90</factor>
<offset-deg>90</offset-deg>
<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>
<!-- compensate for gear compression -->
<animation>
<type>translate</type>
@ -109,72 +91,22 @@
</axis>
</animation>
<!-- precalculated sin and asin to move the pushback on a 90deg arc, 25m radius -->
<animation>
<type>translate</type>
<property>sim/model/pushback/position-norm</property>
<interpolation>
<entry><ind>1.000000</ind><dep>0.000000</dep></entry>
<entry><ind>0.950000</ind><dep>1.961477</dep></entry>
<entry><ind>0.900000</ind><dep>3.910862</dep></entry>
<entry><ind>0.850000</ind><dep>5.836134</dep></entry>
<entry><ind>0.800000</ind><dep>7.725425</dep></entry>
<entry><ind>0.750000</ind><dep>9.567086</dep></entry>
<entry><ind>0.700000</ind><dep>11.349763</dep></entry>
<entry><ind>0.650000</ind><dep>13.062464</dep></entry>
<entry><ind>0.600000</ind><dep>14.694631</dep></entry>
<entry><ind>0.550000</ind><dep>16.236201</dep></entry>
<entry><ind>0.500000</ind><dep>17.677670</dep></entry>
<entry><ind>0.450000</ind><dep>19.010149</dep></entry>
<entry><ind>0.400000</ind><dep>20.225425</dep></entry>
<entry><ind>0.350000</ind><dep>21.316004</dep></entry>
<entry><ind>0.300000</ind><dep>22.275163</dep></entry>
<entry><ind>0.250000</ind><dep>23.096988</dep></entry>
<entry><ind>0.200000</ind><dep>23.776413</dep></entry>
<entry><ind>0.150000</ind><dep>24.309248</dep></entry>
<entry><ind>0.100000</ind><dep>24.692209</dep></entry>
<entry><ind>0.050000</ind><dep>24.922933</dep></entry>
<entry><ind>0.000000</ind><dep>25.000000</dep></entry>
</interpolation>
<axis>
<x>-1</x>
<y>0</y>
<z>0</z>
</axis>
</animation>
<animation>
<type>translate</type>
<property>sim/model/pushback/position-norm</property>
<interpolation>
<entry><ind>1.000000</ind><dep>0.000000</dep></entry>
<entry><ind>0.950000</ind><dep>0.077067</dep></entry>
<entry><ind>0.900000</ind><dep>0.307791</dep></entry>
<entry><ind>0.850000</ind><dep>0.690752</dep></entry>
<entry><ind>0.800000</ind><dep>1.223587</dep></entry>
<entry><ind>0.750000</ind><dep>1.903012</dep></entry>
<entry><ind>0.700000</ind><dep>2.724837</dep></entry>
<entry><ind>0.650000</ind><dep>3.683996</dep></entry>
<entry><ind>0.600000</ind><dep>4.774575</dep></entry>
<entry><ind>0.550000</ind><dep>5.989851</dep></entry>
<entry><ind>0.500000</ind><dep>7.322330</dep></entry>
<entry><ind>0.450000</ind><dep>8.763799</dep></entry>
<entry><ind>0.400000</ind><dep>10.305369</dep></entry>
<entry><ind>0.350000</ind><dep>11.937536</dep></entry>
<entry><ind>0.300000</ind><dep>13.650238</dep></entry>
<entry><ind>0.250000</ind><dep>15.432914</dep></entry>
<entry><ind>0.200000</ind><dep>17.274575</dep></entry>
<entry><ind>0.150000</ind><dep>19.163866</dep></entry>
<entry><ind>0.100000</ind><dep>21.089138</dep></entry>
<entry><ind>0.050000</ind><dep>23.038523</dep></entry>
<entry><ind>0.000000</ind><dep>25.000000</dep></entry>
</interpolation>
<type>rotate</type>
<property>gear/gear[0]/steering-norm</property>
<factor>-70</factor>
<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>
<y>0</y>
<z>1</z>
</axis>
</animation>
<!-- compensate for pitch of aircraft, keep pushback level -->
<animation>

136
Nasal/autopush.nas Normal file
View file

@ -0,0 +1,136 @@
# AUTOPUSH
# Basic pushback logic class.
#
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://gitlab.com/merspieler
# Distribute under the terms of GPLv2.
var _enabled = 0;
var _K_p = nil;
var _F_p = nil;
var _K_i = nil;
var _F_i = nil;
var _K_d = nil;
var _F_d = nil;
var _F = nil;
var _int = nil;
var _deltaV = nil;
var _T_f = nil;
var _K_yaw = nil;
var _yasim = 0;
var _time = nil;
# (ft / s^2) / ((km / h) / s)
var _unitconv = M2FT / 3.6;
var _debug = nil;
var _loop = func() {
if (!getprop("/sim/model/pushback/available")) {
_stop();
return;
}
var force = 0.0;
var x = 0.0;
var y = 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");
deltaV -= getprop("/gear/gear[0]/rollspeed-ms") * 3.6;
var dV = deltaV - _deltaV;
var time = getprop("/sim/time/elapsed-sec");
var prop = math.min(math.max(_K_p * deltaV, -_F_p), _F_p);
var speedup = getprop("/sim/speed-up");
dt = time - _time;
# XXX Sanitising dt. Smaller chance of freakout on lag spike.
if(dt > 0.0) {
if(dt < 0.05) {
_int = math.min(math.max(_int + _K_i * dV * dt, -_F_i), _F_i);
}
if(dt > 0.002) {
var deriv = math.min(math.max(_K_d * dV / dt, -_F_d), _F_d);
}
}
var accel = prop + _int + deriv;
if (_debug > 2) {
print("pushback prop " ~ prop ~ ", _int " ~ _int ~ ", deriv " ~ deriv);
}
_deltaV = deltaV;
_time = time;
if (!_yasim) {
force = accel * getprop("/fdm/jsbsim/inertia/weight-lbs") * _unitconv;
} else {
force = accel * getprop("/fdm/yasim/gross-weight-lbs") * _unitconv;
}
var yaw = getprop("/sim/model/pushback/yaw") * _K_yaw;
x = math.cos(yaw);
y = math.sin(yaw);
setprop("/sim/model/pushback/force-x", x);
setprop("/sim/model/pushback/force-y", y);
}
setprop("/sim/model/pushback/force-lbf", force);
if (_yasim) {
# The force is divided by YASim thrust="100000.0" setting.
setprop("/sim/model/pushback/force-x-yasim", x * force * 0.00001);
# YASim's y is to the left.
setprop("/sim/model/pushback/force-y-yasim", -y * force * 0.00001);
}
}
var _timer = maketimer(0.0167, func{_loop()});
var _start = func() {
# Else overwritten by dialog.
settimer(func() {
setprop("/sim/model/pushback/target-speed-km_h", 0.0)
}, 0.1);
_K_p = getprop("/sim/model/pushback/K_p");
_F_p = getprop("/sim/model/pushback/F_p");
_K_i = getprop("/sim/model/pushback/K_i");
_F_i = getprop("/sim/model/pushback/F_i");
_K_d = getprop("/sim/model/pushback/K_d");
_F_d = getprop("/sim/model/pushback/F_d");
_F = getprop("/sim/model/pushback/F");
_T_f = getprop("/sim/model/pushback/T_f");
_K_yaw = getprop("/sim/model/pushback/yaw-mult") * D2R;
_yasim = (getprop("/sim/flight-model") == "yasim");
_debug = getprop("/sim/model/pushback/debug") or 0;
_int = 0.0;
_deltaV = 0.0;
_time = getprop("/sim/time/elapsed-sec");
setprop("/sim/model/pushback/connected", 1);
if (!_timer.isRunning) {
if (getprop("/sim/model/pushback/chocks")) {
setprop("/sim/model/pushback/chocks", 0);
screen.log.write("(pushback): Pushback connected, chocks removed. Please release brakes.");
} else {
screen.log.write("(pushback): Pushback connected, please release brakes.");
}
}
_timer.start();
}
var _stop = func() {
if (_timer.isRunning) {
screen.log.write("(pushback): Pushback and bypass pin removed.");
}
_timer.stop();
setprop("/sim/model/pushback/force-lbf", 0.0);
if (_yasim) {
setprop("/sim/model/pushback/force-x-yasim", 0.0);
setprop("/sim/model/pushback/force-y-yasim", 0.0);
}
setprop("/sim/model/pushback/connected", 0);
setprop("/sim/model/pushback/enabled", 0);
}
setlistener("/sim/model/pushback/enabled", func(p) {
var enabled = p.getValue();
if ((enabled > _enabled) and getprop("/sim/model/pushback/available")) {
_start();
} else if (enabled < _enabled) {
_stop();
}
_enabled = enabled;
});

101
Nasal/autopush_driver.nas Normal file
View file

@ -0,0 +1,101 @@
# AUTOPUSH
# Pushback driver class.
#
# Command the pushback to tow/push the aircraft.
#
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://gitlab.com/merspieler
# Distribute under the terms of GPLv2.
var _K_V = nil;
var _F_V = nil;
var _D_min = nil;
var _K_psi = nil;
var _debug = nil;
var _route = nil;
var _push = nil;
var _sign = nil;
var _psi_park = nil;
var _to_wp = nil;
var _loop = func() {
if (!getprop("/sim/model/pushback/connected")) {
stop();
return;
}
var psi = getprop("/orientation/heading-deg") + _push * 180.0;
var (A, D) = courseAndDistance(_route[_to_wp]);
D *= NM2M;
# FIXME Use _K_V and total remaining distance.
var V = _F_V;
if ((D < _D_min) or (abs(geo.normdeg180(A - psi) > 90.0))) {
_to_wp += 1;
if (_to_wp == size(_route)) {
_done();
autopush_route.clear();
return;
}
if (_debug) {
print("pushback_driver wp " ~ _to_wp);
}
}
if (_debug > 1) {
print("pushback_driver psi_target " ~ geo.normdeg(A) ~ ", deltapsi " ~ _sign * geo.normdeg180(A - psi));
}
setprop("/sim/model/pushback/target-speed-km_h", _sign * V);
steering = math.min(math.max(_sign * _K_psi * geo.normdeg180(A - psi), -1.0), 1.0);
setprop("/sim/model/pushback/steer-cmd-norm", steering);
}
var _timer = maketimer(0.051, func{_loop()});
var _done = func() {
stop();
screen.log.write("(pushback): Pushback complete, please set parking brake.");
}
var start = func() {
if (_timer.isRunning) {
stop();
}
if (!getprop("/sim/model/pushback/connected")) {
gui.popupTip("Pushback must be connected");
return;
}
_route = autopush_route.route();
if ((_route == nil) or size(_route) < 2) {
autopush_route.enter(1);
return;
}else{
autopush_route.done();
}
_K_V = getprop("/sim/model/pushback/driver/K_V");
_F_V = getprop("/sim/model/pushback/driver/F_V");
_D_min = getprop("/sim/model/pushback/driver/D_min-m");
_K_psi = getprop("/sim/model/pushback/driver/K_psi");
_debug = getprop("/sim/model/pushback/debug") or 0;
var (psi_park, D_park) = courseAndDistance(_route[0], _route[1]);
var (psi_twy, D_twy) = courseAndDistance(_route[size(_route) - 2], _route[size(_route) - 1]);
_psi_park = psi_park;
_push = (abs(geo.normdeg180(getprop("/orientation/heading-deg") - psi_park)) > 90.0);
_sign = 1.0 - 2.0 * _push;
_to_wp = 0;
_timer.start();
if (_sign < 0.0) {
screen.log.write("(pushback): Push back facing " ~ int(geo.normdeg(psi_twy + 180.0 - magvar())) ~ ".");
} else {
screen.log.write("(pushback): Tow facing " ~ int(geo.normdeg(psi_twy - magvar())) ~ ".");
}
}
var stop = func() {
_timer.stop();
setprop("/sim/model/pushback/target-speed-km_h", 0.0);
autopush_route.clear();
}

292
Nasal/autopush_route.nas Normal file
View file

@ -0,0 +1,292 @@
# AUTOPUSH
# Visual entry of pushback route.
#
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://gitlab.com/merspieler
# Distribute under the terms of GPLv2.
var _listener = nil;
var _view_listener = nil;
var _user_points = dynarr.dynarr.new(4);
var _user_point_modes = dynarr.dynarr.new(4); # Modes: 0 = Bezier node, 1 = Bezier end/start node
var _route = [];
var _view_index = nil;
var _user_point_models = [];
var _waypoint_models = [];
var _N = 0;
var _show = 0;
var _view_changed_or_external = 0;
var _start_immediately = nil;
var _D_min = nil;
var _add = func(pos) {
if (_N) {
var (A, S) = courseAndDistance(_user_points.arr[_N - 1], pos);
if (S * NM2M < 3 * _D_min) {
gui.popupTip("Too close to the previous point,\ntry again");
return;
}
}
_user_points.add(geo.Coord.new(pos));
if (_user_point_modes.maxsize == 1 and _user_point_modes.size == 1) {
_user_point_modes.arr[0] = 0;
} else {
_user_point_modes.add(0);
}
setsize(_user_point_models, _N + 1);
_user_point_models[_N] = geo.put_model("Models/Autopush/cursor.xml", pos, 0.0);
_N += 1;
if (_N == 1) {
gui.popupTip("Click waypoints, press \"Done\" to finish");
} else {
_calculate_route();
_place_waypoint_models();
}
}
var delete_last = func() {
if (_listener == nil) {
return;
}
if (_N > 1) {
_N -= 1;
_user_points.del(_N);
_user_point_modes.del(_N);
_user_point_models[_N].remove();
_user_point_models[_N] = nil;
setsize(_user_point_models, _N);
_calculate_route();
_place_waypoint_models();
}
}
var _stop = func(fail = 0) {
if (_listener != nil) {
removelistener(_listener);
_listener = nil;
if (!fail) {
settimer(func() {
_reset_view();
if (_start_immediately) {
autopush_driver.start();
} else {
gui.popupTip("Done");
}
}, 1.0);
} else {
_reset_view();
}
}
}
var _place_user_point_models = func() {
_clear_user_point_models();
setsize(_user_point_models, _N);
var user_points = _user_points.get_sliced();
for (var ii = 0; ii < _N; ii += 1) {
var model = "Models/Autopush/cursor.xml";
if (_user_point_modes.arr[ii] == 1) {
model = "Models/Autopush/cursor_sharp.xml";
}
_user_point_models[ii] = geo.put_model(model, user_points[ii], 0.0);
}
}
var _clear_user_point_models = func() {
for (var ii = 0; ii < size(_user_point_models); ii += 1) {
if (_user_point_models[ii] != nil) {
_user_point_models[ii].remove();
_user_point_models[ii] = nil;
}
}
setsize(_user_point_models, 0);
}
var _place_waypoint_models = func() {
_clear_waypoint_models();
setsize(_waypoint_models, size(_route));
for (var ii = 0; ii < size(_route); ii += 1) {
_waypoint_models[ii] = geo.put_model("Models/Autopush/waypoint.xml", _route[ii], 0.0);
}
}
var _clear_waypoint_models = func() {
for (var ii = 0; ii < size(_waypoint_models); ii += 1) {
if (_waypoint_models[ii] != nil) {
_waypoint_models[ii].remove();
_waypoint_models[ii] = nil;
}
}
setsize(_waypoint_models, 0);
}
var _set_view = func() {
if(!getprop("/sim/current-view/internal")){
_view_changed_or_external = 1;
return;
}
_view_index = getprop("/sim/current-view/view-number");
setprop("/sim/current-view/view-number", view.indexof("Model View"));
_view_changed_or_external = 0;
_view_listener = setlistener("/sim/current-view/name", func {
_view_changed_or_external = 1;
});
}
var _reset_view = func() {
if (!_view_changed_or_external) {
setprop("/sim/current-view/view-number", _view_index);
}
if (_view_listener != nil) {
removelistener(_view_listener);
_view_listener = nil;
}
if (!_show) {
_clear_user_point_models();
_clear_waypoint_models();
}
}
var _calculate_route = func() {
_route = [];
user_points = _user_points.get_sliced();
var route = dynarr.dynarr.new();
# add the first point cause it will be fix at this pos
route.add(geo.Coord.new(user_points[0]));
n = size(user_points);
var base = 0;
for (var i = 0; i < n; i += 1) {
if (_user_point_modes.arr[i] == 1 or i == n - 1) {
if (i - base > 0) {
var bezier = _calculate_bezier(user_points[base:i]);
var m = size(bezier);
for (var j = 0; j < m; j += 1) {
route.add(geo.Coord.new(bezier[j]));
}
}
base = i;
route.add(geo.Coord.new(user_points[i]));
}
}
PNumber = size(user_points);
_route = route.get_sliced();
}
var _calculate_bezier = func(user_points) {
var route = dynarr.dynarr.new();
PNumber = size(user_points);
if (PNumber > 1) {
var pointList = [];
setsize(pointList, PNumber);
for (var i = 0; i < PNumber; i += 1) {
pointList[i] = [];
setsize(pointList[i], PNumber);
}
pointList[0] = user_points;
var len = 0;
for (var i = 0; i < PNumber - 1; i += 1) {
len += user_points[i].distance_to(user_points[i + 1]);
}
var step = _D_min / len;
for (var i = step; i < 1 - step; i+= step) {
# start iterating from 1 cause we don't need to iterate over Pn
for (var j = 1; j < PNumber; j += 1) {
for (var k = 0; k < PNumber - j; k += 1) {
pointList[j][k] = geo.Coord.new(pointList[j - 1][k]);
var dist = pointList[j - 1][k].distance_to(pointList[j - 1][k + 1]);
var course = pointList[j - 1][k].course_to(pointList[j - 1][k + 1]);
pointList[j][k].apply_course_distance(course, dist * i);
}
}
pointList[PNumber - 1][0].set_alt(geo.elevation(pointList[PNumber - 1][0].lat(),pointList[PNumber - 1][0].lon()));
route.add(geo.Coord.new(pointList[PNumber - 1][0]));
}
}
return route.get_sliced();
}
setlistener("/sim/model/pushback/route/show", func(p) {
var show = p.getValue();
if (_listener == nil) {
if (show > _show) {
_place_user_point_models();
_place_waypoint_models();
} else if (show < _show) {
_clear_user_point_models();
_clear_waypoint_models();
}
}
_show = show;
});
var enter = func(start_immediately = 0) {
clear();
_set_view();
_D_min = getprop("/sim/model/pushback/driver/D_min-m");
var wp = geo.aircraft_position();
var H = geo.elevation(wp.lat(), wp.lon());
if (H != nil) {
wp.set_alt(H);
}
_add(wp);
_listener = setlistener("/sim/signals/click", func {
_add(geo.click_position());
});
_start_immediately = start_immediately;
}
var toggle_node = func() {
if (_listener == nil) {
return;
}
if (_user_point_modes.arr[_N - 1] == 0) {
_user_point_modes.arr[_N - 1] = 1;
} else {
_user_point_modes.arr[_N - 1] = 0;
}
if (_user_point_models[_N - 1] != nil) {
_user_point_models[_N - 1].remove();
var model = "Models/Autopush/cursor.xml";
if (_user_point_modes.arr[_N - 1] == 1) {
model = "Models/Autopush/cursor_sharp.xml";
}
_user_point_models[_N - 1] = geo.put_model(model, _user_points.get_sliced()[_N - 1], 0.0);
}
}
var done = func() {
_stop(0);
}
var clear = func() {
_stop(1);
_clear_user_point_models();
_clear_waypoint_models();
_N = 0;
_user_points = dynarr.dynarr.new(4);
_user_point_modes = dynarr.dynarr.new(1);
}
var route = func() {
if (_N < 2) {
return nil;
}
_calculate_route();
return _route;
}

61
Nasal/dynarr.nas Normal file
View file

@ -0,0 +1,61 @@
# Class for dynamic arrays
#
# Copyright (c) 2018 dynamic arrays authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Merspieler http://gitlab.com/merspieler
# Distribute under the terms of GPLv2.
## Useage
# to create a new object: var <name> = dynarr.new();
# to add elements: <name>.add(<element>);
# you can access the full stored array as: <name>.arr
# to get only the used area of the array: var <spliced_array> = <name>.get_spliced()
var dynarr =
{
new: func(size = 8)
{
var this = {parents:[dynarr]};
this.maxsize = size;
this.size = 0;
this.arr = setsize([], size);
return this;
},
# add a new element to the array
add: func(obj)
{
# case there's no space left
if (me.size + 1 >= me.maxsize)
{
# double array size
me.maxsize *= 2;
me.arr = setsize(me.arr, me.maxsize);
}
# add object and increase used counter
me.arr[me.size] = obj;
me.size += 1;
},
# delete an element from the array
del: func(id)
{
me.size -= 1;
for(ii = id; ii < me.size - 1; ii += 1){
me.arr[ii] = me.arr[ii + 1];
}
},
# returns only the filled part of the array or nil if array is empty
get_sliced: func()
{
if (me.size == 0)
{
return nil;
}
return me.arr[0:me.size - 1];
}
};

View file

@ -8,7 +8,7 @@
-->
<external_reactions>
<force name="pushback" frame="BODY">
<force name="tractor" frame="BODY">
<location unit="M">
<x> 7.52385 </x>
<y> 0 </y>

View file

@ -24,15 +24,6 @@
<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">