Improve maneuver node execution accuracy by basing time-to-burn on the

estimated burn duration of half of the delta-V instead of half of the
estimated duration of the entire burn to account for the acceleration
increasing over the course of the burn as the rocket uses fuel.
This commit is contained in:
Casper V. Kristensen 2019-06-20 00:14:44 +02:00
parent 5fd4bfc3d7
commit 0e6904da89
Signed by: caspervk
GPG key ID: 289CA03790535054

View file

@ -74,20 +74,20 @@ function execute_burn {
lock STEERING to node. lock STEERING to node.
wait until vang(SHIP:facing:vector, node:burnvector) <= 0.5. wait until vang(SHIP:facing:vector, node:burnvector) <= 0.5.
local warp_time is max(0, node:eta - (burn_duration/2) - 5). // 5s before we need to start burn // Start time is based on half of the delta-v instead of half the burn time to account for the acceleration increasing
if warp_time { // over the course of the burn as the rocket uses fuel, and thus the 2nd half of the burn will take less time than the first.
print "Warping to maneuver node". local burn_start_time is TIME:seconds + node:eta - estimated_burn_duration(node:deltav/2).
warp_for(warp_time). warp_to(burn_start_time - 3). // 3s before we need to start burn
print "Approaching maneuver node". print "Approaching maneuver node".
wait until node:eta <= ceiling(burn_duration/2). // ceiling since we'd rather start the burn too soon to have time for perfecting it wait until TIME:seconds >= burn_start_time.
}
print "Burn!". print "Burn!".
// Decreasing throttle linearly with burn duration will only have an effect below 1s, otherwise it will be at max // Decrease throttle linearly with burn duration when under 1 second, but ensure we always finish by burning with at least 1% power at all times.
lock THROTTLE to max(0.01, burn_duration). // ensure we always finish the burn by burning with at least 1% power at all times lock THROTTLE to max(0.01, min(1.0, burn_duration)).
// The burn vector will start to drift once we have very little left to burn. Therefore, save the burn vector as it is right now, and lock steering to it, instead of the dynamic vector // The burn vector will start to drift once we have very little left to burn.
// Therefore, save the burn vector as it is right now, and lock steering to it, instead of the dynamic vector
wait until burn_duration <= 1. wait until burn_duration <= 1.
local dv0 is node:burnvector. local dv0 is node:burnvector.
lock STEERING to dv0. lock STEERING to dv0.