Orbital Intercept

Started by
8 comments, last by Wasting Time 17 years, 5 months ago
I am developing a game and I am having difficulty with a certain problem. We attempted a brute force method, but it simply isn't efficient enough. I have looked everywhere for guidance, so hopefully someone here can help me. The game is in 2D, so x,y. Assume a ship is out in space, not moving. It wants to meet and dock with a planet that is in a circular orbit. The ship's speed is constant (does not accelerate). Where must the ship fly in order to meet up (intercept) with the planet? This has been a particularily difficult problem for me, there seems to be a plethora of information on linear intercepts, but I can't seem to find any easy to understand information on this particular issue. Any help would be appreciated. Jonathan
Advertisement
Does the ship move in a straight line?
Look up projectile motion. You may be able to use this to describe the motion of the space station. You would then find the intercept between the (assumed) linear path of the ship and the orbital ring of the station. Then calculate (using projectile motion) at what 'time' the ship should start moving so's that they meet at a particular point.

It's a kind of vague answer to a kind of vague question, maybe a screenshot would help? I'm almost 100% sure there will be a way to calculate it, you may have to use calculations of a tangent, deriviates, dynamics etc. (ie. calculus & newton's laws) to do this.
"You are a God amongst insects. Never let anyone tell you any different..."
Conic sections, and NASA pages. It has few free books in HTML format.
Also google for transfer orbit.
A couple of assumptions, which you can correct if they are wrong. First, the ship travels on a straight-line path with constant speed, s, and s is specified. Second, the planet travels along a circular path with constant angular speed, w, and w is specified. Third, the ship is initially outside the circular path. For the sake of argument, translate the system so that the circle center is at the origin.

The planet's path is r*U(t) = r*(cos(w*t),sin(w*t)), where r is the radius of the circle, w is the angular speed, and the vector U(t) has unit length. The ship's path is P + t*s*V, where P is the initial position, s is the speed, and V is the direction of motion which is a unit-length vector.

The ship intercepts the planet when P + t*s*V = r*U(t). The unknowns are time t and the direction V. Solve for V = (r*U(t) - P)/(s*t). Since V must be a unit-length vector, it is necessary that Length((r*U(t) - P)/(s*t)) = 1. You may rewrite this using P = (px,py):

(r*cos(w*t)-px)^2 + (r*sin(w*t)-py)^2 = s^2*t^2

The left-hand side is a periodic and positive function of t. The right-hand side is a parabola with vertex at the origin. When you plot the graphs of these functions, you can see that there can be multiple crossings, which means that there can be multiple answers for the intercept time t. For each intercept time, you can compute V as shown previously.

Solving for t requires numerical methods, since it is not possible to construct a closed-form solution for the t-equation.
Just as an aside, you can simplify your numerical solution by recognizing that the time interval has to lie between d±r/v, where d is the distance between the origin of the circle and the ship's initial position, r is the radius of the circle, and v is the constant speed of the ship.

This means that your window of opportunity for impact is the time interval (2a/v)s. (I'm assuming you're using mks, but the principles apply for any unit system.)

In that time, your planet will move over an arc of length 2a/ωv. The longer the arc, the better your chances. However, you now know where to focus your calculations.

We''re sorry, but you don''t have the clearance to read this post. Please exit your browser at this time. (Code 23)
Thanks for the replies.

Yes wasting time, all your assumptions were correct, we are working on implementing the code now.

If the ship was within the orbit, what would need to change?

Jonathan
I just thought I would post what we did incase someone ever has this problem in the future and finds this post.

What we discovered was that in the end we had to use numerical methods to find the correct intercept, as pointed out in an earlier post. The problem we were having is how do we get the calculation time down? In the method presented by wasting time it would still require a step through, but how much time do you step by. We came up with a solution.

1. Find the ships time to the farthest point on the planets orbit, and then find the ships closest point to the target orbit.
2. Divide the difference in time by two, and figure out if ships time to planet is less then or greater then it. Then use the mid point and either the max or min (whichever it happens to be), and divide the range in two again.
3. Continue until you reach a desired accuracy.

Essentially what you are doing is constantly dividing the time required in two until you reach a desired point. Using this method you exponentially decrease the computation time required to discover the intercept.

We ran a couple tests, each intercept took between 3-10 interations for the intercept point to be discovered, and our calculation time was under 100 nanoseconds.

Thanks to everyone who replied.
Jonathan
Just as an aside, you might want to look up Hohmann Transfer Orbits.

Hohmann orbits represent the minimum-energy orbits. The main work of going from the two orbits is done by the Sun/Star. They do take more time to get the destination though, however they cut down on fuel.

In real-life, unmanned spacecraft follow these Hohmann orbits, otherwise the weight of the craft and cost of the mission would increase dramatically.

This probably has nothing to do with what you are doing, though, and they are a bit of work to understand mathematically, but the assumption that planets travel in circular orbits does simplify the equations and realistically only results in a small accuracy loss in the result.
"..."
Quote:Original post by vectoron
If the ship was within the orbit, what would need to change?


That was an incomplete thought on my part. I was thinking that you would want the _first_ time for the intercept, so knowing that the ship is outside the orbit, you would never have negative times in the numerical solver of the equation I posted. If the ship is inside the orbit, you can restrict the solver to finding only positive times, so this is not a special case.

The numerical method you mention sounds like "bisection". I would think you can structure the problem to use Newton's method for root finding and get faster convergence. Or for a robust approach, use a hybrid bisection-Newton approach.

This topic is closed to new replies.

Advertisement