Go Down

Topic: Self Balancing arduino robot directly controlled with a Wiimote (Read 9968 times) previous topic - next topic

X-firm

Hello guys

My second robot is starting to get ready but i think I will add one PID for each motor that will try to keep the setpoint speed in (deg/sec). To try to get the motors to behave as equal as possible.. Also have a fuzzy logic control to order the motors to compensate for the error in angle. What do you guys think about that? (One PID for each motor)

I also want to add a better calibration of the sensors then in my old one that was based a lot on Kas code. Something like needing to tilt it 180 deg laing it on the floor then making a sound and then tilting it -180 deg to the other side. Then calculate the calibration values from those two positions or letting the user hold the robot in some more positions may be?

I will post some pictures of my bot this week on my blog.. I also want to integrate a display and some pots for debugging with out the need of a GUI..
The balancing robot for dummies guide
http://www.x-firm.com/?page_id=145

Timen

@Danilo

K = 1.9 and Kd = -8 Kp = 40 and Ki = 1 Try those values and if it does not balance well than something else is going on because at those values your robot probally will vibrate like hell but stay upright.
If it stays upright than you have got some starting point.
Btw what wheels are you using (diameter?)

And Patrick fuzzy logics will improve the bot a lot! but it's some pretty hard stuff to learn.
And if you use motor encoders than you don't really need to calibrate the sensor, because it will sort of self calibrate due to you taking the motor encoders into the PID Calculation.

When you look at it it is pretty easy to understand if your bot is wrongly calibrated and moves forward than you encoder count starts going up and will want to go back to zero. Eventually a balance will set in with the encoder PID compensating the wrongly calibrated sensors.

And displays are always usefull!

prof_jazz

mY wheels: Pololu Wheel 90x10mm Pair - Black

no. it does not works with Your K set....

I think there is something wrong in Kalman even if the angle is whell evaluated, maybe it is a little bit slower than the real angle and this creates a phase problem... I am still investigating.

bye


prof_jazz

Hi Timen,

could You please attach a print out of Serial Monitor (2 minutes is enough) while Your boot is up and stable (with no inputs from the wiimote) using this code within the loop:

Serial.print(ACC_angle, DEC);     Serial.print(",");
Serial.print(GYRO_rate, DEC);     Serial.print(",");
Serial.print(actAngle, DEC);        Serial.print(",");
Serial.print(drive, DEC);            Serial.print(",");
Serial.println(count, DEC);     

I'll make a comparison with my datas to findout my problem...

thanks,

bye



prof_jazz

OK, I find out  the problem...I was using Serial.begin(9600); instead of Serial.begin(115200)...4 simple Serial.print used to debug were taking 40ms...Kalman was KO (the Kas Kalman code is expeting to be used every 10ms...).

Now the Bot can stay up, but I think PID parameters need to be tuned...

You can see the video...   http://www.youtube.com/watch?v=80TN9JbbmVU

Any suggestion?

bye,

Danilo

X-firm

@prof_jazz your not far away just continue to trim your parameters..

Heres my second bot haven't gotten the time to trim it to perfection yet but it's close any how..

Youtube link

How do you add youtube videos on this forum?

More info here..
The balancing robot for dummies guide
http://www.x-firm.com/?page_id=145

prof_jazz

Timen. Patrick,

I am still working on PID tuning...

One simple question....does Your Bot balance even only with PID based on tilt angle (with no PD from encoders)?

In other words, if You put Kp_Wheel=0 and Kd_Wheel=0 and leave untouched Kp, Ki, Kd, dows Your bot still balance?

I am fighting with the first step of balancing (increase Kp till oscillation occours..), then increase Kd (starting from zero) till oscillation disappear..

We all are using the same motors but I cannot reach the  "oscillation occours" status unless using a very high Kp, that means a huge jittering..I know motors are not exactly the same, my be mine have a bigger backslash than yours..

I am trying to use  a quadratic formula like this:  pTerm = 0.75*error*(1.0+1.4*abs(error)) in order to have smoller jitter (around zero) but an aggressive ramp good to make the Bot oscillating.

What do You think about it?

Bye,

Danilo


Go Up