Here is a project update. Balancing is making progress slowly but surely. Up until recently, the robot would stay up but IMU drift would cause it to lose track of the balance point. Its position on the ground was also not controlled; Lil’Bot would simply go wherever it needed to in order to stay balanced.
Now the balance point is adaptive based on the amount of effort required, backward or forward, to stay up. With this source of error compensated, Lil’Bot stays balanced for a very long time.
Here is a short video of the balancing as of today:
The robot’s position on the ground and its rotation are locked in using the wheel encoders. It does not do a perfect job of staying in place for two reasons:
1. The motors are not very precise. They require a lot of energy to get started, and then overshoot. So a small amount of back-and-forth is inevitable.
2. The wheel encoders have a 2-degree resolution at the wheel, but do not track wheel direction perfectly. The Arduino computes the backward or forward wheel motion by detecting the pulses from the wheel encoder and adding to or subtracting from an integer position value based on the polarity of the current motor command. The motors’ response time is not instantaneous, and when the motors go back and forth, as in balancing, the algorithm gets confused. It can probably be fine-tuned by adding some delay and/or filtering to correlate the polarity of the motor current with the actual wheel direction.
The next step will be to make the robot go forward or backward by a set distance, and rotate by a set angle, all the while keeping its balancing act, of course.
In summary, the software will evolve continuously until delivery, but looks good so far. Lil’Blocks is not as concerning as the balancing and fine control, and will therefore come last. The hardware manufacturing appears to be on time.
Enjoy the summer,