Credit SpaceX

How SpaceX lands Starship (sort of)

aka: how I “accidentally” discovered what I already somewhat knew: optimization methods are at the heart of landing rockets.

Drone performing flips!

Trajectory optimization: What does an “optimal trajectory” even mean?

An example of two trajectories

Picking a cost function.

Finally, constraints:

Extra resources:

Landing a rocket! — The code

The Trajectory:

Example of a trajectory made up of three points and and a state along that trajectory
Generating the steps and optimization variables

The Cost Function:

Setting the cost function

Constraint set 1: Initial and Final conditions

Initial and Final condition constraints

Constraint set 2: Dynamics

Setting the dynamics constraint for all elements in the state vector.
Defining f(x,u) = x_dot

Constraint set 3: Variable Bounds

Setting bounded constraints for u


Selecting solver and running!
This is what we like to see
Plot of state and control arrays

So “what did we learn”?

Why actually landing a rocket is much harder than this:

Extra resources:


Hardware and Software for things that move.