This repository implements a powered-descent guidance (PDG) / soft-landing trajectory optimizer based on lossless convexification. The core idea is to transform a class of nonconvex thrust-magnitude and thrust-pointing constraints into a convex second-order cone program (SOCP) that can be solved reliably with modern convex solvers.
The implementation follows the formulation in:
- B. Açıkmeşe, J. M. Carson III, and L. Blackmore, “Lossless Convexification of Nonconvex Control Bound and Pointing Constraints of the Soft Landing Optimal Control Problem,” IEEE Transactions on Control Systems Technology, 21(6):2104–2113, 2013.
DOI: https://doi.org/10.1109/TCST.2012.2237346
(Author PDF mirror) https://www.larsblackmore.com/iee_tcst13.pdf
Solves a two-stage prioritized guidance problem:
- Problem 3 (Convex relaxed minimum landing error):
minimize lateral landing error in the Y–Z plane (target atq = [0,0]) subject to dynamics and constraints. - Problem 4 (Convex relaxed minimum fuel):
minimize total “thrust usage” (proxy for fuel) subject to the same constraints and landing within the best error found in Problem 3.
It then plots the 3D trajectory.
Runs the same discretized problem under several thrust-pointing limits and compares:
- CVXPY (convex SOCP) approach (fast, robust)
- SciPy SLSQP (general nonlinear constrained optimization) baseline (typically much slower and more sensitive to initialization)
It generates a combined plot and prints summary tables (fuel used, flight time, CPU time).
The landing problem is constrained by:
- Terminal constraints: touchdown altitude and velocity.
- Glide-slope constraint: prevents shallow approaches and subsurface paths.
- Velocity bound: caps speed along the trajectory.
- Thrust magnitude bounds (via convex relaxation) corresponding to throttle bounds.
- Thrust pointing constraint: keeps thrust within a cone about the vertical axis.
In the scripts, the “vertical” axis is the x-axis (e1 = [1,0,0]), with gravity g = [-3.71, 0, 0] m/s².
Soft-Landing-Optimizer-Project/
├─ soft_landing_optimizer.py
├─ compare_solver.py
├─ README.md
└─ img/
├─ trajectory.png
├─ combined_solver_comparison.png
├─ glideslope.png
├─ dynamics.png
├─ problem_formulation.png
└─ problem_solution.png
This repo uses standard scientific Python tooling:
- Python 3.8+ recommended (older versions may work)
- numpy
- matplotlib
- cvxpy
- scipy (only required for
compare_solver.py)
Install (virtual environment recommended):
python -m venv .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows (PowerShell)
pip install -U pip
pip install numpy matplotlib cvxpy scipyNotes:
- CVXPY will choose an appropriate solver automatically. In
compare_solver.py, the code tries ECOS first and falls back to SCS. See the CVXPY solver documentation: https://www.cvxpy.org/tutorial/solvers/index.html
python soft_landing_optimizer.pyExpected output:
- A 3D trajectory plot (rendered in a Matplotlib window)
python compare_solver.pyExpected output:
- Saves a figure named
combined_solver_comparison.png(by default in the current directory) - Prints two tables summarizing fuel and timing
- Plots attitude, throttle, and Y–Z trajectories for both solvers
A representative run of compare_solver.py produced:
TABLE: CVXPY Solver Results
Scenario | Fuel (kg) | Flight Time (s) | CPU Time (s)
----------------------------------------------------------------------
Unconstrained | 198.8 | 45.00 | 0.1128
90 deg Limit | 200.6 | 47.00 | 0.0948
45 deg Limit | 220.4 | 58.00 | 0.1222
======================================================================
TABLE: SciPy (SLSQP) Solver Results
Scenario | Fuel (kg) | Flight Time (s) | CPU Time (s)
----------------------------------------------------------------------
Unconstrained | 217.5 | 45.00 | 18.7846
90 deg Limit | 212.2 | 47.00 | 20.1338
45 deg Limit | 227.7 | 58.00 | 39.6646
======================================================================
Interpretation (in one sentence): the convex formulation solves in ~0.1 s, while a generic nonlinear solver can take tens of seconds and may be less predictable, especially as constraints tighten.
Common edits you might try:
-
Initial condition:
x0_val = np.array([rx0, ry0, rz0, vx0, vy0, vz0]) -
Target point in Y–Z plane:
target_q = np.array([qy, qz]) -
Pointing constraint cone half-angle:
Changetheta_degin the scenarios list (smaller = stricter). -
Glide-slope angle:
glidelslope_angle = 30.0(degrees) -
Time discretization:
dtandtfcontrol fidelity vs speed. Euler withdt=1 sis simple but coarse; decreasingdtimproves accuracy at increased solve time.
- Forward Euler discretization is easy to read but not the most accurate; higher-order integration or direct collocation generally improves fidelity.
- This is a 3-DoF translation model (position/velocity). It does not model full 6-DoF rigid-body attitude dynamics, actuator dynamics, or aerodynamics.
- The SciPy baseline uses SLSQP (Sequential Least Squares Programming). It is not specialized for large sparse optimal-control transcription problems and can be sensitive to initial guesses. SciPy docs: https://docs.scipy.org/doc/scipy/reference/optimize.minimize-slsqp.html
-
Açıkmeşe, Carson III, Blackmore (2013). Lossless Convexification… IEEE TCST.
DOI: https://doi.org/10.1109/TCST.2012.2237346 -
CVXPY documentation (solvers):
https://www.cvxpy.org/tutorial/solvers/index.html -
SciPy optimization (
minimize, SLSQP):
https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.minimize.html





