Class ModuleTalonFX

All Implemented Interfaces:
SubsystemIoBase

public class ModuleTalonFX extends Module
TalonFX-based swerve module implementation with optional simulation support.
  • Field Details

  • Constructor Details

    • ModuleTalonFX

      public ModuleTalonFX(String logging_prefix, int index, SwerveModuleConfig config)
      Creates a new TalonFX swerve module.
      Parameters:
      logging_prefix - Logging prefix for telemetry
      index - Module index (0-3)
      config - Module configuration
  • Method Details

    • readInputs

      public void readInputs(double timestamp)
      Read inputs from hardware or simulation
      Parameters:
      timestamp - the current timestamp
    • setDriveOpenLoop

      public void setDriveOpenLoop(double output)
      Run the drive motor at the specified open loop value.
      Specified by:
      setDriveOpenLoop in class Module
    • setSteerOpenLoop

      public void setSteerOpenLoop(double output)
      Run the turn motor at the specified open loop value.
      Specified by:
      setSteerOpenLoop in class Module
    • setDriveVelocity

      public void setDriveVelocity(double wheelVelocityRadPerSec)
      Run the drive motor at the specified velocity.
      Specified by:
      setDriveVelocity in class Module
    • setSteerPosition

      public void setSteerPosition(Rotation2d rotation)
      Run the turn motor to the specified rotation.
      Specified by:
      setSteerPosition in class Module
    • setDriveGains

      public void setDriveGains(int slot, SlotConfigs gains)
      Set the gains for the module drive motors to the given slot
      Specified by:
      setDriveGains in class Module
    • setSteerGains

      public void setSteerGains(SlotConfigs gains)
      Set the gains for the module steer motors to the given slot
      Specified by:
      setSteerGains in class Module
    • setModuleOffset

      public void setModuleOffset()
      Stores the current encoder reading as an offset
      Overrides:
      setModuleOffset in class Module
    • setNeutralMode

      public void setNeutralMode(NeutralModeValue mode)
      Sets the neutral mode for both motors
      Overrides:
      setNeutralMode in class Module
    • writeOutputs

      public void writeOutputs(double timestamp)
      Write outputs to hardware or simulation
      Parameters:
      timestamp - the current timestamp
    • logData

      public void logData()
      Log data to NetworkTables or other logging systems