Class BaseDriveSubsystem

java.lang.Object
org.wpilib.command2.SubsystemBase
xbot.common.command.BaseSubsystem
xbot.common.subsystems.drive.BaseDriveSubsystem
All Implemented Interfaces:
org.wpilib.command2.Subsystem, org.wpilib.telemetry.TelemetryLoggable, TunablePrefixProvider
Direct Known Subclasses:
BaseSwerveDriveSubsystem, MockDriveSubsystem

public abstract class BaseDriveSubsystem extends BaseSubsystem
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final double
     

    Fields inherited from class BaseSubsystem

    aKitLog, log
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    arcadeDrive(double yTranslation, double rotation)
    Classic arcade drive
    void
    cheesyDrive(double translation, double rotation)
    Slightly adapted from 254's 2016 CheesyDriveHelper.java.
    void
    drive(double left, double right)
    Classic tank drive.
    void
    drive(XYPair translation, double rotation)
    Commands each of the XCANTalons to respond to translation/rotation input.
    void
    drive(XYPair translation, double rotation, boolean normalize)
    Commands each of the XCANTalons to respond to translation/rotation input.
    void
    fieldOrientedDrive(XYPair translation, double rotation, double currentHeading, boolean normalize)
     
    abstract double
    Returns the total distance tracked by the encoder - On the LEFT side of the robot - Pointing in the direction of +Y travel
    protected double
    getMaxOutput(XYPair translation, double rotation)
    Determine the largest commanded output for a given wheel for a given translation/rotation input.
    abstract PIDManager
     
    org.wpilib.math.geometry.Translation2d
    getPowerForRelativePositionChange(org.wpilib.math.geometry.Translation2d goalPosition)
     
    org.wpilib.math.geometry.Translation2d
    getPowerForRelativePositionChange(PIDManager pidManager, org.wpilib.math.geometry.Translation2d goalPosition)
    Returns the recommended power (units -1 to 1) to achieve a relative position change.
    abstract double
    Returns the total distance tracked by the encoder - On the RIGHT side of the robot - Pointing in the direction of +Y travel
    abstract PIDManager
     
    abstract PIDManager
     
    abstract double
    Returns the total distance tracked by the encoder - In the center of the robot - Pointing in the direction of +X travel
    abstract void
    move(XYPair translate, double rotate)
     
    void
    setQuickTurn(boolean value)
     
    void
     
    void
    tankDrive(double left, double right)
    Classic tank drive.

    Methods inherited from class BaseSubsystem

    getPrefix, periodic

    Methods inherited from class org.wpilib.command2.SubsystemBase

    getName, getTelemetryType, logTo, setName

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.wpilib.command2.Subsystem

    defer, getCurrentCommand, getDefaultCommand, idle, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
  • Field Details

  • Constructor Details

    • BaseDriveSubsystem

      public BaseDriveSubsystem()
  • Method Details

    • getPositionalPid

      public abstract PIDManager getPositionalPid()
    • getRotateToHeadingPid

      public abstract PIDManager getRotateToHeadingPid()
    • getRotateDecayPid

      public abstract PIDManager getRotateDecayPid()
    • move

      public abstract void move(XYPair translate, double rotate)
    • getLeftTotalDistance

      public abstract double getLeftTotalDistance()
      Returns the total distance tracked by the encoder - On the LEFT side of the robot - Pointing in the direction of +Y travel
    • getRightTotalDistance

      public abstract double getRightTotalDistance()
      Returns the total distance tracked by the encoder - On the RIGHT side of the robot - Pointing in the direction of +Y travel
    • getTransverseDistance

      public abstract double getTransverseDistance()
      Returns the total distance tracked by the encoder - In the center of the robot - Pointing in the direction of +X travel
    • drive

      public void drive(XYPair translation, double rotation, boolean normalize)
      Commands each of the XCANTalons to respond to translation/rotation input. Each "wheel" is independently responsible, and as such there isn't any actual drive logic in this method.
      Parameters:
      translation - +Y is towards the front of the robot, +X is towards the right of the robot. Range between -1 and 1.
      rotation - +Rotation is left turn, -Rotation is right turn. Range between -1 and 1.
      normalize - If the largest output is greater than 1, should all outputs be normalized so that 1 is the maximum?
    • drive

      public void drive(XYPair translation, double rotation)
      Commands each of the XCANTalons to respond to translation/rotation input. Each "wheel" is independently responsible, and as such there isn't any actual drive logic in this method.
      Parameters:
      translation - +Y is towards the front of the robot, +X is towards the right of the robot. Range between -1 and 1
      rotation - +Rotation is left turn, -Rotation is right turn. Range between -1 and 1.
    • drive

      public void drive(double left, double right)
      Classic tank drive.
      Parameters:
      left - Power to the left drive motor. Range between -1 and 1.
      right - Power to the right drive motor. Range between -1 and 1.
    • fieldOrientedDrive

      public void fieldOrientedDrive(XYPair translation, double rotation, double currentHeading, boolean normalize)
    • setQuickTurn

      public void setQuickTurn(boolean value)
    • cheesyDrive

      public void cheesyDrive(double translation, double rotation)
      Slightly adapted from 254's 2016 CheesyDriveHelper.java.
    • stop

      public void stop()
    • arcadeDrive

      public void arcadeDrive(double yTranslation, double rotation)
      Classic arcade drive
      Parameters:
      yTranslation - Translation power. Range between -1 and 1.
      rotation - Rotation power. Range between -1 and 1.
    • tankDrive

      public void tankDrive(double left, double right)
      Classic tank drive.
      Parameters:
      left - Power to the left drive motor. Range between -1 and 1.
      right - Power to the right drive motor. Range between -1 and 1.
    • getMaxOutput

      protected double getMaxOutput(XYPair translation, double rotation)
      Determine the largest commanded output for a given wheel for a given translation/rotation input. For example, you would see a maximum output of two in a Tank Drive system that's commanded to go forward at full speed AND rotate at full speed.
    • getPowerForRelativePositionChange

      public org.wpilib.math.geometry.Translation2d getPowerForRelativePositionChange(PIDManager pidManager, org.wpilib.math.geometry.Translation2d goalPosition)
      Returns the recommended power (units -1 to 1) to achieve a relative position change.
      Parameters:
      goalPosition - The desired change in position, relative to the robot.
      Returns:
      Power to apply to the drive subsystem (e.g. the magnitude of a Translation2d, whose x/y components would be sent to a move() call.
    • getPowerForRelativePositionChange

      public org.wpilib.math.geometry.Translation2d getPowerForRelativePositionChange(org.wpilib.math.geometry.Translation2d goalPosition)