Class Module

java.lang.Object
frc.RebeLib.subsystems.drive.Module

public class Module extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Module(ModuleIO io, int index, com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration,com.ctre.phoenix6.configs.TalonFXSConfiguration,com.ctre.phoenix6.configs.TalonFXSConfiguration> constants)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    edu.wpi.first.math.geometry.Rotation2d
    Returns the current turn angle of the module.
    double
    Returns the module velocity in rotations/sec (Phoenix native units).
    edu.wpi.first.math.kinematics.SwerveModulePosition[]
    Returns the module positions received this cycle.
    double[]
    Returns the timestamps of the samples received this cycle.
    edu.wpi.first.math.kinematics.SwerveModulePosition
    Returns the module position (turn angle and drive position).
    double
    Returns the current drive position of the module in meters.
    edu.wpi.first.math.kinematics.SwerveModuleState
    Returns the module state (turn angle and drive velocity).
    double
    Returns the current drive velocity of the module in meters per second.
    double
    Returns the module position in radians.
    void
     
    void
    runCharacterization(double output)
    Runs the module with the specified output while controlling to zero degrees.
    void
    runSetpoint(edu.wpi.first.math.kinematics.SwerveModuleState state)
    Runs the module with the specified setpoint state.
    void
    Disables all outputs to motors.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Module

      public Module(ModuleIO io, int index, com.ctre.phoenix6.swerve.SwerveModuleConstants<com.ctre.phoenix6.configs.TalonFXConfiguration,com.ctre.phoenix6.configs.TalonFXSConfiguration,com.ctre.phoenix6.configs.TalonFXSConfiguration> constants)
  • Method Details

    • periodic

      public void periodic()
    • runSetpoint

      public void runSetpoint(edu.wpi.first.math.kinematics.SwerveModuleState state)
      Runs the module with the specified setpoint state. Mutates the state to optimize it.
    • runCharacterization

      public void runCharacterization(double output)
      Runs the module with the specified output while controlling to zero degrees.
    • stop

      public void stop()
      Disables all outputs to motors.
    • getAngle

      public edu.wpi.first.math.geometry.Rotation2d getAngle()
      Returns the current turn angle of the module.
    • getPositionMeters

      public double getPositionMeters()
      Returns the current drive position of the module in meters.
    • getVelocityMetersPerSec

      public double getVelocityMetersPerSec()
      Returns the current drive velocity of the module in meters per second.
    • getPosition

      public edu.wpi.first.math.kinematics.SwerveModulePosition getPosition()
      Returns the module position (turn angle and drive position).
    • getState

      public edu.wpi.first.math.kinematics.SwerveModuleState getState()
      Returns the module state (turn angle and drive velocity).
    • getOdometryPositions

      public edu.wpi.first.math.kinematics.SwerveModulePosition[] getOdometryPositions()
      Returns the module positions received this cycle.
    • getOdometryTimestamps

      public double[] getOdometryTimestamps()
      Returns the timestamps of the samples received this cycle.
    • getWheelRadiusCharacterizationPosition

      public double getWheelRadiusCharacterizationPosition()
      Returns the module position in radians.
    • getFFCharacterizationVelocity

      public double getFFCharacterizationVelocity()
      Returns the module velocity in rotations/sec (Phoenix native units).