ElWanderer / kOS_scripts

kOS scripts and libraries
28 stars 8 forks source link

Launch to Minmus, circularisation mis-aligned #145

Closed ElWanderer closed 4 years ago

ElWanderer commented 4 years ago

The last change I made to circularisation in v1.1 branch seems to have a weird issue.

I launched into Minmus's orbital plane, and was within 0.004° relative inclination on leaving the atmosphere (it helped it was a fairly weak upper stage, so spent a lot of time burning). It should have only needed 30m/s or so to circularise, but instead it plotted a 250m/s burn sideways, that put it into a 6° inclination with completely the wrong LAN.

I think the azimuth calculation got the wrong end of the stick when working out if it needed to burn northwards or southwards.

ElWanderer commented 4 years ago

Hmmm, to calculate the circularisation burn we call launchBearing() which in turn calls bearingSouth(). The latter checks whether the ship's latitude will go North or South over the next five seconds. If we have a long time between now (leaving the atmosphere) and the apoapsis, I guess it's possible we go past the highest/lowest latitude of our trajectory, in which case the calculation would be wrong.