Sunday, January 15, 2023

Balance on a Teeter totter

 This year the FRC robots need to balance on a teeter-totter affair on the playing field. 



This video shows an autonomous ESP32 robot attempting to balance itself. I don’t have a gyro at home so I used a 3 axis compass (which gets thrown off when the robot changes direction). I think it will be easier to do with a real gyro. The drive system is cheap continuous rotation servos driven by an ESP32. It is next to impossible to get the servos synced at the same power level and to slow them down, so, again with a real robot that drives straight and slow this enterprise would be improved. Once I sorted out some power issues and a bum servo it was satisfying to see it work.

The code is a simple if structure.

If the x axis is greater than 100 (pointed up) drive forward a bit and wait a bit;
Else If the x axis is less than -100 (pointed down) back up a bit and wait a bit;
Else wait a bit;

No comments:

Post a Comment