Plotting the course of a spaceship

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Aug 28, 2009 at 22:49

I’m trying to find some information for how to plot a course and fuel consumption of a space craft traveling from the orbit of one planet to a second one. The space craft might also start out in random space with an initial velocity.

The assumptions are as follows: Planets, moons etc, will be moving in a solar system in elliptical orbits (according to Kepler) and exert gravity. I want a player to know in advance given a start time of T0 where he needs to apply his engines and if he has enough fuel to complete the mission. The ship will then follow a predetermined course according to the calculation. The course might use the slingshot effect of planets to help him on his way. I know NASA does this stuff all time so they must have some software to do it, but I can’t find anything definitive on the web. Anyone know anything about this?

12 Replies

Please log in or register to post a reply.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Aug 28, 2009 at 23:11

Orbital maneuvers are basically about changing your ship’s velocity to put yourself in a different orbit. Usually one doesn’t use long continuous burns but short and fast ones, so to a first approximation you can think of a burn as instantaneous, consuming an amount of fuel proportional to the desired change in velocity (so-called “delta-v”). You then need to plot a sequence of changes of orbit that put you at your destination.

One basic maneuver is the Hohmann transfer, which lets you raise or lower your orbital altitude. For slingshots check out the gravity assist page. Finally another interesting thing to look at is the so-called Interplanetary Transport Network, which is a system of low-energy (but very slow) paths between various Lagrange points in the solar system.

I don’t know of any software for designing space missions / plotting orbital trajectories, but it seems like it might not be too hard to homebrew something that will work well enough for a game with realistic orbital mechanics.

B20d81438814b6ba7da7ff8eb502d039
0
Vilem_Otte 117 Aug 28, 2009 at 23:26

I don’t know of any software for designing space missions / plotting orbital trajectories, but it seems like it might not be too hard to homebrew something that will work well enough for a game with realistic orbital mechanics.

I know of one very good - Orbiter space flight simulation http://orbit.medphys.ucl.ac.uk/ it is very good and has lots modifications.

#author - Try contacting the author of this (it’s closed source freeware, although I think that guy might give you better answers than us).

E1bddb31000e459fb3ee5593fe067486
0
paul0n0n 101 Aug 30, 2009 at 17:56

@SyntaxError

I’m trying to find some information for how to plot a course and fuel consumption of a space craft traveling from the orbit of one planet to a second one. The space craft might also start out in random space with an initial velocity.

If your just looking at how to plot the course you could make a duplicate ship of the initial ship and sense your using a physics model you probably have time as a variable in there , just make the duplicates time 0 through all your gravity and duplicate ship calculations. If suppose that you would instead like to use a line for the ships course then you could set up an array and, instead of placing the duplicate ship at each calculated x,y,z point, store the coordinates in the array and use the array to plot the line.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Aug 31, 2009 at 21:30

Thanks for the responses. I already know more or less about the basics. In fact I could probably do a space travel simulation given manual control of a ship just by applying gravity and trust in time increments. What I’m worried about is that it might be practically impossible for a player to fly a spacecraft on a course through orbiting planets and end up with a nice orbit around the destination planet (which is again a moving target). My game is meant to be an MMORPG not a space flight simulator, yet I want space flight to be somewhat realistic.

I not that enamored with first person space flight we get in many games. It just seems kind of cheese ball to me. I would rather leave the first person stuff to the character part of the game and have the space flight view be a 3D picture of a solar system, with your ship and other ships marked out on the map. You would then be able to select a planet and issue a “plot a course to orbit of planet X” command or something of that nature. The game would then calculate a course or courses considering the moving planets, their gravity wells, slingshot effects and the required fuel. Obviously time scales would be compressed. The player would select the desired course from a list and initiate countdown.

@Reedbeta

I don’t know of any software for designing space missions / plotting orbital trajectories, but it seems like it might not be too hard to homebrew something that will work well enough for a game with realistic orbital mechanics.

I’m not so sure. I would imagine all this requires some fairly complex prediction. Over the weekend I was surprised to learn that even calculating the elliptical orbit a single planet over time requires you to solve something called Kepler’s Equation. This isn’t a simple plug in the numbers formula. Evidently you need to use one of several algorithms to solve it. Fortunately they seem to be freely available on the internet; however it did open my eyes to the fact that predicting courses though a solar system is probably a non-trivial task.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Aug 31, 2009 at 21:54

@SyntaxError

Over the weekend I was surprised to learn that even calculating the elliptical orbit a single planet over time requires you to solve something called Kepler’s Equation. This isn’t a simple plug in the numbers formula.

Giving the Wikipedia article on it a once over, it looks like the problem is just that there isn’t an elementary formula solving for E in the equation M = E - epsilon * sin(E). Yeah, it’s a little inconvenient, but there’s no elementary formula for sqrt either. The function seems well behaved, at least for reasonable eccentricities; surely you can approximate it with a polynomial, or precompute lookup tables for the regime you’re interested in, and maybe use Newton’s method to increase precision - in short, evaluate that function the same way things like sqrt, sin, exp and so on are usually evaluated by computers.

6f0a333c785da81d479a0f58c2ccb203
0
monjardin 102 Aug 31, 2009 at 22:02

What about approaching it like an error minimization problem with an iterative solution?

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Sep 01, 2009 at 18:17

@Reedbeta

Giving the Wikipedia article on it a once over, it looks like the problem is just that there isn’t an elementary formula solving for E in the equation M = E - epsilon * sin(E). Yeah, it’s a little inconvenient, but there’s no elementary formula for sqrt either. The function seems well behaved, at least for reasonable eccentricities; surely you can approximate it with a polynomial, or precompute lookup tables for the regime you’re interested in, and maybe use Newton’s method to increase precision - in short, evaluate that function the same way things like sqrt, sin, exp and so on are usually evaluated by computers.

I’m not the best math wiz but after doing a bit of wiking myself I do follow you. I was able to get the basic planet orbit class working with no apparent issue. I’m still thinking that pre-plotting a spacecraft course is no small task. When you think about it there are a huge number of solutions. If you just look at the simple case with no planets you can get from A to B with a short burn to get you going and another short burn to stop you. You can also use longer burns that will get you there faster but use more fuel. Now add in the moving planets and you see all the possibilities. If memory servers me one NASA probe actually used Venus and Earth as slingshots to get to Saturn. I guess that’s where you get the phrase “It ain’t rocket science”, except in this case “it is rocket science” :) I think I’ll just have to bang on this some more over time. I have so many things to work on so I can do some research in parallel.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Sep 01, 2009 at 18:52

Yep, that was Cassini. It actually made four gravity assists (slingshots) - two around Venus, one around Earth, and one around Jupiter. Pretty amazing that it managed to get to its destination - I don’t even want to know how many decimal places they needed to compute its orbits!

It seems to me you might use some sort of A* algorithm to try out possible slingshot paths.

Anyway, it’s an interesting problem…now that you’ve gotten me thinking about it, I may try a few experiments myself! :)

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Sep 07, 2009 at 11:37

Are you talking about trying to compute an optimal path, potentially containing an arbitrary number of thrusts in any direction?

If you did it without thrusts, it seems like a problem more suited to global optimization techniques than graph algorithms.

With thrusts, it seems more like a combination of many techniques. You’d probably quantize the time and thrusts so that you can generate some nodes for A*, then use a combination of math and global optimization as vertex evaluators.

Could be fun though. The problem I find with games involving gravity like that is that they’re too damn hard. It’s nearly impossible to stop yourself crashing into a planet. :)

254754b37f468a2926bffcd83bbbf1fa
0
z80 101 Sep 08, 2009 at 05:49

@poita

Could be fun though. The problem I find with games involving gravity like that is that they’re too damn hard. It’s nearly impossible to stop yourself crashing into a planet. :)

Yes, good point. If you have a realistic space flight simulation you need a complex autopilot too to make it at least possible to control for the pilot.

Cool idea to make realistic space flight btw. There are too many unrealistic space games out there.

5225bc0c3bf66f4c275c332de6388d1f
0
SyntaxError 101 Sep 08, 2009 at 14:40

@poita

Are you talking about trying to compute an optimal path, potentially containing an arbitrary number of thrusts in any direction?

Yes something like that. However I’m not sure there is a single optimal path. You could probably optimize for fuel consumption, speed or some combination of the two.
@poita

If you did it without thrusts, it seems like a problem more suited to global optimization techniques than graph algorithms.

I’m not sure what you mean. If you use no trusts you would end up where gravity wants to take you. Perhaps you meant an initial burn and then no thrusts after? However I’m guessing you would need to apply thrusters at the end to at least put you in orbit assuming you weren’t using the atmosphere slow you down.

Could be fun though. The problem I find with games involving gravity like that is that they’re too damn hard. It’s nearly impossible to stop yourself crashing into a planet. :)

Yes that’s kind of my motivation. Apollo 11 landing aside, in real life I’m sure computers are used for space navigation. I want to simplify it to where the player just tells the game where he wants to go, and maybe selects from a few possible routs, like a low fuel rout or fast route.

36b416ed76cbaff49c8f6b7511458883
0
poita 101 Sep 08, 2009 at 15:24

I’m not sure what you mean. If you use no trusts you would end up where gravity wants to take you. Perhaps you meant an initial burn and then no thrusts after? However I’m guessing you would need to apply thrusters at the end to at least put you in orbit assuming you weren’t using the atmosphere slow you down.

Ah sorry. I meant with an initial velocity e.g. firing a bullet.

If you wanted to end up in orbit then that would be difficult.