Swerve Requests#

Controlling the drivetrain is done using setControl(SwerveRequest request) (Java) which takes a given SwerveRequest (Java). There are multiple pre-defined SwerveRequest implementations, or users can define their own (only recommended for advanced scenarios).

Applying a Request#

Requests are instantiated once and then mutated using various withX functions. In the below example, a FieldCentric (Java) request is created and given values from a joystick.

SwerveDrivetrain m_drivetrain = TunerConstants.DriveTrain;
SwerveRequest.FieldCentric m_driveRequest = new SwerveRequest.FieldCentric()

XboxController m_joystick = new XboxController(0);

public void teleopPeriodic() {


Users can optionally make their own SwerveRequests by implementing the SwerveRequest interface.