Skip to main content

New Python OCP Module for Optimal Control and MPC

· One min read

State trajectories generated with the Python OCP module

OpEn now comes with a Python OCP module that facilitates the design of optimal control problems in a direct and intuitive way.

With the new module, you can describe the key ingredients of an optimal control problem from Python, including:

  • stage and terminal costs
  • system dynamics
  • state and input constraints
  • problem parameters and defaults

This makes it much easier to formulate nonlinear optimal control problems and model predictive control (MPC) schemes before generating an embedded optimizer with OpEn.

The new OCP workflow is documented in the Python OCP guide:

If you want to try it right away, you can also run the Colab notebook:

This functionality was introduced in opengen version 0.10.0a1, and it opens the door to a smoother workflow for designing optimal controllers and MPC applications directly in Python.