# how do you manually calculate a trajectory with out map mode

## Recommended Posts

how does mission control calculate where you will end up and how map calculates this. like for translunar injection how do you know how your orbit is by not using map mode

##### Share on other sites

Welcome to Orbital Mechanics 101: the Vis-viva equation!

##### Share on other sites
18 minutes ago, Steel said:

Welcome to Orbital Mechanics 101: the Vis-viva equation!

I understand the gravitational parameter and thanks for the extra info but I want to know what path I will take when I burn also I love orbital mecanis but I lack the knolage of how to calculus but I want to learn how to

##### Share on other sites
10 minutes ago, alpha tech said:

I understand the gravitational parameter and thanks for the extra info but I want to know what path I will take when I burn also I love orbital mecanis but I lack the knolage of how to calculus but I want to learn how to

Every orbital path taken in KSP can be described as either an ellipse (normal orbits), a parabola or a hyperbola (escape trajectories). For the majority of cases you're dealing with an ellipse of some sort, in which case the path can be fairly easily worked out from the equations for an ellipse if you know your orbital height and the semi-major axis of your orbit).

Also, luckily for you there is absolutely no calculus required to use the vis-viva equation or to do pretty much anything to do which coplanar orbits (i.e. no inclination changes).

Edited by Steel

##### Share on other sites
3 minutes ago, Steel said:

Also, luckily for you there is absolutely no calculus required to use the vis-viva equation or to do pretty much anything to do which coplanar orbits (i.e. no inclination changes).

I don't suppose you could please sum up or refer me to an explanation of the calculus needed for inclination changes? I've been trying to do them with simple trigonometric approximations (dV = -2.0 * preBurnVelocity.magnitude * Math.Sin(0.5 * relativeInclination)), and the resulting burns are just a bit too inaccurate. (As far as I can tell, the equation for this on Wikipedia is even more wrong than what I have now.)

##### Share on other sites
10 minutes ago, HebaruSan said:

I don't suppose you could please sum up or refer me to an explanation of the calculus needed for inclination changes? I've been trying to do them with simple trigonometric approximations (dV = -2.0 * preBurnVelocity.magnitude * Math.Sin(0.5 * relativeInclination)), and the resulting burns are just a bit too inaccurate. (As far as I can tell, the equation for this on Wikipedia is even more wrong than what I have now.)

Thinking back on it, I'm not entirely sure there's calculus involved in inclination changes either, but you do have to think about doing things in terms of vectors rather than scalars, it makes everything a whole lot easier.

Edited by Steel

##### Share on other sites

So with distances and directions rather than just plain old numbers

##### Share on other sites
6 minutes ago, alpha tech said:

So with distances and directions rather than just plain old numbers

Yes, if you want to get really into orbital mechanics then you'll need to be comfortable with vectors as well as things like vector dot- and cross-products. Also using coordinate systems other than the Cartesian (x y z) system will simplify a lot of problems (i.e spherical polars).

However, this is all overkill if all you want is to work out basic orbital parameters.

##### Share on other sites
2 minutes ago, Steel said:

Yes, if you want to get really into orbital mechanics then you'll need to be comfortable with vectors as well as things like vector dot- and cross-products. Also using coordinate systems other than the Cartesian (x y z) system will simplify a lot of problems (i.e spherical polars).

However, this is all overkill if all you want is to work out basic orbital parameters.

There are other cordnate systems other than cartesian

##### Share on other sites
14 minutes ago, alpha tech said:

There are other cordnate systems other than cartesian

You have much to learn young padawan.

Spherical polar coordinates are absolutely great for problems involving central potentials (fancy way of saying forces that pull stuff towards a central point) i.e. gravity, magnetism and many others. In this system, rather than x,y and z, you use r (the distance from the centre of whatever you're working on), theta (the angle above or below horizontal) and phi (the angle left or right of vertical).

As I said before though, really not necessary (and cause of a lot of headaches if used incorrectly) unless you want to dive deeper into the subject.

Edited by Steel

##### Share on other sites

The part that I have never managed to crack is working out when in time a specific point of orbit will be reached. It isn't so much of a problem if you are only interested in the time to go from PE to AP (Hohmann transfer) (1/2 the orbit period) or with circular orbits like the Mun's. As soon as there is eccentricity involved or transfers other than exactly half an orbit then it becomes hard to work out if your target will actually be there at the time when your orbit crosses it's orbital path.

I think it is at that point you need to start working out the eccentric anomaly, mean anomaly and true anomaly.

##### Share on other sites
2 hours ago, tomf said:

The part that I have never managed to crack is working out when in time a specific point of orbit will be reached. It isn't so much of a problem if you are only interested in the time to go from PE to AP (Hohmann transfer) (1/2 the orbit period) or with circular orbits like the Mun's. As soon as there is eccentricity involved or transfers other than exactly half an orbit then it becomes hard to work out if your target will actually be there at the time when your orbit crosses it's orbital path.

I think it is at that point you need to start working out the eccentric anomaly, mean anomaly and true anomaly.

Exactly that, some combination of the three anomaly values will give you angles and times.

##### Share on other sites
On 2/3/2017 at 11:42 AM, tomf said:

I think it is at that point you need to start working out the eccentric anomaly, mean anomaly and true anomaly.

Ding ding ding, this is correct.  For those less well versed on orbital mechanics, here's what those are:

• True anomaly (theta) is the actual angular position along an orbit, measured from the primary focus.  This is the thing that we want.
• Mean anomaly is a 'rough guess' term that amounts to 2*pi*time / period - not really useful for anything other than circular orbits and for a baseline comparison between orbits.
• Eccentric anomaly (E) is the angular position, measured from the center of a circle with radius equal to your semimajor axis (a).

While it is possible to geometrically solve for theta as a function of time directly the equation is, as we say in the biz "pretty gross"; however, solving for E and then converting to theta is much nicer. Equations are as follows:

Kepler's Equation: (2*pi*t) / T = E - E*sin(e)     where T is the orbital period and e the eccentricity.

While Kepler's equation isn't super useful on its own, it does allow us to do some geometry and get another equation:

cos(E) = (e + cos(theta)) / (1 + e*cos(theta))

or

tan(E/2) = sqrt((1 - e) / (1 + e)) * tan(theta/2)

If the intersection altitude is known, using geometry the true anomaly can be determined.  From that, you can use the above equation to find eccentric anomaly, and from there, multiply Kepler's equation by T / 2*pi to solve for time t.  This does require the eccentricity of the transfer orbit to be known, so this is not a one-shot deal.

Edited by natsirt721

##### Share on other sites
On ‎2‎/‎2‎/‎2017 at 2:09 PM, Steel said:

very orbital path taken in KSP can be described as either an ellipse (normal orbits), a parabola or a hyperbola (escape trajectories). For the majority of cases you're dealing with an ellipse of some sort, in which case the path can be fairly easily worked out from the equations for an ellipse if you know your orbital height and the semi-major axis of your orbit).

Also, luckily for you there is absolutely no calculus required to use the vis-viva equation or to do pretty much anything to do which coplanar orbits (i.e. no inclination changes).

I know that they can all be described as elipses ,parabola, or hyperbola. but I want to know, if I make a burn where will I end up what path does it go, like if I go to the moon will I go to the sun on an escape, or will I get a free return.

##### Share on other sites

Well, impossible with info you get in capsule or in external view.

With some mod which gives you better flight computer in capsule no problem at all.

##### Share on other sites

The calculation unavoidably includes at least one transcendental equation mentioned by @natsirt721, so the problem can't be resolved analitically by just a manual substitution of values into a sequence of formulas. (Sad but true).
In fact, at least two trancendentals (for ship for target) and then an iterative process of minimizing the result.
So, in any case one should write a whole program, just to get the same what he would get from MechJeb or KSP graphical visualization.

This book contains formulas for a calculator.

Edited by kerbiloid

##### Share on other sites
On 2/7/2017 at 10:00 AM, alpha tech said:

I know that they can all be described as elipses ,parabola, or hyperbola. but I want to know, if I make a burn where will I end up what path does it go, like if I go to the moon will I go to the sun on an escape, or will I get a free return.

Take a look at this page.  You can ignore the perturbations equations as KSP assumes a spherical body and no outside forces.

Edited by natsirt721

##### Share on other sites

The answer turns out to involve quite some time in a spreadsheet, if the question is "Where will this particular velocity vector take me from this position". The question "What burn will take me to the Mun?" is much easier, as you can use the equations for a Hohmann transfer. When I started playing KSP, I did it without maneuver nodes and used a transparent angular ruler against my monitor to check phase angles.

I have been going at the difficult question for some time, and have managed to write modules in excel to compute the eccentric anomaly from mean anomaly and eccentricity; and thus effectively the position of every celestial body in the Kerbol system at any given time. I could expand this to calculate the Keplerian elements of a craft after a burn (although I will need a precise angle of flight in addition to velocity and altitude, easily gotten from either KER or a slight software update of my control panel). Then, I could at a glance tell whether on an escape trajectory or not, and calculate position (longitude and altitude) at a given time and compare with SOI's of relevant bodies. I would not trust it going interplanetary, though. The precision would leave a lot to be desired.

The real reason for above spreadsheet is that a Minmus refueling station needs some serious predictions in order for a deep space vehicle to break orbit from Minmus at the right time. Then you can lower periapsis so it is right where you want it to, when you want it to be, for a full utilization of the Oberth Effect when going interplanetary. I am in the testing phase, and inclination changes are a problem still. But I will get there.

##### Share on other sites

But How Does the game engine calculate the trajectory it will take when you go to the mun and if you will sling shot and go in to interstellar space or a free return trajectory

##### Share on other sites

learning the math is one thing, but how does one gather the required inputs. thats actually the hard part. i figure an inertial measurement unit is enough to track your position, with frequent calibrations from star tracking cameras to keep your inertial reference up to date (it will drift over time). a radar pointing at the center of the body you are orbiting will reveal your altitude and allow you to determine your apses when the reading reaches a peak or a valley. star trackers also get all the other orbital parameters. ground tracking can also determine your position and trajectory for you and relay up the parameters.  i dont know how ground tracking works around distant bodies, but it probibly involves trilateration, other space craft telescopes on earth, and a lot of linear algebra.

## 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.