Watch the video that goes with this repository for a primer on fuzzy logic control here: https://www.youtube.com/watch?v=_MahS96EqQA
Read the IEEE paper for a more complete understanding of applying intuition to fuzzy logic controller design
The simulation folder contains the MATLAB/Simulink source code for a 2-wheeled robot and self-balancing controller.
I should note that I'm not sure exactly who created the original robot model as there seem to be many versions now but I adapted mine from a model by Mouad Boumediene here.
At a high-level, the model consists of a fuzzy logic controller in a closed-loop with a plant which describes the robot. The controller considers the angle, angular velocity, position and linear velocity of the robot when making decisions.
Simulink multibody was used to describe the physics of the cart by introducing both gravity and friction with the floor into the simulation.
The model also allows the various feedback dimensions to be introduced separately. For example, from left to right, after the changes:
- No closed-loop feedback
- Angle only
- Adding angular velocity
- Adding position
- Adding linear velocity