Swerve drivetrains give FRC robots omnidirectional holonomic agility: the chassis can translate in any direction across the field while spinning independently.
Stage 4 teaches the mathematics of swerve kinematics, generating a calibrated drivetrain project in Phoenix Tuner X, and building multi-piece autonomous routines using PathPlanner.
Holonomic Drive Architecture
Section titled “Holonomic Drive Architecture”A modern swerve drivebase pipeline consists of four computational steps every 20ms:
[ Driver Joystick Inputs ] --> [ Field-Oriented Transformation ] --> [ SwerveDriveKinematics ] --> [ 4x Module Control Loops ] ▲ ▲ [ Pigeon 2.0 IMU ] [ 1 kHz Talon FX ]- Driver Input: Commanded forward (), strafe (), and rotation () velocities.
- Field-Orientation: Vector rotation based on IMU yaw heading.
- Kinematics Inverse Transform: Computes target speed and azimuth steering angle for each module.
- Onboard Closed-Loop Execution: Steer motor holds angle via CANcoder feedback; drive motor holds velocity via feedforward.
For reference swerve implementations and tuning constants, consult the team drivebase examples.
Verified Sources & Standards
- WPILib Swerve Drive Kinematics & Odometrydocs.wpilib.orgWPILib Standard
- CTRE Phoenix 6 Swerve Drive Generator Guidev6.docs.ctr-electronics.comHardware Vendor
- PathPlanner Trajectory Planning Documentationpathplanner.devCommunity Reference
Lessons
Swerve Project Generation & Calibration
Generating the CTRE Phoenix 6 Swerve / REV MAXSwerve project, measuring CANcoder absolute magnet offsets, and heading lock PID control.
Swerve Kinematics & Field-Oriented Drive
Mathematical transformations between chassis velocities and swerve module states, gyro field orientation, and wheel speed desaturation.
PathPlanner Autonomous Routines
Designing Bézier paths in the PathPlanner GUI, registering Named Commands, configuring Event Markers, and building full autonomous routines.