Class SwerveRequest.SysIdSwerveRotation

java.lang.Object
com.ctre.phoenix6.swerve.SwerveRequest.SysIdSwerveRotation
All Implemented Interfaces:
SwerveRequest
Enclosing interface:
SwerveRequest

public static class SwerveRequest.SysIdSwerveRotation extends Object implements SwerveRequest
SysId-specific SwerveRequest to characterize the rotational characteristics of a swerve drivetrain. This is useful to characterize the heading controller for FieldCentricFacingAngle.

The RotationalRate of this swerve request should be logged. When importing the log to SysId, set the "voltage" to RotationalRate, "position" to the Pigeon 2 Yaw, and "velocity" to the Pigeon 2 AngularVelocityZWorld. Note that the position and velocity will both need to be scaled by pi/180.

Alternatively, the MotorVoltage of one of the drive motors can be loaded into the SysId "voltage" field, which can be useful when determining the MOI of the robot.

  • Field Details

    • RotationalRate

      public double RotationalRate
      The angular rate to rotate at, in radians per second.
  • Constructor Details

  • Method Details

    • apply

      public StatusCode apply(SwerveDrivetrain.SwerveControlParameters parameters, SwerveModule<?,?,?>... modulesToApply)
      Description copied from interface: SwerveRequest
      Applies this swerve request to the given modules. This is typically called by the SwerveDrivetrain odometry thread.

      For native swerve requests, this API can be called from a non-native request's apply to compose the two together.

      Specified by:
      apply in interface SwerveRequest
      Parameters:
      parameters - Parameters the control request needs to calculate the module state
      modulesToApply - Modules to which the control request is applied
      Returns:
      Status code of sending the request
    • withRotationalRate

      public SwerveRequest.SysIdSwerveRotation withRotationalRate(double newRotationalRate)
      Update the angular rate to rotate at, in radians per second.
      Parameters:
      newRotationalRate - Angular rate to rotate at
      Returns:
      this request
    • withRotationalRate

      Update the angular rate to rotate at.
      Parameters:
      newRotationalRate - The angular rate to rotate at
      Returns:
      this request