OCS2
This is a C++ library for an efficient continuous and discrete time optimal control implementation. It includes methods for solving optimal control for continuous time problem with exogenous signal for switching in between predefine modes. The toolbox is capable of solving constrained problems.
Our proposed method is based on a bi-level optimal control approach which synthesizes an optimal feedback control policy for continuous inputs in the bottom-level and optimizes the switching times in between two consecutive system modes in the top-level.
Our Optimal Control for Switched Systems algorithm (OCS2 algorithm) consists of two main steps: a method which synthesizes the continuous input controller and a method which calculates the parametrized cost function derivatives with respect to the switching times. For synthesizing the continuous input controller, OCS2 uses the SLQ algorithm; a dynamic programming approach, which uses the Bellman equation of optimality to locally estimate the value function and consequently the optimal control law. In the second step, OCS2 uses a Riccati-based approach to compute the derivative of the total cost with respect to the switching times.
Moreover, the library provides tools for implementing the SLQ algorithm in MPC fashion. It also includes a ROS interface for receiving and sending the MPC policy. This library also uses CppADCodeGen an automatic-differentiation toolbox to calculate the derivatives of the system dynamics, constraint, and cost function.
OCS2 Modules
This library consists of the following main modules:
Core Module
Core Module provides the followings features:
- Definition of the optimal control problem.
- A numerical integration with different ODE solvers such as explicit and implicit solvers.
- Interface classes for dynamics, constraints, and their derivatives.
- Interface classes to the auto-differentiated dynamics, constraints, and cost.
- An efficient linear interpolation class.
- Linear system representation in time and frequency domain.
- Jacobian and Hessian of general functions using Numerical Differentiation, or Automatic-Differentiation with code-generation or just-in-time (JIT) compilation.
SLQ Module
SLQ Module provides the followings features:
- A continuous-time (un)constrained SLQ/ iLQR algorithm for (non-)switched systems [3].
- A continuous-time Riccati equations solver based on ODE solver.
- A continuous-time Riccati equations solver based on linearized equation and exponential method.
- A continuous-time Riccati equations solver using parallel computation instead of of the common sequential approach [1].
- A general solver for linear, two-point Boundary Value Problem (BVP).
OCS2 Module
OCS2 Module provides the followings features:
- A continuous-time unconstrained algorithm for computing the derivative of the optimized value function w.r.t. switching times based on the underlying LQ problem [2].
- A continuous-time (un)constrained algorithm for computing the derivative of the optimized value function w.r.t. switching times based on a Riccati approach to solve the two-point Boundary Value Problem [2].
- A continuous-time (un)constrained algorithm for switched systems optimal control [2].
MPC Module
MPC Module provides the followings features:
- A general interface for Model Predictive Control (MPC).
- A real-time MPC algorithm for (non-)switched systems using SLQ as the optimal control solver [1].
ROS Interfaces Module
ROS Interfaces Module provides the followings features:
- A ROS interface for MPC node with efficient message publishing scheme.
- A ROS interface for MRT (Model Reference Tracking) node which allows a user-friendly access method to the MPC policy.
- A command node for sending desired trajectory or the target goal to MPC node.
- A debugging class which imitates the full MPC-MRT process base on the MPC internal model.
Frank Wolfe Module
Frank-Wolfe Module provides the followings features:
- An implementation of the Frank-Wolfe algorithm [4] which is an iterative first-order gradient descent algorithm.
Robotic Examples provides the followings tools and examples:
- Robotic tools
- Ballbot
- Double integrator
- Quadrotor
- Cart Pole
Source Code
The source code is available at Bitbucket
How to use the OCS2 Toolbox
To get started with the control toolbox, please see Getting Started.
Support
For any questions, issues or other troubleshooting please either
Acknowledgement
Lead and Maintanance:
Lead and Maintanance:
- Farbod Farshidian
- Jan Carius
- Ruben Grandia
Contributors:
- Farbod Farshidian
- Jan Carius
- Ruben Grandia
- David Hoeller
- Asutosh Satapathy
- Markus Giftthaler
Licence Information
The OCS2 Toolbox is released under the BSD Licence, Version 3.0. Please note the licence and notice files in the source directory.
Related Publications
This toolbox has been used in the following publications:
- Farbod Farshidian, Edo Jelavic, Asutosh Satapathy, Markus Giftthaler, Jonas Buchli. Real-Time Motion Planning of Legged Robots: A Model Predictive Control Approach. In IEEE-RAS 17th International Conference on Humanoid Robots (Humanoids), IEEE 2017, pp. 577-584 (pdf).
- Farbod Farshidian, Michael Neunert, Alexander W. Winkler, Gonzalo Rey, Jonas Buchli. An Efficient Optimal Planning and Control Framework For Quadrupedal Locomotion. In IEEE International Conference on Robotics and Automation (ICRA), IEEE 2017, pp. 93-100. (pdf).
- Farbod Farshidian, Maryam Kamgarpour, Diego Pardo, Jonas Buchli. Sequential linear quadratic optimal control for nonlinear switched systems. In International Fed- eration of Automatic Control (IFAC), 2017, pp. 1463-1469. (pdf).
- Markus Giftthaler, Farbod Farshidian, Timothy Sandy, Lukas Stadelmann, Jonas Buchli. Efficient Kinematic Planning for Mobile Manipulators with Non-holonomic Constraints Using Optimal Control. In IEEE International Conference on Robotics and Automation (ICRA), IEEE 2017, pp. 3411-3417. (pdf).