The landing trajectory over 12 SCP iterations, starting from a straight-line initial guess. The short segments along the path are the thrust vector at each discretization node; their length indicates thrust magnitude. The right-hand panels track flight time and final mass at each iteration.
Overview
Motivated by SpaceX's mid-air catch of a Falcon 9 booster, I implemented a successive convexification (SCP) algorithm for powered descent guidance, following the formulation of Szmuk, Açıkmeşe, Berning, and Huntington [1]. The goal is to land a rocket at a target with zero final velocity and an upright attitude while using as little fuel as possible. The original problem is a nonconvex optimal control problem, so SCP solves it as a sequence of second-order cone programs (SOCPs). Each convex sub-problem can be handled by an off-the-shelf interior-point method (IPM) solver, which is what makes real-time trajectory generation feasible.
Problem
The rocket is modeled as a point mass with 3-DOF translational dynamics, which is reasonable when attitude can be changed much faster than position. The state is mass, position, and velocity; the control is the thrust vector. The model includes mass depletion with a constant back-pressure loss and a quadratic aerodynamic drag term, and it assumes the thrust vector is aligned with the rocket's longitudinal axis, so the thrust direction stands in for attitude.
The constraints are:
Thrust magnitude bounded above and below, $T_{\min} \le \|\mathbf{T}(t)\|_2 \le T_{\max}$. The lower bound makes the feasible set an annulus, which is nonconvex.
Thrust pointing within a maximum tilt angle from vertical. This is convex for tilt limits $\theta_{\max}$ up to $90^\circ$.
Glideslope: the position must stay inside a cone above the landing site so the approach clears surface obstacles.
Boundary conditions: given initial position and velocity; final position at the origin, zero final velocity, and a near-vertical final thrust direction.
The objective is to maximize final mass, equivalently to minimize fuel burned. Two things make the problem nonconvex: the nonlinear dynamics, and the lower bound on thrust magnitude.
Approach
The SCP pipeline has six pieces: convexify the nonconvex constraints, add a trust region, add virtual control, penalize the virtual control, discretize, and choose a trust-region update rule.
Lossless convexification of the thrust bound. Following Açıkmeşe and Blackmore [2], a slack variable $\Gamma$ is introduced with $\|\mathbf{T}\|_2 \le \Gamma$ and $T_{\min} \le \Gamma \le T_{\max}$. The lifted feasible set is convex, and the theory guarantees that at the optimum $\Gamma^* = \|\mathbf{T}^*\|_2$, so the original constraint is satisfied exactly. The mass-depletion dynamics are rewritten in terms of $\Gamma$.
Linearize, then discretize. Unlike the reference paper, which discretizes first, I rescaled time to $\tau = t/t_f \in [0, 1]$ with the final time $t_f$ as a decision variable, linearized the dynamics about the previous iterate to obtain a linear time-varying system, and then discretized with a first-order hold on the controls. The discrete transition matrices are obtained by integrating the state-transition matrix over each interval, as in the free-final-time 6-DoF paper by Szmuk and Açıkmeşe [3]. The implementation adapts Sven Niederberger's open-source code for that paper.
Virtual control. Linearization can make a sub-problem infeasible even when the original problem has a solution. An additive virtual control term $\boldsymbol{\nu}_k$ in the discretized dynamics prevents this, and its penalty $w_\nu \|\bar{\boldsymbol{\nu}}\|_1$ is added to the objective so that it is driven to zero at convergence.
Trust region with an adaptive radius. The linearization is only accurate near the reference, and without a trust region the linearized problem can be unbounded. A trust region $\|\delta\mathbf{x}_k\|_1 + \|\delta\mathbf{u}_k\|_1 + \|\delta\sigma\|_1 \le \eta$ on the state, control, and time-dilation deviations is enforced. After each solve, the ratio $\rho$ of actual to predicted cost improvement decides whether to reject the step and shrink the radius $\eta$, accept and shrink, accept and keep, or accept and grow.
The resulting convex sub-problem is an SOCP, and the outer loop repeats the linearize-solve-update cycle until the predicted improvement falls below a tolerance. Because the thrust bound is handled by lossless convexification rather than linearization, no additional slack penalties are needed for the state and control constraints.
Results
With the parameters from the reference paper, the algorithm converged in 12 iterations. The converged trajectory brings the rocket from 500 m east and 500 m up, with significant initial velocity, to the origin with zero velocity in roughly 35 s. The thrust profile shows the classic max-min-max bang-bang structure expected for fuel-optimal descent, with the vertical thrust component sitting at the lower bound for most of the flight.
State trajectories of the converged solution.Thrust components of the converged solution.
Virtual control is a synthetic input that cannot be applied to a real vehicle, so it must vanish at the converged solution. Tracking $\|\boldsymbol{\nu}\|_2$ across iterations confirms that it drops to zero by iteration 8 and stays there.
$\|\boldsymbol{\nu}\|_2$ of the virtual control at each SCP iteration.
Report
The full write-up, including the complete problem formulation, the linearization and discretization derivation, and the algorithm in pseudocode, is in the project report (PDF).
References
M. Szmuk, B. Açıkmeşe, A. W. Berning, and G. Huntington. Successive Convexification for Fuel-Optimal Powered Landing with Aerodynamic Drag and Non-Convex Constraints. AIAA Guidance, Navigation, and Control Conference, 2016.
B. Açıkmeşe and L. Blackmore. Lossless Convexification of a Class of Optimal Control Problems with Non-Convex Control Constraints. Automatica, 47(2):341–347, 2011.
M. Szmuk and B. Açıkmeşe. Successive Convexification for 6-DoF Mars Rocket Powered Landing with Free-Final-Time. arXiv:1802.03827, 2018.