Class ModuleIOTalonFX
java.lang.Object
com.stuypulse.robot.subsystems.swerve.ModuleIOTalonFX
- All Implemented Interfaces:
ModuleIO
Module IO implementation for Talon FX drive motor controller, Talon FX turn motor controller, and
CANcoder. Configured using a set of module constants from Phoenix.
Device configuration and other behaviors not exposed by TunerConstants can be customized here.
-
Nested Class Summary
Nested classes/interfaces inherited from interface ModuleIO
ModuleIO.ModuleIOInputs -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.ctre.phoenix6.hardware.CANcoderprivate final com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.CANcoderConfiguration> private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Voltage> private final org.wpilib.math.filter.Debouncerprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current> private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Angle> private final com.ctre.phoenix6.hardware.TalonFXprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.AngularVelocity> private final com.ctre.phoenix6.controls.PositionTorqueCurrentFOCprivate final com.ctre.phoenix6.controls.PositionVoltageprivate final com.ctre.phoenix6.controls.TorqueCurrentFOCprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Angle> private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Voltage> private final org.wpilib.math.filter.Debouncerprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Current> private final org.wpilib.math.filter.Debouncerprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.Angle> private final com.ctre.phoenix6.hardware.TalonFXprivate final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.AngularVelocity> private final com.ctre.phoenix6.controls.VelocityTorqueCurrentFOCprivate final com.ctre.phoenix6.controls.VelocityVoltageprivate final com.ctre.phoenix6.controls.VoltageOut -
Constructor Summary
ConstructorsConstructorDescriptionModuleIOTalonFX(com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.CANcoderConfiguration> constants) -
Method Summary
Modifier and TypeMethodDescriptionvoidsetDriveOpenLoop(double output) Run the drive motor at the specified open loop value.voidsetDriveVelocity(double velocityRadPerSec) Run the drive motor at the specified velocity.voidsetTurnOpenLoop(double output) Run the turn motor at the specified open loop value.voidsetTurnPosition(org.wpilib.math.geometry.Rotation2d rotation) Run the turn motor to the specified rotation.private static voidtryUntilOk(int maxAttempts, Supplier<com.ctre.phoenix6.StatusCode> command) voidupdateInputs(ModuleIO.ModuleIOInputs inputs) Updates the set of loggable inputs.
-
Field Details
-
constants
private final com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.CANcoderConfiguration> constants -
driveTalon
-
turnTalon
-
cancoder
-
voltageRequest
-
positionVoltageRequest
-
velocityVoltageRequest
-
torqueCurrentRequest
-
positionTorqueCurrentRequest
-
velocityTorqueCurrentRequest
-
timestampQueue
-
drivePosition
-
drivePositionQueue
-
driveVelocity
private final com.ctre.phoenix6.StatusSignal<org.wpilib.units.measure.AngularVelocity> driveVelocity -
driveAppliedVolts
-
driveCurrent
-
turnAbsolutePosition
-
turnPosition
-
turnPositionQueue
-
turnVelocity
-
turnAppliedVolts
-
turnCurrent
-
driveConnectedDebounce
-
turnConnectedDebounce
-
turnEncoderConnectedDebounce
-
-
Constructor Details
-
ModuleIOTalonFX
public ModuleIOTalonFX(com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.TalonFXConfiguration, com.ctre.phoenix6.configs.CANcoderConfiguration> constants)
-
-
Method Details
-
tryUntilOk
-
updateInputs
Description copied from interface:ModuleIOUpdates the set of loggable inputs.- Specified by:
updateInputsin interfaceModuleIO
-
setDriveOpenLoop
Description copied from interface:ModuleIORun the drive motor at the specified open loop value.- Specified by:
setDriveOpenLoopin interfaceModuleIO
-
setTurnOpenLoop
Description copied from interface:ModuleIORun the turn motor at the specified open loop value.- Specified by:
setTurnOpenLoopin interfaceModuleIO
-
setDriveVelocity
Description copied from interface:ModuleIORun the drive motor at the specified velocity.- Specified by:
setDriveVelocityin interfaceModuleIO
-
setTurnPosition
Description copied from interface:ModuleIORun the turn motor to the specified rotation.- Specified by:
setTurnPositionin interfaceModuleIO
-