Swerve drive is a highly maneuverable drivetrain for FRC robotics teams. Swerve drive allows for the operator to strafe the robot in any of 360 degrees as well as rotate along the same axis. Conversely, as easy as this makes it for the drivers, swerve drive significantly complicates the job of the programmers. This guide is for any FRC team that wishes to use swerve on their robot. All code examples will be written in Java, although any useful programmer should be able to port them to a C variant if necessary.
Swerve drive operates using two joysticks from a single controller. The first joystick we will call the ‘strafing’ joystick, as pushing it will cause the robot to drive in the pointed direction. The second joystick we will call the ‘rotation’ joystick, where pushing to the left causes a counterclockwise spin and right causes a clockwise spin.
This was written by Jacob Misirian of FIRST Robotics Team 2506 of Franklin, WI.