Auto-Balancing Robot

The goal of this project is to create a robot with one line of contact with the ground that stays within a 30cm cube for at least 2 minutes. The project uses a six-axis IMU to calculate tilt angle, and one encoder to mitigate drift.

The biggest problem that was encountered with this project was mitigating runaway or robot drift. Getting the robot to balance for 10-30 seconds was not an issue, but keeping it within the box was difficult. A Sparkfun MPU-6050 breakout 6-axis IMU was used to calculate the tilt angle of the robot and Pololu motors with encoders were used to cancel out the drift. The balancing control structure was just a PD controller and the encoders were used to change the balance point based on how far the robot moved, using a PI controller. The code can be found at my GitHub here

I suggest copying the raw file and pasting it into a syntax highlighter like this one in order to make the code more readable.

Below is a video of the Auto-Balancer using one encoder and an IMU to balance in place. The video was started after about 90 seconds of balancing within the 1x1 foot square, and the robot continued to perform within spec indefinitely.

No comments:

Post a Comment