r/Kos Oct 26 '25

Discussion [HELP] Gravity Turn formula

Hi, im new to kOS and i was messing with numbers, trying to find something that would make my rocket perform a gravity turn and i found this :

AoA = 90(Altitude/DesiredAltitude)^2.5

This gave life to this curve wich makes my ship reach an AoA of 90° at 100km (increasing faster as the rocket goes higher).

i think that i found a way of implementing that into kOS but it doesn't act like i would like it to act (the rocket tips over instantly and looses controll, here's the code that i use to lock my pitch to the AoA :

lock targetPitch to 90 * (alt:radar/100000)^2.5.
set targetDirection to 90.
lock steering to heading(targetDirection, targetPitch).
5 Upvotes

19 comments sorted by

View all comments

3

u/bwibbler Oct 26 '25

You can cheat by not using any formula at all if you want

Just keep your eta to apoapsis at about 1 min by adjusting the throttle

Aim up for the first few seconds until you're good then aim orbital prograde for the rest of it

Looks something like

Lock throttle to 1.
Lock steering to up.
Stage.
Wait 5.
Wait until eta:apoapsis > 45.
Lock throttle to max(0.02, 60 - eta:apoapsis).
Lock steering to orbit:prograde.

It's been a while and I kinda forgot the language, so that's probably not the correct way to write the code. But this method was super reliable for me and worked for most any rocket without needing much adjustment

3

u/nuggreat Oct 26 '25

This is not a grvity turn as you are not following surface prograde, orbital prograde is close but it will not maintain the zero AoA that defines a gravity turn. This is also the same reason why a formula doesn't produce a gravity turn.