Class SwerveModuleSubsystem

java.lang.Object
org.wpilib.command2.SubsystemBase
xbot.common.command.BaseSubsystem
xbot.common.subsystems.drive.swerve.SwerveModuleSubsystem
All Implemented Interfaces:
org.wpilib.command2.Subsystem, org.wpilib.telemetry.TelemetryLoggable, DataFrameRefreshable, TunablePrefixProvider

public class SwerveModuleSubsystem extends BaseSubsystem implements DataFrameRefreshable
  • Constructor Details

  • Method Details

    • setTargetState

      public void setTargetState(org.wpilib.math.kinematics.SwerveModuleVelocity swerveModuleState)
      Sets the target steering angle and drive power for this module, in METRIC UNITS.
      Parameters:
      swerveModuleState - Metric swerve module state
    • setTargetState

      public void setTargetState(org.wpilib.math.kinematics.SwerveModuleVelocity swerveModuleState, boolean optimize)
    • getCurrentState

      public org.wpilib.math.kinematics.SwerveModuleVelocity getCurrentState()
      Gets the current state of the module, in METRIC UNITS.
      Returns:
      Metric swerve module state
    • getCurrentPosition

      public org.wpilib.math.kinematics.SwerveModulePosition getCurrentPosition()
    • getTargetState

      public org.wpilib.math.kinematics.SwerveModuleVelocity getTargetState()
    • getPrefix

      public String getPrefix()
      Specified by:
      getPrefix in interface TunablePrefixProvider
      Overrides:
      getPrefix in class BaseSubsystem
    • getModuleTranslation

      public org.wpilib.math.geometry.Translation2d getModuleTranslation()
    • getDriveSubsystem

      public SwerveDriveSubsystem getDriveSubsystem()
    • getSteeringSubsystem

      public SwerveSteeringSubsystem getSteeringSubsystem()
    • setNoviceMode

      public void setNoviceMode(boolean enabled)
    • setPowers

      public void setPowers(double drivePower, double steeringPower)
      Very basic drive method - bypasses all PID to directly control the motors. Ensure that your command has required control of all relevant subsystems before doing this, or you will be fighting the maintainers.
      Parameters:
      drivePower - -1 to 1 value for nodule wheel power
      steeringPower - -1 to 1 value for module rotation power
    • setDriveCurrentLimits

      public void setDriveCurrentLimits(SwerveDriveSubsystem.CurrentLimitMode mode)
    • periodic

      public void periodic()
      Description copied from class: BaseSubsystem
      This method is called on each CommandScheduler loop.
      Specified by:
      periodic in interface org.wpilib.command2.Subsystem
      Overrides:
      periodic in class BaseSubsystem
    • refreshDataFrame

      public void refreshDataFrame()
      Description copied from interface: DataFrameRefreshable
      Consumes and processes inputs from the device or subsystem.
      Specified by:
      refreshDataFrame in interface DataFrameRefreshable