# Finding interplanetary flight trajectory using calculus of variations?

Consider two orbits $x(t),\space y(t)$ representing the origin and destination for some spaceflight of interest. These could be, for example, cycloids describing LEO and another orbit circling, say, the moon or Mars.

Suppose I want to leave at $x(t_i)$ and arrive at $y(t_f)$, departing and joining those orbits 'smoothly', so their derivatives $\dot{x}(t_t)$ and $\dot{y}(t_i)$ are also imposing boundary conditions on my trajectory.

To accomplish this, I allow for rocket engines to be fired, most notably while leaving one orbit and decelerating into the other, but also at any time mid-flight. On the other hand, I restrict the total spent fuel along the trip, or the total "delta-v" changes, or some equivalent.

What would be the best way to solve for this trajectory, including the firing pattern of the engine?

What I thought about was devising some adjusted Lagrangian that includes the impulse caused by the engines and adding to it a Lagrange multiplier imposing fuel consumption. This is then used to derive new equations of motion. For example, I would consider an action such as: $$S=\int_{t_i}^{t_f}L[q,\dot{q},F_e,t]dt+\lambda\left(J-\int_{t_i}^{t_f}|F_e(t)|dt \right)$$ Where $q(t)$ is the desired orbit, $F_e(t)$ is the force exerted by the engines and unknown a priori, and $J$ the total impulse supplied by them along the journey$^\dagger$. Now derive EOMs and solve for $q,F_e$.

Eventually, I'd like to explore if this 'formalism' produces solutions (trajectories) that can be inverted, solving either for $J$ (allowing minimization of fuel) or $t_f,t_i$ (minimizing flight time, picking launch window).

Where I am struggling is how to modify said Lagrangian. Should $F_e$ be considered as another generalized coordinate? If so, then a kinetic term for it is needed. Should it be treated as another term in the potential energy? Maybe it should be restated as a force originating from enforcing some constrained orbit? Maybe it's actually another 'Lagrangianesque' function of $q, \dot{q}$ and perhaps $\ddot{q}$ as well?

$^\dagger$Admittedly, the instantaneous thrust is not constrained, but it's a start.

EDIT

Following the reference supplied in the answer below, I managed to make some progress with the problem. This was done by "inverting roles", so now the "Lagrangian" is the engine force and a Lagrange multiplier enforces the Newtonian equation of motion:

$$S=\int_{t_0}^{t_f}dt\left( F^2 + 2\lambda(t)[m\ddot{x}+m \nabla \phi-F] \right)$$

Now, taking the differential of $S$ with regards to $x, F$ and $\lambda$, and doing the routine integration by parts on the variation $\delta\ddot{x}$, we obtain the following equations of motion:

$$(1) \space F=\lambda$$

$$(2) \space m\ddot{x} = -m\nabla\phi +F$$

$$(3) \space \ddot{\lambda} = - H_{\phi}*\lambda$$

Where $H_{\phi}$ denotes the Hessian matrix of $\phi$, i.e. $(H_{\phi})_{ij}=\partial_i\partial_j\phi$.

These equations can know be solved with given boundary conditions $x(t_0),x(t_f),\dot{x}(t_0),\dot{x}(t_f)$, which proved to be pretty straight-forward to do in MATLAB.

The next thing on the agenda is making $t_0, t_f$ free variable subject to optimization as well, so we can find the best launch window. This is proving to be a bit more difficult. Introducing these extra degrees of freedom requires more Lagrange multipliers and produces algebraic equations for each of them and the multipliers. The major difficulty is that the equations of motion above can't be easily integrated and then solved for the time $t$, so they can be evaluated at the launch and landing times. Any suggestions?

-
The approach is different, but you may want to read this: thesis.library.caltech.edu/1854/1/rossthesis_5_11.pdf – Jaime Dec 21 '12 at 11:43

The best I can suggest with the information given is the following table from Optimal Control. This should link to the page, but let me know if it doesn't.

Table 3.2-1

So, to start with, you need these things.

• The system (I believe initial conditions are included here)
• A performance index
• Final constraint

You didn't specify the system specifically, but probably because it's trivial. We all know how to write the equation of motion for the problem you're interested in. The hard part about these problems are the intermediary steps, which to many engineers looks kind of like math magic. Right now it sounds like you don't fully know what you're going to put in for the final constraint versus the performance index. Take the final and initial time, for instance. You will be using a different procedure if you're making it fixed versus free final time. I don't even remember any equations that incorporated $t_0$ into the performance index, probably because I never looked at problems that complicated. For these shortcomings you could brute force the problem after solving a simpler problem.

I'm not sure if I understand your question, but you don't just invert something and solve for $J$, so I don't think I can answer that. However, for solving for the trajectory, you have two approaches before you. Either code it up numerically to calculate your cost function given a control input, then find local minimums, or you use the more mathematical way. If you go the numerical route, it's likely that you'll just have to treat the final conditions as part of your cost function. That is, you take the square of the distance between your final position and the desired position and multiply it by a constant much larger than the other cost factors, and you'll get close enough. That avoids a "double iteration", although the cost of solution blows up with the number of intervals anyway.

For the more analytic approach, I would mostly defer to that Table 3.2-1. For a single satellite orbiting a single body there are some solved cases out there, although I'm not sure what part of the approach still has utility for a very complicated problem like a Earth-Mars trip.

-
Thanks! I'm having a look at that and trying to adapt it to the problem at hand. – Benji Remez Dec 22 '12 at 12:37
I edited the body of the original question to show my progress. – Benji Remez Dec 24 '12 at 17:02