Class BaseSwerveDriveSubsystem

All Implemented Interfaces:
Sendable, Subsystem, DataFrameRefreshable, IPropertySupport, ISwerveAdvisorDriveSupport

public abstract class BaseSwerveDriveSubsystem extends BaseDriveSubsystem implements DataFrameRefreshable, ISwerveAdvisorDriveSupport
  • Constructor Details

  • Method Details

    • getPositionalPIDDefaults

      protected PIDDefaults getPositionalPIDDefaults()
      Returns the default PID values for the positional PID. Override this method to change the default values.
      Returns:
      The default PID values.
    • getHeadingPIDDefaults

      protected PIDDefaults getHeadingPIDDefaults()
      Returns the default PID values for the heading PID. Override this method to change the default values.
      Returns:
      The default PID values.
    • getSwerveDriveKinematics

      public SwerveDriveKinematics getSwerveDriveKinematics()
    • getMaxTargetSpeedMetersPerSecond

      public double getMaxTargetSpeedMetersPerSecond()
    • getMaxTargetTurnRate

      public double getMaxTargetTurnRate()
    • getPositionalPid

      public PIDManager getPositionalPid()
      Specified by:
      getPositionalPid in class BaseDriveSubsystem
    • getRotateToHeadingPid

      public PIDManager getRotateToHeadingPid()
      Specified by:
      getRotateToHeadingPid in class BaseDriveSubsystem
    • getRotateDecayPid

      public PIDManager getRotateDecayPid()
      Specified by:
      getRotateDecayPid in class BaseDriveSubsystem
    • fieldOrientedDrive

      public void fieldOrientedDrive(XYPair translation, double rotation, double currentHeading, XYPair centerOfRotationInches)
    • setManualBalanceMode

      public void setManualBalanceMode(boolean isActive)
    • isManualBalanceModeActive

      public boolean isManualBalanceModeActive()
    • isGamePieceRotationActive

      public boolean isGamePieceRotationActive()
    • setGamePieceOrientatedRotationActive

      public void setGamePieceOrientatedRotationActive(boolean isActive)
    • isCollectorRotationActive

      public boolean isCollectorRotationActive()
    • setCollectorOrientedTurningActive

      public void setCollectorOrientedTurningActive(boolean isActive)
    • isUnlockFullDrivePowerActive

      public boolean isUnlockFullDrivePowerActive()
    • setUnlockFullDrivePower

      public void setUnlockFullDrivePower(boolean value)
    • createUnlockFullDrivePowerCommand

      public Command createUnlockFullDrivePowerCommand()
    • isPrecisionTranslationActive

      public boolean isPrecisionTranslationActive()
    • isExtremePrecisionTranslationActive

      public boolean isExtremePrecisionTranslationActive()
    • setPrecisionTranslationActive

      public void setPrecisionTranslationActive(boolean isActive)
    • setExtremePrecisionTranslationActive

      public void setExtremePrecisionTranslationActive(boolean isActive)
    • isPrecisionRotationActive

      public boolean isPrecisionRotationActive()
    • setPrecisionRotationActive

      public void setPrecisionRotationActive(boolean isActive)
    • isRobotOrientedDriveActive

      public boolean isRobotOrientedDriveActive()
    • setIsRobotOrientedDrive

      public void setIsRobotOrientedDrive(boolean isActive)
    • setQuickAlignActive

      public void setQuickAlignActive(boolean isActive)
    • isQuickAlignActive

      public boolean isQuickAlignActive()
    • isRotateToHubActive

      public boolean isRotateToHubActive()
    • setRotateToHubActive

      public void setRotateToHubActive(boolean isActive)
    • move

      public void move(XYPair translate, double rotate)
      Set the target movement speed and rotation, rotating around the center of the robot.
      Specified by:
      move in class BaseDriveSubsystem
      Parameters:
      translate - The translation velocity.
      rotate - The rotation velocity.
    • move

      public void move(XYPair translate, double rotate, XYPair centerOfRotationInches)
      Set the target movement speed and rotation, with an arbitrary center of rotation.
      Parameters:
      translate - The translation velocity.
      rotate - The rotation velocity.
      centerOfRotationInches - The center of rotation.
    • setActivateBrakeOverride

      public void setActivateBrakeOverride(boolean activateBrakeOverride)
    • setWheelsToXMode

      public void setWheelsToXMode()
    • crabDrive

      public void crabDrive(double drivePower, double steeringPower)
      Give the same power to all steering modules, and the another power to all the drive wheels. Does not currently use PID! As a result, wheel positions will vary wildly!
      Parameters:
      drivePower - -1 to 1 power to apply to the drive wheels.
      steeringPower - -1 to 1 power to apply to the steering modules.
    • getLeftTotalDistance

      public double getLeftTotalDistance()
      Description copied from class: BaseDriveSubsystem
      Returns the total distance tracked by the encoder - On the LEFT side of the robot - Pointing in the direction of +Y travel
      Specified by:
      getLeftTotalDistance in class BaseDriveSubsystem
    • getRightTotalDistance

      public double getRightTotalDistance()
      Description copied from class: BaseDriveSubsystem
      Returns the total distance tracked by the encoder - On the RIGHT side of the robot - Pointing in the direction of +Y travel
      Specified by:
      getRightTotalDistance in class BaseDriveSubsystem
    • getTransverseDistance

      public double getTransverseDistance()
      Description copied from class: BaseDriveSubsystem
      Returns the total distance tracked by the encoder - In the center of the robot - Pointing in the direction of +X travel
      Specified by:
      getTransverseDistance in class BaseDriveSubsystem
    • getFrontLeftSwerveModuleSubsystem

      public SwerveModuleSubsystem getFrontLeftSwerveModuleSubsystem()
    • getFrontRightSwerveModuleSubsystem

      public SwerveModuleSubsystem getFrontRightSwerveModuleSubsystem()
    • getRearLeftSwerveModuleSubsystem

      public SwerveModuleSubsystem getRearLeftSwerveModuleSubsystem()
    • getRearRightSwerveModuleSubsystem

      public SwerveModuleSubsystem getRearRightSwerveModuleSubsystem()
    • setActiveModule

      public void setActiveModule(BaseSwerveDriveSubsystem.SwerveModuleLocation activeModule)
      Meant to be used alongside debugging methods. Has no effect when the robot is in normal, "Maintainer" operation.
      Parameters:
      activeModule - Which module to set as the active module.
    • setNextModuleAsActiveModule

      public void setNextModuleAsActiveModule()
      Meant to be used alongside debugging methods. Has no effect when the robot is in normal, "Maintainer" operation. Moves the active module to the next module, according to the pattern FrontLeft, FrontRight, RearLeft, RearRight.
    • setDesiredHeading

      public void setDesiredHeading(double heading)
      Specified by:
      setDesiredHeading in interface ISwerveAdvisorDriveSupport
    • getDesiredHeading

      public double getDesiredHeading()
      Specified by:
      getDesiredHeading in interface ISwerveAdvisorDriveSupport
    • controlOnlyActiveSwerveModuleSubsystem

      public void controlOnlyActiveSwerveModuleSubsystem(double drivePower, double steeringPower)
      Controls the drive power and steering power of the active module. Stops all other modules. Intended for use when you want to investigate a single module without moving all the others.
      Parameters:
      drivePower - -1 to 1 power to apply to the drive component.
      steeringPower - -1 to 1 power to apply to the steering component.
    • getVelocityMaintainerXTarget

      public double getVelocityMaintainerXTarget()
    • setVelocityMaintainerXTarget

      public void setVelocityMaintainerXTarget(double velocityMaintainerXTarget)
    • getPositionMaintainerXTarget

      public double getPositionMaintainerXTarget()
    • setPositionMaintainerXTarget

      public void setPositionMaintainerXTarget(double positionMaintainerXTarget)
    • createEnableDisableQuickAlignActive

      public Command createEnableDisableQuickAlignActive()
    • getSwerveModuleStates

      public SwerveModuleState[] getSwerveModuleStates()
    • setNoviceMode

      public void setNoviceMode(boolean enabled)
    • setDriveModuleCurrentLimits

      public void setDriveModuleCurrentLimits(SwerveDriveSubsystem.CurrentLimitMode mode)
    • createChangeDriveCurrentLimitsCommand

      public Command createChangeDriveCurrentLimitsCommand(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 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
      Overrides:
      refreshDataFrame in class BaseSubsystem