Class ChassisRequest.ApplyChassisSpeeds

java.lang.Object
com.marswars.swerve_lib.ChassisRequest.ApplyChassisSpeeds
All Implemented Interfaces:
ChassisRequest
Enclosing interface:
ChassisRequest

public static class ChassisRequest.ApplyChassisSpeeds extends Object implements ChassisRequest
Accepts a generic ChassisSpeeds to apply to the drivetrain.
  • Field Details

    • Speeds

      public ChassisSpeeds Speeds
      The chassis speeds to apply to the drivetrain.
    • CenterOfRotation

      public Translation2d CenterOfRotation
      The center of rotation to rotate around.
    • DriveRequestType

      public Module.DriveControlMode DriveRequestType
      The type of control request to use for the drive motor.
    • SteerRequestType

      public Module.SteerControlMode SteerRequestType
      The type of control request to use for the steer motor.
  • Constructor Details

    • ApplyChassisSpeeds

      public ApplyChassisSpeeds()
  • Method Details

    • apply

      public void apply(ChassisRequest.ChassisRequestParameters parameters, Module... modulesToApply)
      Applies this swerve request to the given modules. This is typically called by the SwerveDrivetrain.
      Specified by:
      apply in interface ChassisRequest
      Parameters:
      parameters - Parameters the control request needs to calculate the module state
      modulesToApply - Modules to which the control request is applied
    • withSpeeds

      Sets the chassis speeds to apply to the drivetrain.
      Parameters:
      speeds - Chassis speeds to apply to the drivetrain
      Returns:
      this request
    • withCenterOfRotation

      public ChassisRequest.ApplyChassisSpeeds withCenterOfRotation(Translation2d centerOfRotation)
      Sets the center of rotation to rotate around.
      Parameters:
      centerOfRotation - Center of rotation to rotate around
      Returns:
      this request
    • withDriveRequestType

      public ChassisRequest.ApplyChassisSpeeds withDriveRequestType(Module.DriveControlMode driveRequestType)
      Sets the type of control request to use for the drive motor.
      Parameters:
      driveRequestType - The type of control request to use for the drive motor
      Returns:
      this request
    • withSteerRequestType

      public ChassisRequest.ApplyChassisSpeeds withSteerRequestType(Module.SteerControlMode steerRequestType)
      Sets the type of control request to use for the steer motor.
      Parameters:
      steerRequestType - The type of control request to use for the steer motor
      Returns:
      this request