Go Down

Topic: Balancing robot always fall to one side (Read 3831 times) previous topic - next topic

bilal-_-bilal

I solved it.

All I had to do was change the setpoint from 0 degrees to my robot's centre of gravity.
I am now trying to tune the PID.

Code: [Select]

  Setpoint = -0.5;





Also, change this   motorControlPID.SetSampleTime(50);

to

motorControlPID.SetSampleTime(1);


and see what happens.

This is assuming that the library allows for 1 millisecond sampling period.
My motors reacted more smoothly. Also had to lower my PID constants.




Show us a video of what you mean when you say bot working fine. Or at least fine for a while.

Also, show us a video of this off-balance problem.

A lot of us are using 6050 and our bots are balancing very nicely. The accelerometers can provide angle readings that are good enough for the bot to balance properly. The gyro-scopes can also be used to measure angles fairly accurately over relatively short duration, and could (if we want to) be combined with the accelerometer angle measurements to get better estimates of the bot's inclination angle.

You mentioned you get consistent readings ...... and I assume consistent and accurate. If you're getting consistent readings all of the time when you test the bot by holding it in your hand, and the motors always move in the correct direction (as you mentioned), then there shouldn't be any reason for the bot to run off in the wrong direction.
By working fine, I meant that the bot didn't want run off in one direction.
I think that I couldn't detect the problem by holding the robot in my hand is because the error was less than +/-0.5 degrees.

Southpark

That's good news bilal. I think you're on your way to getting it to work well now. Looking good.

Go Up