Introduction to Swerve Lesson

Introduction to Swerve Drive

Welcome to one of the most exciting and powerful topics in FRC. Swerve drive is the key to our robot's incredible maneuverability and a core part of our team's identity on the field.

What is a Swerve Drive?

A swerve drive is a type of robot drivetrain where each of the four wheels can both drive and steer independently. Unlike a standard tank drive, this gives our robot unparalleled flexibility and control.

The Swerve Module

Each of the four wheels is part of a "swerve module" that contains:

  • A drive motor to spin the wheel for movement.
  • A steering motor to turn the entire wheel assembly 360 degrees.
  • A steering sensor (encoder) to report the wheel's exact angle.

Why We Use Swerve

Using a swerve drive is a significant challenge, but the benefits are massive and give us a competitive edge.

  • Omnidirectional Movement: A swerve drive can move in any direction at any time. It can drive forward, slide sideways (strafe), or move diagonally, all while facing the same direction.
  • Unmatched Maneuverability: We can easily navigate around other robots and obstacles in tight spaces.
  • Precise Autonomous Control: We can program the robot to drive complex, smooth paths that would be impossible with a tank drive.

The Two Main Control Modes

When driving a swerve robot, there are two primary ways to control it. The code uses a mathematical model called kinematics to translate driver input into the correct speed and angle for each of the four modules.

Robot-Oriented Control

In this mode, the controls are always relative to the robot's front. Pushing the joystick forward always makes the robot drive in whatever direction it's currently facing. This is how a tank drive works, but it can be disorienting with swerve's ability to strafe.

Field-Oriented Control

This is the most powerful and common way we drive our swerve robots. The controls are always relative to the playing field. Pushing the joystick "forward" always moves the robot toward the opponent's alliance station, regardless of which way the robot is facing. This is made possible by using a gyroscope to keep track of the robot's heading.

Test Your Knowledge

Question: What is the key sensor that enables Field-Oriented Control on a swerve drive?