Calculating trajectory of spaceship-like object

  • Thread starter Thread starter hospadar
  • Start date Start date
  • Tags Tags
    Trajectory
Click For Summary
The discussion focuses on developing a 2D video game featuring spaceship mechanics, where players can specify a destination and desired velocity. Key elements include the ships’ fixed turning speeds, maximum speeds, and limited thrust directions, with no friction or external forces acting on them. The challenge lies in calculating the best trajectory by combining velocity and position math, particularly in determining when to turn and thrust. References to astrodynamics literature, including Lambert's problem, are provided for deeper understanding, although the complexity of finite burns is noted as a limitation in typical graduate texts. Ultimately, the goal is to create a visually smooth acceleration experience while using instantaneous delta-v calculations.
hospadar
Messages
2
Reaction score
0
I want to make a simple little video game with spaceships in it. The game only takes place in 2 dimensions, although I suspect any math would be applicable to more dimensions.

The spaceships:
- Have a set turning speed (radians/sec, different ships may be able to turn faster or slower)
- Have a maximum speed (not realistic for space, but better for video games)
- Have thrusters which only provide thrust in a limited number of fixed directions. Most likely only forwards or only forwards and backwards.
- The spaceships will have inertia, and there will be no friction acting on them
- There will be no (predictable) forces acting on the spaceship other than the thrusters, no gravity, etc.
- The mass/inertia of the ship doesn't change ever


The User will specify where they want their spaceship to end up, and the heading and speed they want to have when their ship arrives at the destination. So I need to take an initial position and velocity, a final position and velocity, and generate a set of turns and thruster firings that will deliver the ship to the final position at the correct velocity.

So what I need to figure out is how to actually compute the best trajectory, when to turn, when to thrust, etc. It may not be possible to guarantee the best possible trajectory, but as long as I can compute a decent, reasonable looking trajectory, the rest can be left up to the user (if a user isn't happy with a trajectory they could plot it in many steps for example).

My quandary really is how to combine the velocity math with the position math. It's easy enough to calculate the turns and thruster firing which will change one velocity to another (simple vector addition/subtraction), and it doesn't seem terribly difficult to figure out how to get a ship with a certain velocity from one point to another (more relatively simple vector math).

Any thoughts/suggestions/references would be much appreciated.

Thanks!
 
Physics news on Phys.org
You are, perhaps innocently, asking us to write a book for you. Multiple books, in fact, and all at the graduate level.

Some refererences:

Fundamentals of Astrodynamics and Applications by David Vallado is an excellent reference. Some of the section regarding Lambert's problem is available at Google books: http://books.google.com/books?id=PJLlWzMBKjkC&pg=RA1-PA448#v=onepage&q=&f=false

Fundamentals of Astrodynamics by Bate, Mueller, and White also covers the topic.

Chapter 2 ("Guidance Algorithm") of http://dspace.mit.edu/bitstream/handle/1721.1/34137/67775726.pdf?sequence=1" does a nice job of describing Lambert's problem.

The graduate level aerospace engineering class "Space Flight Dynamics" at University of Colorado covers this topic (along with many other topics). Home page for ASEN5050: http://ccar.colorado.edu/asen5050/ASEN5050/Overview.html. Click on the "Lectures" button at the top. Lectures 8-12 cover orbital maneuvers. Lecture 11 covers "Lambert's Problem".


Note that all of the above except for the thesis paper assume impulsive delta-Vs (instantaneous changes in velocity). Using finite burns, which is what you are asking about, is beyond the scope of most graduate level textbooks.


To spice things up for your users, you might want to occasionally flash the message "Lambert target algorithm failure" to your users. Seeing that message certainly did spice things up for the astronauts and mission controllers for STS-49 and STS-51. See http://ston.jsc.nasa.gov/collections/TRS/_techrep/CR-2007-213697.pdf for details.
 
Last edited by a moderator:
Thanks for the reply, very helpful.

I would actually be useing instantaneous delta-v "under the hood" although it would appear to the user visually as smooth acceleration.
 
For simple comparison, I think the same thought process can be followed as a block slides down a hill, - for block down hill, simple starting PE of mgh to final max KE 0.5mv^2 - comparing PE1 to max KE2 would result in finding the work friction did through the process. efficiency is just 100*KE2/PE1. If a mousetrap car travels along a flat surface, a starting PE of 0.5 k th^2 can be measured and maximum velocity of the car can also be measured. If energy efficiency is defined by...

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
7K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 74 ·
3
Replies
74
Views
6K
Replies
3
Views
8K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 14 ·
Replies
14
Views
5K
  • · Replies 4 ·
Replies
4
Views
2K