Two Wheeled Inverted Pendulum fuzzy controller

I controlled my balance robot using a a two fuzzy logic controller 1-one for (IMU feedback) using as input the angle and change in angle , the output is a PWM1 . 2-second for (encoder feedback) use a wheels velocity as input and the output is a PWM2 . PWM=PWM1+PWM2 (motor Control)

self balance

  • Actuators / output devices: DC Motors, Pololu dual VNH5019 motor driver
  • CPU: Arduino Mega
  • Sensors / input devices: MPU6050

This is a companion discussion topic for the original entry at https://community.robotshop.com/robots/show/two-wheeled-inverted-pendulum-fuzzy-controller

Balance Robot

Please provide more details. I am currently trying to program a self balancer but having difficulties getting the feedback loop tuned.

it is so hard to tuning a

it is so hard to tuning a mebershipe function parameters , but you have to try and try until you get it right 

look :

Based to eFLL (Embedded Fuzzy Logic Library) ,for Arduino we created a two Fuzzy controller one for pendulum tilt and second for wheels velocity, the total of their output gives the control signal to stabilize a TWIP as showing in figure 

Fuzzy.png

first controller (IMU feedback)

 

the system has two inputs (angle and angle change) and one output (PWM). Each one from input used five fuzzy sets (VN: Very Negative; N: Negative; Zero; P: Positive; and VP: Very Positive) as shown in figure 5 for Angle and figure 6 for change of angle

 

Fuzzy2.png

 

The output PWM had five sets (VN: Very Negative; N: Negative; Z: Zero; P: Positive; VP: Very Positive) as shown in Figure 8.

 

Fuzzy3.png

      The fuzzy set limits were later adjusted for practical implementation as will de described later. The fuzzy rules are summarized in Table 1.

 

Fuzzy4.png

a)       Second Fuzzy controller  (Wheels Velocity controller)

 

the system has one inputs (Wheel Speed) and one output (PWM). input used three fuzzy sets (N: Negative; Zero; P: Positive)

 


 

LQG

I made a same thing by using LQG ,but my robot dosn’t seem a stable ???

 

I know that my problem come from “stats estimator” “LQE” and my state space modulation.

 

anyone can help, I will be happy for that.

 

 

Kalman Filter

LQG uses the Kalman filter. I have observed (no scientific backing) that angles presented to the Kalman filter, that I got from Arduino code on the web, take about 8 state changes to propagate thru the filter. I was taking samples every 10msec but found the PWM to bring it vertical was still being applied after the robot had passed thru the vertical orientation. Not a good explanation but the motor was assisting in the falling motion.

Changed the sample period to 2 msec and things got a little better. Also played with the filter parameters to get a faster response. Faster also means less stability.

Fuzzy controllor

Hi, 

what do you mean about the change of angle ? and thanks

Fuzzy controllor

Hi, 

what do you mean change of angle ? 

thanks