Git Product home page Git Product logo

ilqr's Introduction

About

This is a solution to the CartPole-Swing Up problem using a pre-existing iLQR implementation from https://github.com/TGlad/ILQR.

What I did

  • added a CartPole class / problem definition, following the example Acrobot class / problem definition

    • implemented the dynamics CartPole::f(), copying from the Python code CartPole.step() provided in the assignment
    • implemented the cost functions CartPole::l(), CartPole::lf(), finding a penalization scheme that produces the desired final state
  • added cartpole_main.cpp that runs the pre-existing iLQR implementation / solver on the above CartPole problem

    • copied parameter values (time delta td, trajectory length T, initial state x0) from the assignment code

git diff wrt. fork base:

https://github.com/TGlad/ILQR/compare/22cf187bbc11d29de83eae57d413d0c3823aa687...wiktortomczak:ILQR:master

CartPole-Swing Up iLQR results visualization

cartpole.mp4

How to compile and run

Compile

optimized

g++ cartpole_main.cpp -o cartpole_main -Wall -O3

debug

g++ cartpole_main.cpp -o cartpole_main -Wall -O0 -g

requires Eigen C++ library (Debian/Ubuntu: apt install libeigen3-dev)

Run

$ cartpole_main                                # outputs cartpole.trajectory.csv
$ cartpole_render.py cartpole.trajectory.csv   # outputs cartpole.mp4

Files

  • cartpole.h - CartPole problem definition (dynamics & cost functions)
  • cartpole_main.cpp - executable, runs iLQR implementation on the above problem
  • cartpole.trajectory.csv - iLQR output, optimized (state, control) trajectory
  • cartpole.mp4 - visualization of the above trajectory
  • cartpole_render.py - visualization code, extracted from the assignment code

TODO: cartpole_main static binary

ilqr's People

Contributors

thomas-lowe avatar wiktortomczak avatar tglad avatar

Watchers

James Cloos 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.