Forget using a PID loop, just lock to the throttle function and simplify it.

This commit is contained in:
Anna Rose Wiggins 2021-07-19 20:06:38 -04:00
parent 45ca153f2f
commit 401f51425f
3 changed files with 20 additions and 25 deletions

View file

@ -1,5 +1,5 @@
run once "lib/throttle".
run once "lib/navigation".
runoncepath("lib/throttle").
runoncepath("lib/navigation").
parameter APOAPSIS_TARGET is 80000.
parameter GRAVITY_TURN_START is 8000.
@ -20,16 +20,10 @@ from { local x is 5. } until x = 0 step { set x to x - 1. } do {
wait 0.5.
}
// throttle controls
when TWR() > 1.5 then {
if SHIP:ALTITUDE > 32000 {
lock THROTTLE to 1.0.
return false.
}
lock THROTTLE to ThrottleToTWR(1.5).
return true.
}
// Hold throttle to maintain 1.5 TWR.
// We do *not* use a PID Loop here because we can
// calculate the correct value discretely.
lock THROTTLE to ThrottleToTWR(1.5).
// Main ascent control.
lock THROTTLE to 1.0.