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.
- Open
main.exe
. - In the command prompt window, enter a starting angle for the pendulum between -60 degrees to +60 degrees.
- Press enter, and the animation of the inverted pendulum problem will run.
- 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.
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.
theta
: Angle of pendulumtheta_dot
: Angular velocity of pendulumx
: Position of cartx_dot
: Velocity of cart
coefficient_A
: 4.5coefficient_B
: 0.7coefficient_C
: 0.6coefficient_D
: 0.5
There are 50 total rules based on combinations of:
theta
(NL, NS, ZE, PS, PL)theta_dot
(NL, NS, ZE, PS, PL)
NL
: (-20, -15, -10, -7) left trapezoidNS
: (-2.5, -2, -0.5, 0) regular trapezoidZE
: (-1.5, -1, 1, 1.5) regular trapezoidPS
: (0, 0.5, 2, 2.5) regular trapezoidPL
: (7, 10, 15, 20) right trapezoid
NL
: (-20,-15,-10,-7) left trapezoidNS
: (-3,-2,-1,0) regular trapezoidZE
: (-2,-1,1,2) regular trapezoidPS
: (0,1,2,3) regular trapezoidPL
: (5,8,12,15) right trapezoid
NL
: (-4, -3, -2, -1) left trapezoidNS
: (-2.5, -2, -0.5, 0) regular trapezoidZE
: (-1.5, -1, 1, 1.5) regular trapezoidPS
: (0, 0.5, 2, 2.5) regular trapezoidPL
: (2, 3, 4, 4) right trapezoid
NL
: (-4, -3, -2, -1) left trapezoidNS
: (-2.5, -2, -0.5, 0) regular trapezoidZE
: (-1.5, -1, 1, 1.5) regular trapezoidPS
: (0, 0.5, 2, 2.5) regular trapezoidPL
: (2, 3, 4, 4) right trapezoid