Class SysID

java.lang.Object
frc.spectrumLib.swerve.SysID

public class SysID extends Object
Encapsulates the three SysId characterization routines for a CTRE swerve drivetrain: translation, rotation, and steer-gains.

Construct one instance per robot, passing the Swerve subsystem. Then bind sysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction) and sysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction) to test-mode triggers. Change RoutineToApply (by editing the source) to select which routine runs.

  • Constructor Details

  • Method Details

    • sysIdQuasistatic

      public Command sysIdQuasistatic(SysIdRoutine.Direction direction)
      Returns a quasistatic (slow ramp) characterization command for the active routine.
      Parameters:
      direction - the direction (SysIdRoutine.Direction.kForward or SysIdRoutine.Direction.kReverse) in which to ramp the output
      Returns:
      a command that slowly ramps the output and logs data for system identification
    • sysIdDynamic

      public Command sysIdDynamic(SysIdRoutine.Direction direction)
      Returns a dynamic (step) characterization command for the active routine.
      Parameters:
      direction - the direction in which to apply the voltage step
      Returns:
      a command that applies a step voltage and logs data for system identification
    • getSysIdRoutineTranslation

      public SysIdRoutine getSysIdRoutineTranslation()
      SysId routine that characterizes linear translation drive gains.
    • getSysIdRoutineRotation

      public SysIdRoutine getSysIdRoutineRotation()
      SysId routine that characterizes rotational drive gains.
    • getSysIdRoutineSteer

      public SysIdRoutine getSysIdRoutineSteer()
      SysId routine that characterizes steer-module gains.