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
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
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
The output PWM had five sets (VN: Very Negative; N: Negative; Z: Zero; P: Positive; VP: Very Positive) as shown in Figure 8.
The fuzzy set limits were later adjusted for practical implementation as will de described later. The fuzzy rules are summarized in Table 1.
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.