ElWanderer / kOS_scripts

kOS scripts and libraries
28 stars 8 forks source link

Support launching satellites into Solar orbit #126

Closed ElWanderer closed 3 years ago

ElWanderer commented 7 years ago

Not quite the same as inter-planetary transfers.

The existing libraries and boot scripts are almost able to do this, but there are some things to fix first - e.g. there is no sanity check (destHASBODY) prior to calling dest:BODY, which crashes if the destination is the Sun.

It's possible to rig up a solar satellite boot script by making a few alterations to KMSat.ks.

ElWanderer commented 7 years ago

Notes after that submission:

A temporary version that enables staging and doesn't try to do a circularisation burn works... (after making some corresponding changes to lib_orbit_match.ks and lib_orbit_change.ks) but may require a very overpowered rocket! The game generated a fairly evil orbit (Solar orbit, 41x27Gm, inclination -174 degrees) that I have managed to fulfil, but my rocket needed about 17km/s (and had only 50m/s left over) due to the inefficiency of the initial orbit (putting the apoapsis in completely the wrong place).

ElWanderer commented 7 years ago

Another problem - Kerbin's orbit is a pure circle, so our calcTa() function, called from taAt(), falls over when trying to determine where it is. In this case, we can cheat slightly, and use ORBIT:TRUEANOMALY to get the current anomaly, knowing it will advance at a constant rate over the period of an orbit.