Skip to content

bryce496913/Inverted-Pendulum-Problem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Inverted Pendulum Problem with Fuzzy Logic Controller

This repository contains a simulation and animation of the Inverted Pendulum Problem implemented with a Fuzzy Logic Controller. The simulation and animation were created by Dr. Napoleon Reyes, and the Fuzzy Logic System was developed by Bryce Cameron.

How to Run

  1. Open main.exe.
  2. In the command prompt window, enter a starting angle for the pendulum between -60 degrees to +60 degrees.
  3. Press enter, and the animation of the inverted pendulum problem will run.

Fuzzy Logic Controller Details

  • The fuzzy logic controller successfully balances the inverted pendulum system within a range of initial pendulum starting angles from -14 to +15 degrees.
  • It avoids exceeding the cart track boundaries of -2.4m to 2.4m or dropping the pendulum.
  • Performance is achieved through a rule base of 50 tuned logical rules governing the cart force output and optimized membership functions shaping the input values.

System Stability

For initial pendulum angles within the stable range of -14 to +15 degrees, the fuzzy controller can maintain pendulum balance indefinitely, keeping the pole upright and the cart close to the center. This capability results from tuning of output force response, allowing the system to recover from disturbances.

In summary, the fuzzy controller provides reliable real-time balancing for the inverted pendulum, keeping it stable for continuous operation across a 29-degree initial angle range.

Input Details

Inputs

  • theta: Angle of pendulum
  • theta_dot: Angular velocity of pendulum
  • x: Position of cart
  • x_dot: Velocity of cart

Coefficients

  • coefficient_A: 4.5
  • coefficient_B: 0.7
  • coefficient_C: 0.6
  • coefficient_D: 0.5

Fuzzy Rules

There are 50 total rules based on combinations of:

  • theta (NL, NS, ZE, PS, PL)
  • theta_dot (NL, NS, ZE, PS, PL)

Membership Functions

Theta

  • NL: (-20, -15, -10, -7) left trapezoid
  • NS: (-2.5, -2, -0.5, 0) regular trapezoid
  • ZE: (-1.5, -1, 1, 1.5) regular trapezoid
  • PS: (0, 0.5, 2, 2.5) regular trapezoid
  • PL: (7, 10, 15, 20) right trapezoid

Theta_dot

  • NL: (-20,-15,-10,-7) left trapezoid
  • NS: (-3,-2,-1,0) regular trapezoid
  • ZE: (-2,-1,1,2) regular trapezoid
  • PS: (0,1,2,3) regular trapezoid
  • PL: (5,8,12,15) right trapezoid

X

  • NL: (-4, -3, -2, -1) left trapezoid
  • NS: (-2.5, -2, -0.5, 0) regular trapezoid
  • ZE: (-1.5, -1, 1, 1.5) regular trapezoid
  • PS: (0, 0.5, 2, 2.5) regular trapezoid
  • PL: (2, 3, 4, 4) right trapezoid

X_dot

  • NL: (-4, -3, -2, -1) left trapezoid
  • NS: (-2.5, -2, -0.5, 0) regular trapezoid
  • ZE: (-1.5, -1, 1, 1.5) regular trapezoid
  • PS: (0, 0.5, 2, 2.5) regular trapezoid
  • PL: (2, 3, 4, 4) right trapezoid

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages