echandler5956f / Galileo

A light-weight and extensible C++ library for Pseudospectral Collocation of Switched Systems
MIT License
34 stars 3 forks source link

Galileo

A light-weight and extensible C++ library for Pseudospectral Collocation of Switched Systems using CasADi and Pinocchio.

https://github.com/echandler5956f/Galileo/assets/93096172/49862201-a646-40b6-a981-e85d98b7d64e

https://github.com/echandler5956f/Galileo/assets/93096172/33dc9110-773e-4203-9bde-9af5f97494c9

See the extended abstract for details!

Documentation License BSD-3-Clause

Named after the famous scientist who posed one variation of the Brachistochrone problem, Galileo is an efficient optimal control framework that uses Gauss-Legendre Pseudospectral Collocation to solve the switched systems problem for legged robots.

Features:

:heavy_check_mark: Intuitive and efficient formulation of variables, cost and constraints using CasADi.

:heavy_check_mark: Solver interface enables using the high-performance solvers Ipopt and SNOPT.

:heavy_check_mark: pinocchio makes custom robot integration as simple as switching the URDF.

:heavy_check_mark: ROS/catkin integration (optional).

:heavy_check_mark: Light-weight framework makes it easy to use and extend.


InstallRunVisualizeDevelopContributePublicationsCredits


Install

The following Linux installation instructions are provided for your convenience:

From source with CMake

  1. Install Galileo's mandatory dependencies:

  2. Install Galileo's optional dependencies

CasADi Source Install

First, gather the dependencies listed here: https://github.com/casadi/casadi/wiki/InstallationLinux

Then, clone the repo and make a build folder with

git clone https://github.com/casadi/casadi.git && cd casadi && mkdir build && cd build

Now, run

cmake -DCMAKE_BUILD_TYPE=Release -DWITH_BUILD_IPOPT=ON -DWITH_IPOPT=ON -DWITH_BUILD_METIS=ON -DWITH_MUMPS=ON -DWITH_BUILD_MUMPS=ON  ..

If you have an HSL license (highly recommended, as these solvers tend to speed up convergence by ~2x for our problems, and academics can acquire one for free!), you should manually build the ThirdParty-HSL interface and then add the following CasADi flag:

 -DWITH_HSL=ON

If you want to compile CasADi with OpenMP (recomended), you can add

 -DWITH_OPENMP=ON

Similarly, you can add the optional SNOPT interface with

 -DWITH_SNOPT=ON

Now, build CasADi from source:

 make
 sudo make install

Pinocchio Source Install

First, gather the dependencies listed here: https://stack-of-tasks.github.io/pinocchio/download.html

Clone the repo and its submodules:

git clone --recursive https://github.com/stack-of-tasks/pinocchio

Checkout the Pinocchio3 preview branch

cd pinocchio && git checkout pinocchio3-preview

Make a build directory

mkdir build && cd build

Run cmake with CasADi support

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_WITH_CASADI_SUPPORT=ON ..

If you are not building the Python interface, you can add the following flag:

-DBUILD_PYTHON_INTERFACE=OFF

and then build and install with

make -j4
sudo make install

Gnuplot Optional Install

Gnuplot is our plotting library of choice. Installation is very straightforward from the package manager with:

sudo apt-get update
sudo apt-get install gnuplot

Galileo Source Install

Once you have the required dependencies for Galileo, clone the repo

git clone https://github.com/echandler5956f/Galileo.git

create a build directory

cd Galileo && mkdir build && cd build

and finally, build and install Galileo with

 cmake -DCMAKE_BUILD_TYPE=Release .. && make && sudo make install

Optionally, you can add the -DBUILD_WITH_OPENMP=ON flag to enable using OpenMP for parallel evaluation of the constraint maps (highly recommended). Note that you must have enabled the OpenMP interface when installing CasADi for this to work.

To uninstall the library, simply run

sudo make uninstall

from within the build directory.

Run

We created a test-installs folder with some simple scripts to test your CasADi + pinocchio install. Be sure to take a look if you are running into trouble. To test the actual library, please refer to the examples folder. If you have already built the repo from source, you can test it by running

build/examples/huron_test

or

build/examples/go1_test

in the main repo directory.

Visualize

The solutions output by Galileo can be easily visualized using our ROS interface.

To run Galileo and visualize a solution using Rviz, run

roslaunch galileo_ros go1_galileo_ros.launch

and in another terminal

roslaunch galileo_ros go1_galileo_ros_rviz.launch

We also support connection with https://github.com/YifuYuan/legged_control. Follow the installation instructions listed, and launch a Galileo ROS legged robot example such as

roslaunch galileo_ros go1_galileo_ros.launch

and then launch the legged control nodes as instructed on the repo's readme. The control schematic for the combined Galileo + perceptive legged_control framework is as follows:

BiQu '24 URPS

This approach has been used to deploy Galileo in Gazebo and on the real Unitree Go1 hardware.

Documentation

Doxygen

Run

doxygen

in the main directory, and then open the index.html file in the docs folder. If you are using WSL like me, you can run

cd docs/html && explorer.exe index.html

to view the doxygen output.

Develop

Right now, our main development goal is to get the framework to solve general trajectory optimization problems with fixed contact sequences in an MPC context. This is essentially the same problem that OCS2 and Crocoddyl solve. Our hope is that using Pseudospectral Collocation will yield faster convergence, and that the Casadi + Pinocchio pipeline will result in smaller, more digestible code, which is easier to expand upon than the bulky frameworks mentioned prior.

Contribute

We are open to contributions from the community! Please feel free to submit a pull request or post an issue if you have any suggestions. This framework is still in its most nascent phase, and will take time to mature. Be patient, and hopefully something good will come from this work.

Publications

Coming soon (ICRA 2025?).

Credits

Written by

With contributions from

Advised by