Verify and calibrate your hardware
Before your first drive, confirm every sensor and motor reports direction consistently, and capture each module's absolute encoder offset. Skipping this step is the single most common cause of a swerve drive that "spins out" or drives in the wrong direction.
Make sure every CAN ID is unique across your entire robot. A known failure mode: if a SparkMAX shares a CAN ID with your REV Power Distribution Hub, the SparkMAX simply won't move — with no obvious error.
Physically label everything
Label each motor controller, encoder, and gyroscope with its CAN ID/channel and connection type before you start. This is the easiest step to get wrong and the hardest mistake to spot afterward.
Check your gyroscope
Front is whatever the gyroscope reports as
0. Pick a front, and expect that you may need to change it later if it turns out to be inconvenient.The gyroscope must report increasing yaw while the robot rotates counterclockwise. If it doesn't, invert it.
If you're using a NavX, recalibrate it once it arrives at your shop — NavX units ship calibrated to the humidity of their factory, not your build space. Recalibrate again periodically, especially at competition.
Check your motors
Deploy your code with the config from step 3, then — with the robot disabled — spin each motor by hand and watch AdvantageScope's Mechanisms/swerve NetworkTables tree.

Rotate the drive wheel forward (CCW as viewed from above). That module's
modules/<name>/drive/mechanism/positionshould increase. If it doesn't, invert the drive motor.Rotate the angle mechanism CCW (viewed from above). Both
modules/<name>/azimuth/mechanism/position(relative) andmodules/<name>/encoder(absolute) should increase. If either doesn't, invert that motor or encoder respectively.Rotate the entire robot CCW.
Mechanisms/swerve/gyroshould increase. If not, invert the gyroscope.
See Determine Inversion for the full decision procedure if any of these don't behave as expected — or work through config.yagsl.com/guide, which walks through this same alignment process interactively.
If you're using a hardware vendor client to poke at motors/encoders directly, the roboRIO must not be active on the CAN bus at the same time. The most reliable way to do this without disturbing CAN bus termination is to briefly pull the roboRIO's breaker/fuse on the PDP, then power-cycle the robot.
Capture absolute encoder offsets
The absolute encoder offset is what lets your swerve module remember wheel orientation across power cycles — it's essential to a functioning swerve drive.
Manually rotate all four wheels so they point in the same direction — bevel gears facing left, as in the diagram below — and forward rotation increases the drive encoder.

With the robot still disabled, open AdvantageScope and read each module's
Mechanisms/swerve/modules/<name>/encodervalue while it's held in that aligned position.Enter each value as that module's absolute encoder offset — either back in the config generator (recommended: upload your existing config, update the four offset fields, and re-download) or directly in
absoluteEncoderOffsetin the module's JSON file.
Special note for MAXSwerve teams: after aligning the wheels, you may need to add or subtract 90 from the measured offset to get the module pointing truly forward, and set absoluteEncoderInverted to true. This is a quirk of how MAXSwerve mounts its absolute encoder, not a bug in your measurement.
Once every module reports correctly and has a captured offset, move on to deploying and driving.
Last updated
Was this helpful?