Skip to content

This repo contains demo ROS code based on Control-Toolbox and ACADO Toolkit

Notifications You must be signed in to change notification settings

zhangbaozhe/ControlLibraryDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code Repo for Tutorial: Introducing Two Control Libraries -- Control Toolbox and ACADO Toolkit

This repo contains the following packages:

  • control-toolbox (modified from upstream): from https://github.com/ethz-adrl/control-toolbox
    • ct: meta package
    • ct_core: core library
    • ct_optcon: optimal control library
  • kindr: needed by control-toolbox
  • invpend_experiment: containing the necessary description of a inverted pendulum, I forked from https://github.com/linZHank/invpend_experiment
  • acado: containing ACADO source code. This folder will be ignored during catkin compilation
  • control_demo: containing demo control programs using the two libraries written in C++
    • ct_quad_circle_mpc.cpp -> executable ct_quad_circle_mpc_node: (non-linear) model predictive control for quadrotor tracking a circle using control-toolbox
    • ct_invpend_pid.cpp -> executable ct_invpend_pid_node: using one PID feedback controller to control the inverted pendulum stay stable, but not working
    • ct_invpend_lqr.cpp -> executable ct_invpend_lqr_node: using linear quadratic regulator feedback controller to control the inverted pendulum staying stable, working, but less robust
    • ct_invpend_mpc.cpp -> executable ct_invpend_mpc_node: (non-linear) model predictive control for the inverted pendulum staying stable, working
    • acado_invpend_mpc.cpp -> executable acado_invpend_mpc_node: Linear MPC for the inverted pendulum staying stable, working

Installation Guide

First, make a workspace folder, say demo_ws

$ mkdir demo_ws

Next clone this repo as src folder

$ git clone https://github.com/zhangbaozhe/ControlLibraryDemo.git src

Then install the following dependencies:

  • gflags:
    $ sudo apt install libgflags-dev
  • catkin tools:
    $ sudo apt install python-catkin-tools
    or
    $ sudo apt install python3-catkin-tools
  • Control Toolbox dependencies:
    • HPIPM & blasfeo: Go to src/control-toolbox/ct
      $ cd src/control-toolbox/ct
      $ bash install_hpipm.sh
  • invpend_experiment dependencies:
    $ sudo apt install ros-noetic-ros-control ros-noetic-ros-controllers ros-noetic-gazebo-ros ros-noetic-gazebo-ros-control
  • mavros:
    $ sudo apt-get install ros-noetic-mavros ros-noetic-mavros-extras
    $ wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
    $ sudo bash ./install_geographiclib_datasets.sh 

In the workspace folder:

$ catkin build -DCMAKE_BUILD_TYPE=Release -j2

If you have more than 8GB RAM or even 16GB, you can maybe drop -j2 option. If you want compile the examples and tests in control toolbox you can type

$ catkin build -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLES=true -DBUILD_TESTS=true -j2

The compilation may take a while, since C++ templates compilation consumes huge resources.

(Optional) If you want to use the quadrotor demo, you need to use PX4-Autopilot simulation.

Executables

Run the inverted pendulum demo: In one terminal (in the workspace folder):

$ source devel/setup.bash
$ roslaunch invpend_control load_invpend.launch

In another terminal

$ source devel/setup.bash
$ rosrun control_demo ct_invpend_mpc_node

About

This repo contains demo ROS code based on Control-Toolbox and ACADO Toolkit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published