Need Help with Tank Drive Code for Top Heavy Robot

This year we are a very top heavy robot, and we are struggling to write driving code for tank drive that will keep us from tipping but will not inhibit the motion or inputs of the bot. Right now we are simply giving percent output to our motors (4 falcon500s) for each side, and limiting how fast they can ramp up and down. But, this leads to some very bad lagging in the driving which makes it nearly impossible to drive. If you have had and solved this problem, please let me know the methodology you took to solve it, because it is very much impacting our performance and we cannot figure out the solution that we need.
Spencer Hopkins 6705

We were in the exact same situation, and our solution was to use a slew rate limiter. It’s basically ramping, but you can put the slew rate limiter on your controller inputs instead of the motors themselves. This lets you leave turning completely unimpeded while limiting acceleration and deceleration of the robot.

Note: With a top heavy robot, it is nearly impossible to make it simultaneously impossible to tip, and feel good to drive. Our robot can still very much tip, but with any care from the drivers, it won’t. Yesterday we had drive team tryouts, and not a single person tipped the robot, and most of them were driving for the first time.

1 Like

If you have a gyro, you may want to look into using it to automatically balance the robot

1 Like