Package frc.spectrumLib.swerve
Class SysID
java.lang.Object
frc.spectrumLib.swerve.SysID
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSysId routine that characterizes rotational drive gains.SysId routine that characterizes steer-module gains.SysId routine that characterizes linear translation drive gains.sysIdDynamic(SysIdRoutine.Direction direction) Returns a dynamic (step) characterization command for the active routine.sysIdQuasistatic(SysIdRoutine.Direction direction) Returns a quasistatic (slow ramp) characterization command for the active routine.
-
Constructor Details
-
SysID
Constructs all three SysId routines and selectsSysIdRoutineTranslationas the active routine. ChangeRoutineToApplyat the bottom of this constructor to switch which routine is exercised bysysIdQuasistatic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction)andsysIdDynamic(edu.wpi.first.wpilibj2.command.sysid.SysIdRoutine.Direction).- Parameters:
swerve- theSwervesubsystem that will be commanded during characterization
-
-
Method Details
-
sysIdQuasistatic
Returns a quasistatic (slow ramp) characterization command for the active routine.- Parameters:
direction- the direction (SysIdRoutine.Direction.kForwardorSysIdRoutine.Direction.kReverse) in which to ramp the output- Returns:
- a command that slowly ramps the output and logs data for system identification
-
sysIdDynamic
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
SysId routine that characterizes linear translation drive gains. -
getSysIdRoutineRotation
SysId routine that characterizes rotational drive gains. -
getSysIdRoutineSteer
SysId routine that characterizes steer-module gains.
-