Auto In A Box
Auto in a box is Midlands STEMbotics's solution for robot movement during autonomous, and can be used by ANY team looking to get their robot moving on it's own. Using known values (such as wheel diameter and encoder counts-per-revolution), as well as the REV Robot Controller's built in IMU, new teams can quickly get their robot moving relatively accurately using a simple set of pre-defined function commands. Below, we have base versions of both our 2-wheeled tank drive and Mecanum variants of the Auto in a Box code.
This code is free for any team to use, simply adjust the variables in the init functions as needed, test/ validate which motors need to be reversed (we do it each season by setting the motors to run in the forward direction, and seeing which ones need to be adjusted), change your motor names to match your hardware config (when you open the opmode, it should give errors for each time the motor needs to be renamed), then add command blocks for each movement you want. The only major bug currently is that due to the setup of the IMU code, it's recommended not to make single turns greater than ~165 degrees in either direction (if you drift past 180, bad things happen......)
We hope you find these OpModes useful. If you do, send us an email and let us know!