Package xbot.common.subsystems.drive
Class BaseDriveSubsystem
java.lang.Object
edu.wpi.first.wpilibj2.command.SubsystemBase
xbot.common.command.BaseSubsystem
xbot.common.subsystems.drive.BaseDriveSubsystem
- All Implemented Interfaces:
Sendable
,Subsystem
,DataFrameRefreshable
,IPropertySupport
- Direct Known Subclasses:
BaseSwerveDriveSubsystem
,MockDriveSubsystem
-
Field Summary
Modifier and TypeFieldDescriptionstatic final double
double
Fields inherited from class xbot.common.command.BaseSubsystem
aKitLog, dataFrameRefreshables, log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
arcadeDrive
(double yTranslation, double rotation) Classic arcade drivevoid
cheesyDrive
(double translation, double rotation) Slightly adapted from 254's 2016 CheesyDriveHelper.java.void
drive
(double left, double right) Classic tank drive.void
Commands each of the XCANTalons to respond to translation/rotation input.void
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 travelprotected double
getMaxOutput
(XYPair translation, double rotation) Determine the largest commanded output for a given wheel for a given translation/rotation input.abstract PIDManager
abstract double
Returns the total distance tracked by the encoder - On the RIGHT side of the robot - Pointing in the direction of +Y travelabstract 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 travelabstract void
void
setQuickTurn
(boolean value) void
stop()
void
tankDrive
(double left, double right) Classic tank drive.Methods inherited from class xbot.common.command.BaseSubsystem
getPrefix, periodic, refreshDataFrame, registerDataFrameRefreshable
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, initSendable, setName, setSubsystem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Subsystem
defer, getCurrentCommand, getDefaultCommand, register, removeDefaultCommand, run, runEnd, runOnce, setDefaultCommand, simulationPeriodic, startEnd, startRun
-
Field Details
-
lastRawCommandedDirection
-
lastRawCommandedRotation
public double lastRawCommandedRotation -
kThrottleDeadband
public static final double kThrottleDeadband- See Also:
-
-
Constructor Details
-
BaseDriveSubsystem
public BaseDriveSubsystem()
-
-
Method Details
-
getPositionalPid
-
getRotateToHeadingPid
-
getRotateDecayPid
-
move
-
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
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
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 1rotation
- +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
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.
-