Commit bbb34c81 authored by Михаил Данилов's avatar Михаил Данилов 💬

Autopush 0.6.2.

parent a8864cca
......@@ -3,8 +3,10 @@
AUTOPUSH
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
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.
......
......@@ -4,8 +4,10 @@
AUTOPUSH
Cursor model.
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://github.com/merspieler
Distribute under the terms of GPLv2.
-->
......
......@@ -4,8 +4,10 @@
AUTOPUSH
Cursor model.
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://github.com/merspieler
Distribute under the terms of GPLv2.
-->
......
......@@ -4,8 +4,10 @@
AUTOPUSH
Cursor model.
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://github.com/merspieler
Distribute under the terms of GPLv2.
-->
......
......@@ -4,8 +4,10 @@
AUTOPUSH
Cursor model.
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
Copyright (c) 2018 Autopush authors:
Michael Danilov <mike.d.ft402 -eh- gmail.com>
Joshua Davidson http://github.com/it0uchpods
Merspieler http://github.com/merspieler
Distribute under the terms of GPLv2.
-->
......
# AUTOPUSH
# Basic pushback logic class.
#
# Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://github.com/merspieler
# Distribute under the terms of GPLv2.
......@@ -22,6 +24,7 @@ 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")) {
......@@ -36,12 +39,23 @@ var _loop = func() {
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 = systime();
var dt = (time - _time) * 0.001;
_int = math.min(math.max(_int + _K_i * dV * dt, -_F_i), _F_i);
var accel = math.min(math.max(_K_p * deltaV, -_F_p), _F_p);
accel += math.min(math.max(_K_d * dV / dt, -_F_d), _F_d);
accel += _int;
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) {
......@@ -81,16 +95,17 @@ var _start = func() {
_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 = systime();
_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);
gui.popupTip("Pushback connected, chocks removed.\nPlease release brakes");
screen.log.write("(pushback): Pushback connected, chocks removed. Please release brakes.");
} else {
gui.popupTip("Pushback connected,\nplease release brakes");
screen.log.write("(pushback): Pushback connected, please release brakes.");
}
}
_timer.start();
......@@ -98,7 +113,7 @@ var _start = func() {
var _stop = func() {
if (_timer.isRunning) {
gui.popupTip("Pushback and bypass pin removed");
screen.log.write("(pushback): Pushback and bypass pin removed.");
}
_timer.stop();
setprop("/sim/model/pushback/force-lbf", 0.0);
......
# AUTOPUSH
# Pushback driver class.
#
# Command the pushback to tow/push the aircract facing set heading.
# Command the pushback to tow/push the aircraft.
#
# Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://github.com/merspieler
# Distribute under the terms of GPLv2.
......@@ -41,9 +43,15 @@ var _loop = func() {
} else if (_phase == 1) {
psi_target = _psi_twy;
var intercept = geo.normdeg180(A - psi_target);
# Fade from 2*S_min to S_min
intercept *= math.min(math.max(S / _S_min - 1.0, 0.0), 1.0);
# Quadratically fade from _S_turn/2 to 0.
intercept *= math.min(math.max(2.0 * S / _S_turn, 0.0), 1.0);
intercept *= math.min(math.max(2.0 * S / _S_turn, 0.0), 1.0);
psi_target += intercept;
var initial = geo.normdeg180(_psi_park - psi_target);
# Quadratically fade from _S_turn to _S_turn/2.
initial *= math.min(math.max(2.0 * S / _S_turn - 1.0, 0.0), 1.0);
initial *= math.min(math.max(2.0 * S / _S_turn - 1.0, 0.0), 1.0);
psi_target += initial;
# Taxiway.
} else if (_phase == 2) {
psi_target = _psi_twy;
......@@ -66,6 +74,9 @@ var _loop = func() {
print("pushback_driver phase " ~ _phase);
}
}
if (_debug > 1) {
print("pushback_driver psi " ~ geo.normdeg(psi_target) ~ ", deltapsi " ~ _sign * geo.normdeg180(psi_target - psi));
}
setprop("/sim/model/pushback/target-speed-km_h", _sign * V);
steering = math.min(math.max(_sign * _K_psi * geo.normdeg180(psi_target - psi), -1.0), 1.0);
setprop("/sim/model/pushback/steer-cmd-norm", steering);
......@@ -75,7 +86,7 @@ var _timer = maketimer(0.051, func{_loop()});
var _done = func() {
stop();
gui.popupTip("Pushback complete, please set parking brake");
screen.log.write("(pushback): Pushback complete, please set parking brake.");
}
var start = func() {
......@@ -95,9 +106,9 @@ var start = func() {
_F_V = getprop("/sim/model/pushback/driver/F_V");
_S_min = getprop("/sim/model/pushback/driver/S_min-m");
_K_psi = getprop("/sim/model/pushback/driver/K_psi");
_debug = getprop("/sim/model/pushback/driver/debug") or 0;
_debug = getprop("/sim/model/pushback/debug") or 0;
var (psi_park, S_park) = courseAndDistance(_route[0], _route[1]);
var (psi_turn, S_turn) = courseAndDistance(_route[0], _route[1]);
var (psi_turn, S_turn) = courseAndDistance(_route[1], _route[2]);
var (psi_twy, S_twy) = courseAndDistance(_route[2], _route[3]);
_psi_park = psi_park;
_psi_twy = psi_twy;
......@@ -107,9 +118,9 @@ var start = func() {
_phase = 0;
_timer.start();
if (_sign < 0.0) {
gui.popupTip("Push back facing " ~ int(geo.normdeg(_psi_twy + 180.0 - magvar())));
screen.log.write("(pushback): Push back facing " ~ int(geo.normdeg(_psi_twy + 180.0 - magvar())) ~ ".");
} else {
gui.popupTip("Tow facing " ~ int(geo.normdeg(_psi_twy - magvar())));
screen.log.write("(pushback): Tow facing " ~ int(geo.normdeg(_psi_twy - magvar())) ~ ".");
}
}
......
# AUTOPUSH
# Visual entry of pushback route.
#
# Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
# Copyright (c) 2018 Autopush authors:
# Michael Danilov <mike.d.ft402 -eh- gmail.com>
# Joshua Davidson http://github.com/it0uchpods
# Merspieler http://github.com/merspieler
# Distribute under the terms of GPLv2.
......@@ -125,8 +127,8 @@ setlistener("/sim/model/pushback/route/show", func(p) {
var enter = func(start_immediately = 0) {
clear();
_preload_models();
_set_view();
_S_min = getprop("/sim/model/pushback/driver/S_min-m");
_set_view();
_S_min = getprop("/sim/model/pushback/driver/S_min-m");
var wp = geo.aircraft_position();
var H = geo.elevation(wp.lat(), wp.lon());
if (H != nil) {
......
......@@ -580,21 +580,21 @@
<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>
<K_i type="float">0.75</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">2.5</K_V>
<F_V type="float">5.0</F_V>
<K_V type="float">4.0</K_V>
<F_V type="float">8.0</F_V>
<S_min-m type="float">5.0</S_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>
<debug type="int">1</debug>
</pushback>
<ramp>
<!-- = nose bogey - VRP -->
......
......@@ -5,8 +5,10 @@
AUTOPUSH
Pushback dialog.
Copyright (c) 2018 Michael Danilov <mike.d.ft402 -eh- gmail.com>
Copyright (c) 2018 Joshua Davidson http://github.com/it0uchpods
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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment