Jump to content

I feel like I've done so little, yet so much, in KSP lately...


dewin

Recommended Posts

(TL;DR: Orbital mechanics is fun.)

So I recently finally decided to install kOS.  I'm a software developer by trade -- the only reason I put off kOS so long is I'd rather write in a real language (Python preferably).  But then I started having mod ideas that require an understanding of astromechanics to pull off correctly... and trying to learn them at the same time as learning C# and restarting KSP a bunch didn't seem like a good idea.

For the last month, I've launching KSP pretty much as soon as I got home from work every day.  But I haven't set foot in the VAB or SPH, launched any rockets, landed on any planets, or even left Kerbin's SOI.

What I have done feels more like rocket science to me than all of my previous hundreds of hours in KSP combined.

It began with an unplanned crash refresher course on mathematics.  By the way, almost all of the orbital math in KSP (and other cases of restricted 2-body problem) requires only basic algebra. This is good, because I never took calculus, differential equations, or anything else.  (I have a computer science background, but no formal education beyond high school knowledge that I've not really used much since then.)

Some of the more unusual math concepts I've dealt with are:

  • Complex numbers -- those with both real and imaginary (i = sqrt(-1)) parts.  This is mostly for trigonometry functions involving hyperbolas -- in practice, the actual formulas used don't have imaginary numbers at all.
  • Derivatives -- which are basically “What is the slope of this curve at this location”.  They look way more complicated than they really are -- it's really “what is the value of y at these two very close values of x, and what's the slope of the resulting line?”.  These are used for calculating velocity at a particular point in an orbit.
  • Formulas with no closed-form solution -- which means you can't truly “solve for x”, you can only test various values of x and see what gets you acceptably close to y.  A simple example of this is square roots: if you were to try to calculate sqrt(2), you know that it's greater than 1 (1*1=1) but less than 2 (2*2=4), so you might try 1.5 and so on until you converge on the solution.  Calculating eccentric anomaly (needed to find true anomaly) from mean anomaly is an example of this.

From there, I've spent a bunch of time learning about astromechanics.  (And I still am!)  kOS has lots of useful functions about getting information on an existing orbit, but those capabilities are nowhere near complete.  There's no MechJeb-esque “Plot a maneuver at LAN to raise inclination to 30 degrees” function.  Additionally, there's no built-in way to construct an arbitrary orbit (say… the effects of executing a possible maneuver).

So some of my goals are now:

  • Implementing all sorts of maneuver planning capabilities within kOS
  • Making it possible to select the most efficient plan to arrive at a given result.  For instance, bi-elliptic transfers are sometimes more efficient than Hohmann ones, and ascending/descending nodes are not always the best place to perform an inclination change.
  • Writing down everything I've learned, formulas and all, in a guide that is more approachable and doesn't require having to memorize all of the symbols involved.
  • At some point, actually playing the game again :wink:

Some interesting things that I've learned along the way:

  • Sometimes “North” or “South” (as related to the poles) are the best place to do inclination changes, against all logic.
  • North and South are always 90 degrees true anomaly away from LAN and LDN.
  • “Radial out” and “up” are not the same direction unless your vertical velocity is zero: at periapsis, apoapsis, or a circular orbit.
  • It's possible to turn a set of the six Keplerian elements into a pair of position and velocity vectors.  It's also possible to go the other way.  This is handy for orbit prediction.
  • Sometimes running an entire orbit while graphing data makes formulas blatantly obvious.
  • You can calculate latitude for any position in an orbit with the following formula:
    sin(λ) = sin(ω+Ω) * sin(i)
    or: sin(latitude) = sin(argument_of_periapsis + true_anomaly) * sin(inclination)
    I actually derived this formula myself by gathering a bunch of data and graphing it out (as opposed to finding it on the internet), so I’m pretty proud of this one.

 

 

For anyone else who might find themselves tempted to dive down the rabbit rocket hole, I thought I’d collect some of the resources I’ve found useful:

Edited by dewin
Link to comment
Share on other sites

You might be surprised how many astronauts spend a lot of time crunching numbers before a mission and not even feel bothered by it(Like, "Why am I doing this and not already docking with the ISS?").  For one thing, they are doing their part to ensure mission success, and another, it's in their blood.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...