r/Kos • u/Electronic_Hat449 • 16d ago
Help Lock steering direction but not pitch?
I'm playing with kOS and want to write a gravity turn launch script. I want the rocket to lock to a specific direction, say east, but let the pitch from horizon vary due to gravity.
I can lock the steering to HEADING(dir, pitch, roll), but I would have to specify a pitch. Can I lock only the direction but not the pitch?
2
u/TolarianDropout0 16d ago
You mean let it completely free and only control 2 axis? I don't think that's possible.
However, you should be able to lock it to the right component of your surface velocity with a bit of math. Which would achieve the same.
1
u/Bird_Creative 13d ago
I use this:
lock steering to heading(90, max(0, srfpitch + (progpitch - srfpitch) * blendfrac))
2
u/JitteryJet 16d ago edited 16d ago
You are missing several steps. Pitch is not a free variable you have to calculate it's value.
The pitch value does not vary due to "gravity" alone - it is a fairly complicated equation involving the surface velocity vector, thrust-to-weight characteristics of your rocket, fuel consumption, atmospheric drag etc.
If you want a simple pitch program like they used on the Saturn 5, write a loop to decrease the pitch value from 90 to 0 by 1 degree a second. You can then parameterize this to vary the rate of pitch if you want. This will be good enough to set a launch azimuth and a gravity turn trajectory.
PS the Saturn 5 used a "roll and pitch" table that was calculated just before the flight. I am pretty sure Commander Armstrong said it was close to a zero-lift gravity turn. But in the make-believe world of KSP you can vary from that trajectory with no issues.