https://github.com/farshidnooshi/fuzzy-inverted-pendulum-controller
Implementation of Inverted Pendulum with Fuzzy Expert System.
https://github.com/farshidnooshi/fuzzy-inverted-pendulum-controller
Last synced: about 2 months ago
JSON representation
Implementation of Inverted Pendulum with Fuzzy Expert System.
- Host: GitHub
- URL: https://github.com/farshidnooshi/fuzzy-inverted-pendulum-controller
- Owner: FarshidNooshi
- Created: 2022-01-21T14:39:35.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T14:40:15.000Z (over 3 years ago)
- Last Synced: 2025-02-09T21:11:16.608Z (4 months ago)
- Language: Python
- Homepage:
- Size: 4.04 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Fuzzy Inverted Pendulum
Basically, this project consists of an inverted pendulum simulator and a fuzzy controller. The main goal was to develop a simple yet useful simulator to model the environment, so that you are enabled to easily create a fuzzy controller for the inverted pendulum problem.
It was implemented using **pygame** and **pyfuzzy** in *python2.7*.## Getting Started
### Install
$ sudo pip install virtualenv
$ virtualenv -p python2.7 venv
$ source venv/bin/activate
$ ./install-deps.sh### Run
$ ./main.py
Also, you can run the project using custom configurations located in the **configs** directory.
$ ./main.py configs/full.ini
## Usage
### Physical parameters of simulator
> **M**: cart mass, *kg*
>
> **m**: pendulum mass, *kg*
>
> **l**: pendulum length, *m*
>
> **x**: cart position, *m*
>
> **v**: cart velocity, *m/s*
>
> **a**: cart acceleration, *m/s^2*
>
> **theta**: pendulum central angle, *radian*
>
> **omega**: pendulum angular velocity, *m/s*
>
> **alpha**: pendulum angular acceleration, *m/s^2*
>
> **g**: gravity acceleration, *m/s^2*
>
> **b**: cart coefficient of friction, *newton/m/s*
>
> **I**: moment of inertia, *kg.m^2*
>
> **min_x**: cart minimum x, *m*
>
> **max_x**: cart maximum x, *m*
>
> **force**: force applied on cart, *newton*You can see all the parameters in **world.py** module.
Also these parameters can be modified using configuration files located in **configs** directory.### Fuzzy Control Language (FCL)
The *FuzzyController* class in **controller.py** module, loads an *FCL* file to decide how much force needs to be applied to the cart in each cycle of simulation.
*FCL* files can be found in **controllers** directory. You can create your own controller by writing a new *FCL* file and specifying it in the *config* files by changing the *fcl_path* item.**configs/default.ini**:
[simulator]
dt = 0.1
fps = 60[controller]
fcl_path = controllers/simple.fcl[world]
theta = -90.0### Simple FCL Controller
We have created a simple controller that works just fine and can be found in **controllers** directory. You can also checkout the fuzzy variables chart, available in the **images** directory.