# Spaceships, matching course and speed, internet tutorial and much confusion

1. Dec 19, 2007

### Narf the Mouse

Hello. A few things first: I have been trying to figure this out off and on for at least half a year and only come up with hack-jobs, most of which either worked poorly or not at all. My math skills are rusty and my memory forgets formulas easily.

Although my current problem involves programming, it is also primarily a physics problem in solution. To explain, one of my current projects is a space strategy game in the vein of Stars!, Master of Orion or Reach for the Stars. One of the features of the game is multiple drive systems; *Newtonian, **Inertialess and ***Jump-Drive are all planned.

Naturally, a game such as this would benefit from a robust interception formula. I was fortunate enough to find This, which is free for public use and works with both newtonian and inertialess physics and can be made to work with the jump-drive. Because it is free for public use, I see no problem in asking for help improving it, so long as I post any such public improvements on the site - Which I will.

My problem is, it is missile intercept code. It's great for missiles, but not so much for ships.

To explain, say Ship A wants to match course and speed with Ship B - That is, to come to rest relative to Ship B. The intercept code doesn't allow for that.

My question: How would I modify the intercept code to allow course and speed matching? (Once those two are matched, acceleration matching should be trivial)

Thanks for any and all help.

* Newtonian: Basically, achieves FTL by throwing Einsteinian physics out the window. Acceleration may increase velocity indefinitely.

** Inertialess: Achieves FTL by throwing conventional phsyics, as well as acceleration, out the window. Ships have velocity and need not accelerate.

*** Jump-Drive: Teleportation.

2. Dec 19, 2007

### DaveC426913

In Larry Niven's world, it is virtually impossible to match speeds with a ship that doesn't want to be matched. Your only option is to ram.

3. Dec 19, 2007

### LURCH

Just a shot in the dark (which I suppose is appropriate when shooting missiles in space!); but what happens if you use the first equation at the beginning of the essay in your guidence formula? Then you can adjust "A" untill the "V's" match. This way, it becomes a Velocity-matching formula as well as a Position-matching formula.

Also, there is an animation showing that most intercept problems have two solutions, if you can program the app so that it takes the solution in which the "velocity subtraction" yields the lower value, you'd be halfway home.

4. Dec 20, 2007

### Narf the Mouse

'(Vt = At + V0)' - Somehow I don't think you mean this one. It is, I think, the first equation in the text...Could you be more specific? Do you mean the first highlighted equation? 'Xt2 = ((1/2) * Tax * t2 + Tvx * t + Tpx)2 '

I don't see how feeding it the lower of two velocity values would help; it would simply accelerate continiously in the wrong direction whenever the wrong value was fed in.

5. Dec 21, 2007

### LURCH

I'm afraid I did mean that one. But all I was saying there was that, if that's the equation you use to determine the Velocity of your target (Vt), then it's the logical place to start in determining the Velocity you wish to attain for your own ship (Vs). Adjusting A untill Vt = Vs tells you the Acceleration your ship needs. That's not fleshed out, of course, I was just suggesting a starting place.

I'm talking about the lower of the two velocity differences: the relative velocities between the Target and the missile (in the given program). The webpage mentioned that this program subtracts velocities between moving objects. In the animation, you can see that there are two firing solutions for the proposed missile. One of them strikes the target at a high angle-off (almost side-on but slightly head-on). The other solution puts the misile on target at a point where the two are travelling in nearly the same direction. The combined speed, or relative speed, or velocity difference, between the missile and the target is much lower in this second firing solution. By subtracting velocities, the application could identify this solution as the better one for docking (even though the first solution is probably better for shooting).

6. Dec 21, 2007

### Narf the Mouse

I can grasp the basic idea; hopefully I can hammer on the math a bit or something.
One problem is that there needs to be two acceleration periods for a matching intercept.

7. Dec 23, 2007

### LURCH

That's why you want to take the second firing solution; it minimizes the second acceleration period so that the two acceleratrions could be accomplished in a single burn.

For example, as I mentioned in an earlier post, you match velocities by adjusting A untill the V's match. If you adjust A so that Vt = Vs at the same time that Pt = Ps, you come up with a solution using a single burn that re-directs part way through. You can see that in the animation (the one that shows two firing solutions) if you picture the ship starting out toward the coordinates of the second firing solution, and accelerating at such a rate as to reach that point at the same time as the target, and nearly the same velocity as the target. Near the intersect point, the acceleration thrust from the ship could be redirected slightly, to illiminate the difference.

I've heard it said that any problem of strogation, no matter how comlpex, can be solved with a single accelerarion. Unfortunately, I just can't see that solution here.

8. Dec 23, 2007

### D H

Staff Emeritus
Here is a simple approach: use the "missile intercept code" and simply perform a final burn at the end of the flight to match the target vehicle's velocity.

Real space vehicles rendezvous in a series of steps. The chaser vehicle moves from the post-lauch insertion orbit to some phasing orbit that has a different period than the target vehicle's orbit. The transfer to the phasing orbit typically includes a plane change.

At the right time, the vehicle transfers from the phasing orbit to an orbit that is close to that of the target vehicle. Some special purpose approaches to achieving this transfer include the Hohmann transfer, the bi-elliptic transfer, and the one-tangent transfer. Lambert targeting provides a general-purpose approach.

Real space rendezvous involves many hops. The initial target point is intentionally some distance away from the target vehicle as real space vehicles have a huge (5-10%) error in predicted thrust behavior and a smaller but still significant error in sensed thrust behavior. Subsequent hops bring the chaser closer to the target. Once close to the target vehicle, the chaser vehicle can "see" the target vehicle. The chaser vehicle then uses active control with the linearized Clohessy-Wiltshire equations describing the equations of motion to finally dock with the vehicle.

The lecture notes for http://ccar.colorado.edu/asen5050/index.html" [Broken] (Clohessy-Wiltshire Equations).

Last edited by a moderator: May 3, 2017
9. Dec 26, 2007

### Narf the Mouse

It would probably involve modifying the equations that are used to generate the data for the quartic? formula. I have a few guesses, but nothing solid.

And my main comp is currently glitched, so I can't test them anyway. But I was thinking, doubling the acceleration parts of the formula and using negative acceleration in the doubled portion.