TrajOpt is a self-contained Python library for multi-segment trajectory optimization using Sequential Convex Programming (SCP). It is designed around reusable models, configurable missions, and modular methods, with built-in support for entry, descent, and landing (EDL) and other aerospace applications. This structure makes it straightforward to define new problems, implement new algorithms, and compare solution methods within a common software pipeline.
- Configurable Missions: Configuring missions using existing models is fast and efficient due to the config.yaml structure.
- Simple Model Design Framework: Building new models only requires providing their continuous-time functions f_k(x, u, t, params, fcns).
- Robust Base Algorithm: The base AutoSCvx algorithm includes autotuning of penalty weights and second-order information for robust convergence on most problems with minimal hyperparameter tuning.
- Self Contained: The base algorithm for solving the nonconvex problems is fully written in this package. The only black-boxes we accept are calls to the convex solvers due to their guaranteed reliability and provable convergence.
- Easy Algorithm Design: Researchers can quickly design their own algorithms using the powerful modeling languages CVXPY and JAX.
TrajOpt requires Python 3.11 or later.
Install the latest release from PyPI:
python -m pip install trajoptFor development, install from a local clone:
git clone https://github.com/mceowen/trajopt.git
cd trajopt
python -m pip install -e ".[dev]"To include documentation dependencies:
python -m pip install -e ".[dev,docs]"A trajectory segment is defined by a set of (Costs, Constraints, Parameters, Functions):
The trajectory optimal control problem (OCP) is defined by summing the cost contributions and enforcing the constraints from each segment:
The OCP above is posed in continuous time with a free final time, which is not directly solvable. We transcribe it to a finite-dimensional problem using a global normalized time, a time-dilation control, and a multiple-shooting discretization.
Time is normalized to
and physical time is carried as a state through the time-dilation control
The dynamics in normalized time follow from the chain rule:
The augmented control is parameterized with a first-order hold (FOH) between nodes, and continuity is enforced through multiple-shooting defect constraints,
while the nonconvex path constraints and boundary conditions are enforced at the nodes
Stacking the nodal variables into a single decision vector
where
The TrajectoryAnalyzer is the top-level entry point. It reads a mission config.yaml, builds the Trajectory (its segments, costs, and constraints) and the Method that solves it, and exposes a simple solve → analyze → plot workflow:
from trajopt.trajectory_analyzer import TrajectoryAnalyzer
traj = TrajectoryAnalyzer("config.yaml")
traj.solve() # run the SCP method
data = traj.analyze() # propagate iterates through the nonlinear dynamics
traj.plot(data) # re-dimensionalized plotsanalyze() propagates each SCP iterate through the true nonlinear dynamics, re-dimensionalizes the result, and packages the data the plots consume. The analysis type set in the config selects what is run:
- standalone: solve and analyze a single mission.
- mc: Monte Carlo dispersion, re-solving while perturbing config values sampled per run.
- method_variation: solve the same mission with different method overrides and compare them.
A method maps the nonconvex augmented OCP into a sequence of convex subproblems. The base algorithm is AutoSCvx: it relaxes the nonconvex constraints with virtual buffers
The quadratic weights Method assembles a single CVXPY subproblem from all segments and solves it repeatedly through the SCP loop.
SCP solves the nonconvex problem by iterating on convex approximations built around the current reference trajectory
Starting from an initial guess, each iteration:
-
Discretize & linearize the dynamics and constraints about
$\bar z$ . - Solve the resulting convex subproblem for a candidate step.
-
Line search on a merit function to accept a step length
$\alpha$ . -
Update the reference, the virtual buffers, and the penalty weights
$(W_h, W_g, \lambda, \mu)$ . - Test convergence on the state change and constraint/defect residuals; otherwise repeat.
On convergence the buffers vanish, so the converged solution satisfies the original nonconvex problem to tolerance.
Skye Mceowen and Carlos Morales
TrajOpt originated from Skye Mceowen's PhD thesis research under Dr. Behcet Acikmese in the Autonomous Controls Laboratory at the University of Washington. The research focused on sequential convex trajectory optimization, with early MATLAB prototypes developed in entry_opt, scp_sandbox, and trajopt_toolkit. The current Python package was subsequently developed collaboratively by Skye Mceowen and Carlos Morales into a reusable framework for multi-segment trajectory optimization and algorithm design. The original thesis work focused primarily on first-order methods, while Carlos Morales's PhD work has extended these approaches with second-order method development. The package and earlier prototypes form part of the software contributions of the PhD work.
Additional contributors to the current Python package include Pranav Ramasahayam, Daniel J. Calderone, and Samet Uzun. Earlier development and MATLAB prototypes also benefited from contributions by Jimmy Fowler, Edgerton Cook, Fabio Spada, Jason Zhou, Aman Tiwary, and Chris Sota.
The methods in TrajOpt build on the AutoSCvx thesis work and incorporate ideas from related advances in second-order trust-region modeling, continuous-time successive convexification, broader successive-convexification methods, state-triggered constraints, and temporal/logical specification handling.
-
AutoSCvx (auto-tuned primal-dual successive convexification):
Mceowen et al., “Autotuned Primal–Dual Successive Convexification for Reentry Guidance”, Journal of Guidance, Control, and Dynamics, 2025.
Mceowen et al., “Auto-Tuned Primal-Dual Successive Convexification for Hypersonic Reentry Guidance”, AIAA SCITECH 2025 Forum.
Mceowen et al., “Auto-Tuned Primal-Dual Successive Convexification for Powered Descent Guidance”, AIAA SCITECH 2026 Forum.
Mceowen et al., “Auto-Tuned Successive Convexification for Entry Guidance With Continuous-Time Constraint Satisfaction”, AIAA SCITECH 2026 Forum. -
CT-SCvx (continuous-time successive convexification):
Elango et al., “Continuous-time Successive Convexification for Constrained Trajectory Optimization”, Automatica, 2025. -
SCvx + STCs (successive convexification with state-triggered constraints):
Szmuk et al., “Successive Convexification for Real-Time Six-Degree-of-Freedom Powered Descent Guidance with State-Triggered Constraints”, Journal of Guidance, Control, and Dynamics, 2020. -
PS-SCP (pseudospectral sequential convex programming):
Sagliano et al., “Six-Degrees-of-Freedom Aero-Propulsive Entry Trajectory Optimization”, AIAA SCITECH 2024 Forum. -
STL + GMSR (signal temporal logic with generalized-mean smooth robustness):
Uzun et al., “Optimization with Temporal and Logical Specifications via Generalized Mean-based Smooth Robustness Measures”, arXiv, 2024.