- #1

LiquidPenguin

Now, the problem really isn't that hard unless the ship is already moving when you select a destination. In THAT case it becomes (to me) a hellish convolution of time-based variables. You have to correct for the initial velocity that is normal to the path towards the target by angling the ship slightly in the opposite direction. But, even if you can calculate that adjusted heading, while you are rotating the ship to that angle your position has changed because of your initial velocity, and the angle is all wrong.

Also very thorny is calculating the point at which, after accelerating, you should begin decelerating. All velocity has to be cancelled by the end of the deceleration. Because the ship's retrorockets are mounted opposite the thrusters, the deceleration vector will always be the inverse of the acceleration vector, multiplied by a constant that is the ratio of deceleration over acceleration. Which, I think, means that all of the initial velocity that is normal to the path of flight must be cancelled by the end of the acceleration phase (otherwise the decel phase would increase this velocity, throwing us off course). But doesn't that mean that it will be necessary to rotate the ship during the accel phase so that, by the beginning of decel, the ship is facing directly towards the target destination (though it began accel at a slightly skewed angle to compensate for normal velocity)? Again, the velocity at the destination must be zero in all directions.

The acceleration components will be changing by the sin and cos of the heading... which makes the equations more and more complicated. Should I be employing calculus here? How can I calculate the point at which to begin decelerating? I've made many many many equations trying to get that, but they all seem to be dependent on some other factor (such as the time of the accel burn plus the decel burn) that is in reality dependent on the very result I'm trying to find. Let me summarize what constants are known to the program (I don't know what the convention is for variable names, so please excuse my mistakes in that regard):

Dx, Dy: Destination position

Sx, Sy: Start Position

V0x, V0y: Initial Velocity Components

Theta: Ship's heading

a: max magnitude of ship's acceleration

r: ratio of deceleration rate / acceleration rate

V0r: Initial rotational velocity

Ra: Max rotational acceleration (deceleration is the same)

So since the "start location" is actually changing over time due to the initial velocity (Sx(t)=Sxi+V0x*t), the displacement that will get us to our destination is also changing. Arg.

One big thing that I am not sure of is whether to calculate all the vectors in frame of reference of the standard axes or the frame of reference of the direct line to the destination. For instance, do I look at the initial velocity as V0 in the x and y directions, or velocities normal and parallel to the desired direction? I've tried both ways, and I only run into either dead ends or end up right where I started. Obviously, the problem is not intractable, I mean they must have done the same problem in 3 dimensions and accounting for gravity and a million other factors for the apollo missions. But it's certainly causing me severe pain. Any insights anyone can provide, or mistakes in my logic, would be gratefully appreciated. Thanks for reading.

-Geoff