ElWanderer / kOS_scripts

kOS scripts and libraries
28 stars 8 forks source link

Equatorial satellite launches have wrong argument of periapsis #146

Closed ElWanderer closed 4 years ago

ElWanderer commented 4 years ago

I think this is because the LAN is somewhat randomised after launching into an equatorial orbit, so the position of the periapsis is determined incorrectly.

Maybe for very low inclination orbits, the code to change ap/pe needs to work differently rather than basing calculations on the current orbit.

ElWanderer commented 4 years ago

If the inclination is very close to 0 (or 180), our orbit's LAN and ARGUMENTOFPERIAPSIS may be 'horribly' wrong.

True anomaly is determined from the periapsis, so we want to know what angle to shift our periapsis by. Currently this is done by subtracing the current argument of periapsis from the target value. Implicitly, that trusts that the longitude of the ascending node is correct. Need to work out the current argument of periapsis based on the solar prime vector and desired LAN? Erm, this needs determining, possibly with diagrams.

ElWanderer commented 4 years ago

The new code put three satellites into identical Equatorial orbits, whereas the old code put a fourth into an orbit with the argument of periapsis in a completely different place. I've not had any suitable satellite contracts generated to test that it's actually correct, though.

ElWanderer commented 4 years ago

I've tested this since getting a suitable satellite contract. It hit the target orbit correctly.