From 5eaae0f63f9fafaf1bc8ccb35fca332e5fa01834 Mon Sep 17 00:00:00 2001 From: Valentin Verdier Date: Fri, 31 Dec 2021 00:48:10 +0100 Subject: [PATCH] fix maneuver accuracy --- boot/automate_01.ks | 2 +- libmaneuver.ks | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/boot/automate_01.ks b/boot/automate_01.ks index 394a051..99f3762 100644 --- a/boot/automate_01.ks +++ b/boot/automate_01.ks @@ -12,7 +12,7 @@ global g_direction is 90. global g_throttle is 1. global g_apoapsis is 80000. global g_gt_angle is 10. -global g_gt_velocity is 53. +global g_gt_velocity is 52. man_launch(g_direction, g_throttle). man_gravity_turn(g_direction, g_gt_angle, g_gt_velocity, g_apoapsis). diff --git a/libmaneuver.ks b/libmaneuver.ks index c02f209..21c62d8 100644 --- a/libmaneuver.ks +++ b/libmaneuver.ks @@ -5,7 +5,7 @@ global function man_get_dv { local rp is radius + p_periapsis. local ra is radius + p_apoapsis. local a is (ra + rp) / 2. - return sqrt(ship:body:mu * (2/rs - 1/a)). + return sqrt(ship:body:mu * (2 / rs - 1 / a)). } global function man_get_dv_hohmann { @@ -78,11 +78,11 @@ global function man_node_exec { lock throttle to 1. wait until tf - time:seconds < 0.25. lock steering to ship:facing. - lock throttle to 0.25. - set dur to man_get_duration(nd:deltav:mag, 0.25). - set ti to time:seconds. - set tf to ti + dur. - wait until tf - time:seconds <= 0. + lock throttle to 0.1. + local dv is nd:deltav:mag. + until nd:deltav:mag > dv { + set dv to nd:deltav:mag. + } lock throttle to 0. remove nd.