leggedrobotics/ocs2

C++leggedrobotics.github.io/ocs2

Optimal Control for Switched Systems

optimal-controlmpcroboticscontrol
Star 增长趋势
Star
1.5k
Forks
328
周增长
+3
Issues
50
5001k1.5k
2021年7月2023年3月2024年12月2026年9月
README

OCS2 Toolbox

OCS2 (Optimal Control for Switched Systems) is a C++ toolbox for formulating and solving nonlinear optimal control problems, with an emphasis on real-time Model Predictive Control (MPC) for robotics.

legged-robot

OCS2 handles general path constraints through Augmented Lagrangian or relaxed barrier methods. To facilitate the application of OCS2 in robotic tasks, it provides additional tools to set up the system dynamics (such as kinematic or dynamic models) and cost/constraints (such as self-collision avoidance and end-effector tracking) from a URDF model. The library also provides an automatic differentiation tool to calculate derivatives of the system dynamics, constraints, and cost. To facilitate deployment on robotic platforms, OCS2 provides tools for ROS interfaces. The toolbox’s efficient and numerically stable implementations in conjunction with its user-friendly interface have paved the way for employing it on numerous robotic applications with limited onboard computation power.

ROS 2 port available: use branch ros2.

ROS branches

ROS version Branch
ROS 1 main
ROS 2 ros2

Highlights

  • Multiple solvers
    • SLQ: continuous-time constrained DDP (SLQ/DDP family)
    • iLQR: discrete-time constrained DDP
    • SQP: multiple-shooting SQP (QP subproblems via HPIPM/BLASFEO)
    • SLP: sequential linear programming (PIPG)
    • IPM: multiple-shooting nonlinear interior-point method
  • Switched-system OCP support: mode schedules and jump maps (single- and multi-domain problems).
  • Constraints: hard/soft constraints with Augmented Lagrangian and relaxed barrier methods.
  • Derivatives: analytic derivative interfaces + automatic differentiation (CppAD) and optional code generation (CppADCodeGen).
  • Robotics tooling: URDF→model helpers (Pinocchio), kinematics, centroidal models, self-collision constraints (HPP-FCL).
  • ROS integration: messages, nodes, and visualization/plotting tools for deploying MPC on robots.
  • Robotic examples: end-to-end MPC examples (and ROS wrappers) for double integrator, cartpole, ballbot, quadrotor, mobile manipulator, legged robot, and more.

Repository structure (high level)

  • ocs2_core: core data types, math utilities, rollout interfaces, AD utilities.
  • ocs2_oc: optimal control problem building blocks (costs, constraints, dynamics, pre-computation, reference management).
  • ocs2_ddp, ocs2_mpc: DDP-family solvers + MPC infrastructure and runtime interfaces.
  • ocs2_sqp, ocs2_slp, ocs2_ipm: alternative solvers (SQP / SLP / IPM).
  • ocs2_pinocchio/*: URDF/Pinocchio tooling (centroidal model, kinematics, self-collision, visualization).
  • ocs2_ros_interfaces, ocs2_msgs: ROS interfaces and message definitions.
  • ocs2_robotic_examples/*: robotic examples and their ROS nodes.
  • ocs2_python_interface: Python bindings for selected components.
  • ocs2_mpcnet: MPC-Net tooling for learned policy deployment/training.
  • ocs2_doc: documentation sources (Sphinx/Doxygen).

Documentation

Installation

Citing OCS2

@misc{OCS2,
  title  = {{OCS2}: An open source library for Optimal Control of Switched Systems},
  note   = {[Online]. Available: \url{https://github.com/leggedrobotics/ocs2}},
  author = {Farbod Farshidian and others}
}

License

BSD 3-Clause, see LICENCE.txt.

相关仓库
open-spaced-repetition/fsrs4anki

A modern Anki custom scheduling based on Free Spaced Repetition Scheduler algorithm

Jupyter NotebookMIT Licenseanki-addonspaced-repetition-algorithm
github.com/open-spaced-repetition/fsrs4anki/wiki
4.1k162
casadi/casadi

CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python, Matlab/Octave, Julia or Javascript

C++libraryGNU Lesser General Public License v3.0optimizationnonlinear
casadi.org
2.3k455
ethz-adrl/control-toolbox

The Control Toolbox - An Open-Source C++ Library for Robotics, Optimal and Model Predictive Control

C++BSD 2-Clause "Simplified" Licenseoptimal-controlmodel-predictive-control
1.7k342
acados/acados

Fast and embedded solvers for nonlinear optimal control and nonlinear model predictive control

ClibraryOtherembeddedoptimization
docs.acados.org
1.5k360
pantor/ruckig

Motion Generation for Robots and Machines. Real-time. Jerk-constrained. Time-optimal.

C++libraryMIT Licensetrajectory-generationrobotics
ruckig.com
1.4k263
rst-tu-dortmund/teb_local_planner

An optimal trajectory planner considering distinctive topologies for mobile robots based on Timed-Elastic-Bands (ROS Package)

C++libraryBSD 3-Clause "New" or "Revised" Licenserosmobile-robots
wiki.ros.org/teb_local_planner
1.3k596
loco-3d/crocoddyl

Crocoddyl is an optimal control library for robot control under contact sequence. Its solver is based on various efficient Differential Dynamic Programming (DDP)-like algorithms

C++BSD 3-Clause "New" or "Revised" Licenseoptimal-controlmotion-planning
1.3k214
Shunichi09/PythonLinearNonlinearControl

PythonLinearNonLinearControl is a library implementing the linear and nonlinear control theories in python.

PythonPyPIlibraryoptimal-controlmodel-predictive-control
1k191