GithubHelp home page GithubHelp logo

khoatranrb / inverted_pendulum Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nikkhil16/inverted_pendulum

0.0 1.0 0.0 3.07 MB

Simulator for cart-pole system. LQR and PID controllers to balance an inverted pendulum.

Python 100.00%

inverted_pendulum's Introduction

Readme for this folder

'no_force_input.mp4' shows the behavior of the system if there is no control input. This shows that the physics of the simulator is correct.
'pid.mp4' shows the behavior of the system if a PID controller is used
'lqr.mp4' shows the behavior of the system if a PID controller is used
'inverted_pendulum.py' is the code
_________________________________________________________________________________________________________________________________________________
Readme for 'inverted_pendulum.py'

This code uses the following libraries:
numpy, cv2, math, time, matplotlib and control (https://pypi.python.org/pypi/control/0.7.0)

To install the control library please run the following:
>> pip install slycot
(If this gives an error like 'fortran compiler not found', please run >> sudo apt-get install gfortran)
>> pip install control

Usage: python inverted_pendulum.py <controller_used>
Options for <controller_used> = "lqr","pid"
Example: python inverted_pendulum.py lqr

Running the code will show a simulation of the system. The simulation runs for 30 seconds but this can be changed in the main() function. 
When the simulation ends, 4 graphs are shown which show the:
- error vs time, 
- theta value (of the pendulum) vs time,
- force input vs time, and 
- X position of the cart vs time. 
_________________________________________________________________________________________________________________________________________________

inverted_pendulum's People

Contributors

nikkhil16 avatar

Watchers

 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.