Skip to content

Introduction

OpenGoddard is a Python library for finding the best way to choose inputs that change over time, such as the thrust and flight direction of a launch vehicle. These are optimal control problems.

Imagine releasing a ball from rest at point A and letting gravity carry it along a frictionless track to B. If you can choose the shape of the track, which shape gets the ball to B fastest?

Travel time from A to B along different tracks. The straight line is shortest, but the cycloid is fastest: it descends steeply at first to gain speed.
Travel time from A to B along different tracks. The straight line is shortest, but the cycloid is fastest: it descends steeply at first to gain speed.

A straight track gives the shortest distance but accelerates the ball slowly. A track that goes too deep adds too much distance. The fastest curve balances these effects: a steep initial descent builds speed, which then carries the ball horizontally.

The unknown is a function describing the track, rather than a single number. For a rocket, the unknowns are thrust magnitude and direction at each instant; for a car, they are throttle and brake inputs over time. OpenGoddard solves these problems from:

  • Dynamics: how inputs change the state, such as position, velocity, and mass.
  • Conditions: the initial and final states, and limits that must hold along the way.
  • Objective: what to minimize, such as time, fuel use, or negative final altitude.

The result is a time history of states and controls. The following solution maximizes the mass delivered by a two-stage rocket to a 500 km circular orbit (Example 13).

Example 13. Blue and red show the first and second stages; orange arrows show thrust direction. White dots are the optimized nodes, joined by polynomial interpolation.
Example 13. Blue and red show the first and second stages; orange arrows show thrust direction. White dots are the optimized nodes, joined by polynomial interpolation.
  • LGL pseudospectral discretization gives high accuracy with relatively few nodes (pseudospectral methods).
  • Write the equations directly as ordinary Python functions. The library assembles the discretization and optimization problem (writing a problem).
  • Multiple phases support changes such as stage separation, with separate dynamics in each phase.
  • NumPy, SciPy, and Matplotlib are the only required dependencies. The default optimizer is SciPy’s SLSQP (sequential quadratic programming).

Python 3.11 or later is required.

Terminal window
pip install OpenGoddard

To run the examples, clone the repository and prepare the environment with uv:

Terminal window
git clone https://github.com/istellartech/OpenGoddard.git
cd OpenGoddard
uv sync
uv run python examples/02_move_stop.py

If you are learning optimal control and numerical optimization, follow these pages in order.

The library is named after Robert H. Goddard. His 1919 question of how to vary thrust to reach the greatest altitude with a fixed amount of propellant is a classic optimal control problem (Example 07).

OpenGoddard is released by Interstellar Technologies Inc. under the MIT license.