Swerve functionality is only available for FRC users.
New in 2024 is a high performance swerve framework. This framework simplifies the boilerplate necessary for swerve and maximizes performance.
This section focuses on utilizing the Swerve API and configuring it correctly. Tuner X supports a swerve project creator that greatly simplifies this process and removes common error cases.
Small API surface, easily debuggable
Integrates cleanly into WPILib command-based framework using
CommandSwerveDrivetrain(from our examples or Tuner X).
Telemetrize directly in the odometry loop using the
Supports handling the swerve state via
Supports robot-centric, field-centric and field-centric facing angle.
Supports common scenarios such as X mode (point all modules toward the center of the robot).
Simulation boilerplate is automatically handled when generating a robot project using Tuner X.
Utilizing the swerve API requires that the robot drivetrain is composed of supported Phoenix 6 devices. At a minimum, these requirements are:
8 TalonFX motor controllers (4 steer, 4 drive)
1 Pigeon 2.0
Overview on the API#
Simple usage of the API is comprised of 4 core classes:
This class handles characteristics of the robot that are not module specific. e.g. CAN bus, Pigeon 2 ID, whether FD is enabled or not.
Factory class that is used to instantiate
SwerveModuleConstantsfor each module on the robot.
Represents the characteristics for a given module.
SwerveModuleConstantsfor each module, this is used to control the swerve drivetrain.
Usage of these classes is available in the following articles in this section.