Requirements:
System Requirements
- Ubuntu 16.04 or 18.04
- a compiler with C++14 support, e.g. gcc or clang
Required Dependencies
- install Eigen 3 via
sudo apt-get update
sudo apt-get install libeigen3-dev
- install boost
sudo apt-get install libboost-all-dev
- clone the kindr library into your workspace
cd ~/your_workspace/src
git clone https://github.com/ANYbotics/kindr.git
- finally, clone the control toolbox into your workspace
cd ~/your_workspace/src
git clone https://github.com/ethz-adrl/control-toolbox.git
Building the CT
For ROS or catkin users
Compiling the Library
It is assumed that you have a valid catkin-workspace set up, e.g. using catkin tools. Then, execute the following steps.
cd ~/your_workspace
catkin build -DCMAKE_BUILD_TYPE=Release
Building and running examples
To build an run the examples, e.g. the optimal control and optimal filtering examples:
cd ~/your_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
source devel/setup.bash
rosrun ct_optcon ex_NLOC
rosrun ct_optcon ex_KalmanFiltering
Building and running the unit tests
To build an run the unit tests:
cd ~/your_workspace
catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=true
Building the documentation
To build the documentation execute
catkin build ct_doc -v --make-args doc
This will build the documentation. The index.html can be found in ct_doc/doc/html
Using plain cmake.
Compiling the Library
First, make sure you build and install the kindr-library, see here. Then go to your local clone of the control toolbox and run the build script:
cd your_workspace/control-toolbox/ct
chmod 775 build_ct.sh
./build_ct.sh -DCMAKE_BUILD_TYPE=Release
Building and running examples
Then go to your local clone of the control toolbox and run the build script with the following flags.
cd your_workspace/control-toolbox/ct
./build_ct.sh -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true
This creates a /build subdirectory in every single CT-project, where the examples will be located. For running the nonlinear optimal control or filtering examples, for instance, go to your workspace an run
./src/control-toolbox/ct_optcon/build/examples/ex_NLOC
./src/control-toolbox/ct_optcon/build/examples/ex_KalmanFiltering
Building and running the unit tests
To build an run the unit tests:
cd your_workspace/control-toolbox/ct
./build_ct.sh -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=true
Building the documentation
cd your_workspace/control-toolbox/ct
chmod 775 build_doc.sh
./build_doc.sh
The index.html can be found in ct_doc/doc/html
Clean up
In order to clean up the build workspaces, run the clean script
cd your_workspace/control-toolbox/ct
chmod 775 clean_ct.sh
./clean_ct.sh
Optional Dependencies and Bindings
The following dependencies and bindings are optional but can help to enhance the user-experience or performance of the CT
- lapack (enables Schur method as an alternative to iterative method in ct::optcon::LQR)
$ sudo apt-get install liblapack-dev
- clang compiler (faster compilation for large linear models), install from command-line via
$ sudo apt-get install clang
and possibly replace clang
with a more specific version, e.g. clang-3.8
. Please make sure that the clang
and clang++
commands are in your path. You may need to create a symbolic link in /usr/bin
or use a bash alias.
- IPOPT or SNOPT (for ct::optcon::SnoptSolver and ct::optcon::IpoptSolver as used by ct::optcon::DMS)
- blasfeo linear algebra and <a href=https://github.com/giaf/hpipm">HPIPM solver as alternative high-performance (constrained) linear-quadratic optimal control solver. The CT currently supports hpipm version 0.1.1. Detailed reference about blasefeo can be found here. Both packages were developed by Gianluca Frison, University of Freiburg.
- install the catkin_tools build system
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt-get update
sudo apt-get install python-catkin-tools
- Qwt (for basic plotting)
- MATLAB (for Matlab logging)
- clang-format, install via
$ sudo apt-get install clang-format
build arguments
The following additional build flags are available, which can be appended to the build command above
Build Flag | Default value | Description |
-DBUILD_EXAMPLES=<BOOL> | FALSE | Builds examples for all packages |
-DBUILD_HYQ_FULL=<FALSE> | FALSE | Build HyQ examples and executables (warning: slow with GCC!) |
-DUSE_CLANG=<BOOL> | FALSE | Use CLANG instead of the default compiler |
-DCLANG_CXX_COMPILER=<clang-bin> | "/usr/bin/clang++" | Set clang C++ compiler binary |
-DCLANG_C_COMPILER=<clang-bin> | "/usr/bin/clang" | Set clang C compiler binary |
-DUSE_INTEL=<BOOL> | FALSE | Use Intel compiler instead of the default compiler |
-DINTEL_CXX_COMPILER=<clang-bin> | "/opt/intel/bin/icc" | Set Intel C++ compiler binary |
-DINTEL_C_COMPILER=<clang-bin> | "/opt/intel/bin/icpc" | Set Intel C compiler binary |