Coder Social home page Coder Social logo

ilqr's Introduction

ILQR

The Iterative Linear Quadratic Regulator (ILQR) is a control algorithm designed to optimize nonlinear systems. This project implements the ILQR algorithm for various applications, providing a robust and efficient method for trajectory optimization.

There are couple advantages to use this package:

  • Pure C++ implementation
  • Only depends on Eigen (Gtest is optional for testing)
  • Easy dependency control using vcpkg
  • Cross platform (Tested on Ubuntu 22.04, Ubuntu 20.04, Windows 11)
  • High perfomance since there is no dynamic memory allocations (Templated)
  • Provides discritization with different integration steppers
  • Provides numerical differantiation for continuous/discrete system and the cost function

Requirements

Before installing ILQR, ensure you meet the following system requirements:

  • Git
  • CMake
  • A build system such as Make or Ninja
  • A C++ compiler like g++ or clang
  • Optional: Matplotlib, Pandas, and Pillow for visualization

Installation

Follow these steps to install ILQR:

  1. Clone the repository:

    git clone https://github.com/HalukErdogan/ilqr.git
  2. Navigate to the repository directory:

    cd ilqr
  3. Initilize the submodule

    git submodule init
  4. Update the submodule

    git submodule update
  5. Configure the package:

    cmake --preset default
  6. Build the package:

    cmake --build --preset default

Example

An example that demonstrates how to solve a trajectory optimization problem for a pendulum on a cart is given in the "example" folder. Follow the steps provided below to execute the example:

  1. Run the executable:

    For Windows:

    ./build/examples/pendulum_on_cart/Release/pendulum_on_cart.exe

    For Linux:

    ./build/examples/pendulum_on_cart/pendulum_on_cart
  2. Visualize the results:

    python3 ./examples/pendulum_on_cart/scripts/visualize.py

    Result:

  3. Animate the results:

    python3 ./examples/pendulum_on_cart/scripts/animate.py

    Result:

Performance

The performance of the module is tested using the pendulum on cart example provided above. The following table show the execution time of the algorithm in seconds. Tests has been done on 12th Gen Intel(R) Core(TM) i7-12800H processor and Ubuntu 22.04 WSL operation system. The example is built in Release configuration using g++ and make.

Horizon = 101 Horizon = 501 Horizon = 1001
Euler Integration 0.00297155 s 0.00924278 s 0.0175842 s
Runge Kutta 2nd Order 0.00415075 s 0.0180604 s 0.0357379 s
Runge Kutta 3nd Order 0.00721841 s 0.0264217 s 0.0532759 s
Runge Kutta 4nd Order 0.00782524 s 0.0363073 s 0.0706778 s

Note: I wasn't able to recreate same performance results with MSVC. The results were up to 5 times slower with MSVC (Tested on same PC).

Roadmap

  • Add continuous system base class
  • Add discrete system base class
  • Add cost function base class
  • Add continuous system with finite diff class
  • Add discrete system with finite diff class
  • Add cost function with finite diff class
  • Add test for finite diff classes
  • Add Euler integration stepper
  • Add second order Runge - Kutta integration stepper
  • Add third order Runge - Kutta integration stepper
  • Add fourth order Runge - Kutta integration stepper
  • Add constant integration iterator
  • Add discritizer class
  • Add quadratic cost function
  • Add ilqr class
  • Add line search
  • Add example: pendulum on cart
  • Add scripts to visualize and animate the result of example
  • Add inequality constrains using control barrier functions
  • Add adaptive itegration iterator

Contact

Author: Haluk Erdogan

Email: [email protected]

Linkedin: haluk_erdogan

ilqr's People

Contributors

halukerdogan avatar

Stargazers

 avatar Feiyu Xiao avatar Jian Wen avatar  avatar Guilherme Henrique Oliveira Silva avatar shiroyasha avatar Leandro Martins avatar Hosameldin Mohamed avatar Varad Vaidya avatar Siddharth Deore avatar Uğurcan Özalp avatar Ajay Shankar Sriam avatar Enes Cingöz avatar  avatar Kutay avatar Ahmet Mete DOKGÖZ  avatar Harun Yesevi avatar Celil avatar berk avatar Gokalp Unsal avatar Kerem Eyisoy avatar

Watchers

 avatar berk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.