blob: 975e675c26a59774cae313a1133494ed31aabb54 [file] [log] [blame]
/*!
\mainpage Overview
@tableofcontents
\section ct1 Control Toolbox
This is the ADRL Control Toolbox ('CT'), an open-source C++ library for efficient modelling, control,
estimation, trajectory optimization and model predictive control.
The CT is applicable to a broad class of dynamic systems, but features additional modelling tools specially designed for robotics.
This page outlines its general concept, its major building blocks and highlights selected application examples.
The library contains several tools to design and evaluate controllers, model dynamical systems and solve optimal control problems.
The CT was designed with the following features in mind:
- **Systems and dynamics**:
- intuitive modelling of systems governed by ordinary differential- or difference equations.
- **Trajectory optimization, optimal control and (nonlinear) model predictive control**:
- intuitive modelling of cost functions and constraints
- common interfaces for optimal control solvers and nonlinear model predictive control
- currently supported algorithms:
- Single Shooting
- iLQR \cite todorov2005ilqg / SLQ \cite slq:2005
- Gauss-Newton-Multiple-Shooting (GNMS) \cite giftthaler2017family
- Classical Direct Multiple Shooting (DMS) \cite bock1984direct
- standardized interfaces for the solvers
- IPOPT (first and second order)
- SNOPT
- HPIPM
- custom Riccati-solver
- **Performance**:
- solve large scale optimal control problems in MPC fashion.
- **Robot Modelling and rigid body dynamics**:
- straight-forward interface to a state-of the art rigid body dynamics modelling tool.
- **Automatic Differentiation**:
- first- and second order automatic differentiation of arbitrary vector-valued functions including cost functions and constraints
- automatic differentiation of rigid body dynamics
- derivative code generation for maximum efficiency
- **Simplicity**:
- all algorithm flavors and solver backends are available through simple configuration files.
The CT is hosted on bitbucket: <a href="https://bitbucket.org/adrlab/ct" target="_blank">https://bitbucket.org/adrlab/ct</a>
\section ae Robot Application Examples
The Control Toolbox has been used for Hardware and Simulation control tasks on flying, walking and ground robots.
\htmlonly
<iframe width="560" height="315" src="https://www.youtube.com/embed/Y7-1CBqs4x4" frameborder="2" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/vuCSKtP67E4" frameborder="2" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/rWmw-ERGyz4" frameborder="2" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube.com/embed/rVu1L_tPCoM" frameborder="2" allowfullscreen></iframe>
\endhtmlonly
For details and more videos see \ref application_examples "Application Examples" and our \ref publications "publications".
\section teaser What is the CT?
A common tasks for researchers and practitioners in both the control and the robotics communities
is to model systems, implement equations of motion and design model-based controllers, estimators,
planning algorithms, etc.
Sooner or later, one is confronted with questions of efficient implementation, computing derivative
information, formulating cost functions and constraints or running controllers in model-predictive
control fashion.
The Control Toolbox is specifically designed for these tasks. It is written entirely in C++ and has
a strong focus on highly efficient code that can be run online (in the loop) on robots or other
actuated hardware. A major contribution of the CT is are its implementations of optimal control
algorithms, spanning a range from simple LQR reference implementations to constrained model predictive
control. The CT supports Automatic Differentiation (Auto-Diff) and allows to generate derivative code
for arbitrary scalar and vector-valued functions.
We designed the toolbox with usability in mind, allowing users to apply advanced concepts such as
nonlinear model predictive control (NMPC) or numerical optimal control easily and with minimal effort.
While we provide an interface to a state-of-the art Auto-Diff compatible robot modelling software, all
other modules are independent of the a particular modelling framework, allowing the code to be interfaced
with existing C/C++ code or libraries.
The CT has been successfully used in a variety of different projects, including a large number of
hardware experiments, demonstrations and academic publications.
Example hardware applications are online trajectory optimization with collision
avoidance \cite giftthaler2017autodiff, trajectory optimization for Quadrupeds \cite neunert:2017:ral
and mobile manipulators \cite giftthaler2017efficient as well as NMPC on ground robots \cite neunert2017mpc
and UAVs \cite neunert16hexrotor. The project originated from research conducted at the Agile \& Dexterous
Robotics Lab at ETH Zurich, but is continuously extended to cover more fields of applications and algorithms.
\section scope Scope of the CT
Software is one of the key building blocks for robotic systems and there is a great effort
in creating software tools and libraries for robotics.
However, when it comes to control and especially Numerical Optimal Control, there are not
many open source tools available that are both easy to use for fast development as well as
efficient enough for online usage.
While there exist mature toolboxes for Numerical Optimal Control and Trajectory Optimization,
they are highly specialized, standalone tools that due not provide sufficient flexibility
for other applications. Here is where the CT steps in. The CT has been designed from ground
up to provide the tools needed for fast development and evaluation of control methods while
being optimized for efficiency allowing for online operation. While the emphasis lies on control,
the tools provided can also be used for simulation, estimation or optimization applications.
In contrast to other robotic software, CT is not a rigid integrated application but can be
seen quite literal as a toolbox: It offers a variety of tools which can be used and combined
to solve a task at hand. While ease-of-use has been a major criteria during the design and
application examples are provided, using CT still requires programming and control knowledge.
However, it frees the users from implementing standard methods that require in-depth experience
with linear algebra or numerical methods. Furthermore, by using common definitions and types,
a seamless integration between different components such as systems, controllers or integrators
is provided, enabling fast prototyping.
\section design Design and Implementation
The main focus of CT is efficiency, which is why it is fully implemented in C++.
Since CT is designed as a toolbox rather than an integrated application, we tried to provide
maximum flexibility to the users. Therefore, it is not tied to a specific middleware such as
ROS and dependencies are kept at a minimum. The two essential dependencies for CT are
<a href="http://eigen.tuxfamily.org" target="_blank">Eigen</a> and
<a href="http://github.com/ethz-asl/kindr" target="_blank">Kindr</a>
(which is based on Eigen). This Eigen dependency is intentional since Eigen
is a defacto standard for linear algebra in C++, as it provides highly efficient implementations
of standard matrix operations as well as more advanced linear algebra methods.
Kindr is a header only Kinematics library which builds on top of it and provides data types
for different rotation representations such as Quaternions, Euler angles or rotation matrices.
\section modules Structure and Modules of the CT
The Control Toolbox consists of three main modules. The Core module (ct_core), the Optimal
Control (ct_optcon) module and the rigid body dynamics (ct_rbd) module.
There is a clear hierarchy between the modules.
That means, the modules depend on each other in this order, e.g. you can use the core module
without the optcon or rbd module.
- The `core' module (ct_core) module provides general type definitions and mathematical tools.
For example, it contains most data type definitions, definitions for systems and controllers,
as well as basic functionality such as numerical integrators for differential equations.
- The `optimal Control' module (ct_optcon) builds on top of the `core' module and adds
infrastructure for defining and solving Optimal Control Problems. It contains the functionality
for defining cost functions, constraints, solver backends and a general MPC wrapper.
- The `rigid body dynamics' module (ct_rbd) provides tools for modelling Rigid Body Dynamics
systems and interfaces with ct_core and ct_optcon data types.
For testing as well as examples, we also provide the 'models' module (ct_models) which contains
various robot models including a quadruped, a robotic arm, a normal quadrotor and a quadrotor
with slung load.
The four different main modules are detailed in the following.
\subsection ct_core_overview CT Core
- Definitions of fundamental types for **control** and simulation, such as dynamic systems
(ct::core::System), states (ct::core::StateVector), controls (ct::core::Controller), or trajectories
(ct::core::DiscreteTrajectoryBase).
- **Numeric integration** (ct::core::Integrator) with various ODE solvers including fixed step
(ct::core::IntegratorEuler, ct::core::IntegratorRK4) and variable step (ct::core::IntegratorRK5Variable,
ct::core::ODE45) integrators, as well as symplectic (semi-implicit) integrators.
- Numerical approximation of Trajectory **Sensitivities** (ct::core::Sensitivity , e.g. by forward-integrating
variational differential equations)
- Common **feedback controllers** (e.g. ct::core::PIDController)
- Derivatives/Jacobians of general functions using **Numerical Differentiation** (ct::core::DerivativesNumDiff)
or **Automatic-Differentiation** with code-generation (ct::core::DerivativesCppadCG) and just-in-time (JIT)
compilation (ct::core::DerivativesCppadJIT)
- <a href="../../../ct_core/doc/html/index.html">quick link to ct_core</a>
\subsection ct_optcon_overview CT Optimal Control
- Definitions for **Optimal Control Problems** (ct::optcon::OptConProblem) and **Optimal Control Solvers** (ct::optcon::OptConSolver)
- **CostFunction toolbox** allowing to construct cost functions from file and providing first-order and **second-order approximations**, see ct::optcon::CostFunction.
- **Constraint toolbox** for formulating constraints of Optimal Control Problems, as well as automatically computing their Jacobians.
- reference C++ implementations of the **Linear Quadratic Regulator**, infinite-horizon LQR and time-varying LQR (ct::optcon::LQR, ct::optcon::TVLQR)
- **Riccati-solver** (ct::optcon::GNRiccatiSolver) for unconstrained linear-quadratic optimal control problems, interface to high-performance
<a href="https://github.com/giaf/hpipm" target="_blank"> third-party Riccati-solvers</a> for constrained linear-quadratic optimal control problems
- **iterative non-linear Optimal Control** solvers, i.e. Gauss-Newton solvers such as iLQR (ct::optcon::iLQR) and
Gauss-Newton Multiple Shooting(ct::optcon::GNMS), constrained direct multiple-shooting (ct::optcon::DmsSolver)
- Non-Linear **Model Predictive Control** (ct::optcon::MPC)
- Definitions for Nonlinear Programming Problems (**NLPs**, ct::optcon::Nlp) and interfaces to third-party **NLP Solvers**
(ct::optcon::SnoptSolver and ct::optcon::IpoptSolver)
- <a href="../../../ct_optcon/doc/html/index.html">quick link to ct_optcon</a>
\subsection ct_rbd_overview CT Rigid Body Dynamics
- Standard models for Rigid Body Dynamics
- Definitions for the state of a Rigid Body System expressed as general coordinates (ct::rbd::RBDState)
- Routines for different flavors of **Forward** and **Inverse Dynamics** (ct::rbd::Dynamics)
- Rigid body and end-effector **kinematics** (ct::rbd::Kinematics, note that we do currently not provide inverse kinematics)
- Operational Space Controllers
- Basic soft **auto-differentiable contact model** for arbitrary frames (ct::rbd::EEContactModel)
- **Actuator dynamics** (ct::rbd::ActuatorDynamics)
- Backend uses <a href="https://bitbucket.org/mfrigerio17/roboticscodegenerator/" target="_blank">RobCoGen</a> \cite frigerioCodeGen,
a highly efficient Rigid Body Dynamics library
- <a href="../../../ct_rbd/doc/html/index.html">quick link to ct_rbd</a>
\subsection ct_models_overview CT Models:
- Various standard models for testing and evaluation including UAVs (ct::models::Quadrotor), ground robots,
legged robots (ct::models::HyQ), robot arms (ct::models::HyA), inverted pendulums etc.
- Means of creating linear approximation of these models
- <a href="../../../ct_models/doc/html/index.html">quick link to ct_models</a>
\section source_code Source Code
The source code is available at <a href="https://bitbucket.org/adrlab/ct" target="_blank">https://bitbucket.org/adrlab/ct</a>
Furthermore there are examples for ROS interfaces available:
- <a href="../../../../ct_ros/ct_ros_msgs/doc/html/index.html" target="_blank">ct_ros_msgs</a>
- <a href="../../../../ct_ros/ct_ros_nodes/doc/html/index.html" target="_blank">ct_ros_nodes</a>
\section gs How to use the Control Toolbox
To get started with the control toolbox, please see \ref getting_started "Getting Started".
\section contact Support
For any questions, issues or other troubleshooting please either
- create an issue: https://bitbucket.org/adrlab/ct/issues
- contact the devs: control-toolbox-dev@googlegroups.com
\section ct_doc_acknowledgement Acknowledgements
\subsection contribs Contributors
- Michael Neunert
- Markus Giftthaler
- Markus Stäuble
- Farbod Farshidian
- Diego Pardo
- Timothy Sandy
- Jan Carius
- Hamza Merzic
\subsection lead_overview Project Lead and Maintenance
- Michael Neunert, neunertm (at) gmail (dot) com
- Markus Giftthaler, mgiftthaler (at) ethz (dot) ch
\subsection funding Funding
This software has been developed at the <a href="http://www.adrl.ethz.ch" target="_blank">Agile & Dexterous Robotics Lab</a>
at <a href="http://www.ethz.ch/en" target="_blank">ETH Zurich</a>, Switzerland.
The development has been made possible through financial support from the <a href="http://www.snf.ch/en/" target="_blank">Swiss National Science Foundation (SNF)</a>
through a SNF Professorship award to Jonas Buchli and the National Competence Centers in Research (NCCR)
<a href="https://www.nccr-robotics.ch/" target="_blank">Robotics</a> and <a href="http://www.dfab.ch/en/" target="_blank">Digital Fabrication</a>.
\section licence Licence Information
The Control Toolbox is released under the
<a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank">Apache Licence, Version 2.0</a>.
Please note the licence and notice files in the source directory.
\section cite_ct How to cite the CT
\code
@misc{adrlCT,
author = "Giftthaler, Markus and Neunert, Michael and {St\"auble}, Markus and Buchli, Jonas",
title = "The {Control Toolbox} - An Open-Source {C++} Library for Robotics, Optimal and Model Predictive Control",
howpublished = "\url{https://adrlab.bitbucket.io/ct}",
year = "2018",
note = "arXiv:1801.04290 [cs.RO]"
}
\endcode
\section publications Related Publications
This toolbox has been used in, or has helped to realize the following academic publications:
- Markus Giftthaler, Michael Neunert, Markus Stäuble, Jonas Buchli and Moritz Diehl.
“A Family of iterative Gauss-Newton Shooting Methods for Nonlinear Optimal Control”.
<a href="https://arxiv.org/abs/1711.11006" target="_blank">arXiv preprint</a>
- Michael Neunert, Markus Stäuble, Markus Giftthaler, Dario Bellicoso, Jan Carius, Christian Gehring,
Marco Hutter and Jonas Buchli.
“Whole Body Model Predictive Control Through Contacts For Quadrupeds”.
To appear in IEEE Robotics and Automation Letters.
<a href="https://arxiv.org/abs/1712.02889" target="_blank">arXiv preprint</a>
- Markus Giftthaler and Jonas Buchli.
“A Projection Approach to Equality Constrained Iterative Linear Quadratic Optimal Control”.
2017 IEEE-RAS International Conference on Humanoid Robots, November 15-17, Birmingham, UK.
<a href="http://ieeexplore.ieee.org/document/8239538/" target="_blank">IEEE Xplore</a>
- Markus Giftthaler, Michael Neunert, Markus Stäuble, Marco Frigerio, Claudio Semini and Jonas Buchli.
“Automatic Differentiation of Rigid Body Dynamics for Optimal Control and Estimation”,
Advanced Robotics, SIMPAR special issue. November 2017.
<a href="https://arxiv.org/abs/1709.03799" target="_blank">arXiv preprint</a>
- Michael Neunert, Markus Giftthaler, Marco Frigerio, Claudio Semini and Jonas Buchli.
“Fast Derivatives of Rigid Body Dynamics for Control, Optimization and Estimation”,
2016 IEEE International Conference on Simulation, Modelling, and Programming for Autonomous Robots,
San Francisco. (Best Paper Award).
<a href="http://ieeexplore.ieee.org/document/7862380/" target="_blank">IEEE Xplore</a>
- Michael Neunert, Farbod Farshidian, Alexander W. Winkler, Jonas Buchli
"Trajectory Optimization Through Contacts and Automatic Gait Discovery for Quadrupeds",
IEEE Robotics and Automation Letters,
<a href="http://ieeexplore.ieee.org/document/7845678/" target="_blank">IEEE Xplore</a>
- Michael Neunert, Cédric de Crousaz, Fadri Furrer, Mina Kamel, Farbod Farshidian, Roland Siegwart, Jonas Buchli.
"Fast nonlinear model predictive control for unified trajectory optimization and tracking",
2016 IEEE International Conference on Robotics and Automation (ICRA),
<a href="http://ieeexplore.ieee.org/document/7487274/" target="_blank">IEEE Xplore</a>
- Markus Giftthaler, Farbod Farshidian, Timothy Sandy, Lukas Stadelmann and Jonas Buchli.
“Efficient Kinematic Planning for Mobile Manipulators with Non-holonomic Constraints Using Optimal Control”,
IEEE International Conference on Robotics and Automation, 2017, Singapore.
<a href="https://arxiv.org/abs/1701.08051" target="_blank">arXiv preprint</a>
- Markus Giftthaler, Timothy Sandy, Kathrin Dörfler, Ian Brooks, Mark Buckingham, Gonzalo Rey,
Matthias Kohler, Fabio Gramazio and Jonas Buchli.
“Mobile Robotic Fabrication at 1:1 scale: the In situ Fabricator”. Construction Robotics, Springer Journal no. 41693
<a href="https://arxiv.org/abs/1701.03573" target="_blank">arXiv preprint</a>
- Timothy Sandy, Markus Giftthaler, Kathrin Dörfler, Matthias Kohler and Jonas Buchli.
“Autonomous Repositioning and Localization of an In situ Fabricator”,
IEEE International Conference on Robotics and Automation 2016, Stockholm, Sweden.
<a href="http://ieeexplore.ieee.org/document/7487449/" target="_blank">IEEE Xplore</a>
- Michael Neunert, Farbod Farshidian, Jonas Buchli (2014). Adaptive Real-time Nonlinear Model Predictive Motion Control.
In IROS 2014 Workshop on Machine Learning in Planning and Control of Robot Motion
<a href="http://www.adrl.ethz.ch/archive/p_14_mlpc_mpc_rezero.pdf" target="_blank">preprint</a>
*/