Package frc.team1711.swerve.subsystems
Class AutoSwerveDrive
- java.lang.Object
-
- edu.wpi.first.wpilibj2.command.SubsystemBase
-
- frc.team1711.swerve.subsystems.SwerveDrive
-
- frc.team1711.swerve.subsystems.GyroSwerveDrive
-
- frc.team1711.swerve.subsystems.AutoSwerveDrive
-
- All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable
,edu.wpi.first.wpilibj2.command.Subsystem
public abstract class AutoSwerveDrive extends GyroSwerveDrive
Expands on theGyroSwerveDrive
for autonomous control, requiring the use ofAutoSwerveWheel
rather thanSwerveWheel
. UsesOdometry
to track the position of the robot on the field.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class frc.team1711.swerve.subsystems.SwerveDrive
SwerveDrive.ControlsConfig
-
-
Constructor Summary
Constructors Constructor Description AutoSwerveDrive(edu.wpi.first.wpilibj.interfaces.Gyro gyro, AutoSwerveWheel flWheel, AutoSwerveWheel frWheel, AutoSwerveWheel rlWheel, AutoSwerveWheel rrWheel, double wheelbaseToTrackRatio)
Creates a newAutoSwerveDrive
givenAutoSwerveWheel
wheels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Position
getPosition()
Gets the currentPosition
of the robot on the field.void
resetPosition(Position newPosition)
Resets the robot's odometry to a givenPosition
.protected void
updateOdometry()
A method overridden inAutoSwerveDrive
which is called to update the odometry systems whenever new inputs are passed to the wheels.-
Methods inherited from class frc.team1711.swerve.subsystems.GyroSwerveDrive
fieldRelativeUserInputDrive, getAbsoluteGyroAngle, getGyroAngle, resetGyro, resetGyro
-
Methods inherited from class frc.team1711.swerve.subsystems.SwerveDrive
autoDrive, initSendable, steerAllWithinRange, steerAndDriveAll, stop, userInputDrive
-
Methods inherited from class edu.wpi.first.wpilibj2.command.SubsystemBase
addChild, getName, getSubsystem, setName, setSubsystem
-
-
-
-
Constructor Detail
-
AutoSwerveDrive
public AutoSwerveDrive(edu.wpi.first.wpilibj.interfaces.Gyro gyro, AutoSwerveWheel flWheel, AutoSwerveWheel frWheel, AutoSwerveWheel rlWheel, AutoSwerveWheel rrWheel, double wheelbaseToTrackRatio)
Creates a newAutoSwerveDrive
givenAutoSwerveWheel
wheels.- Parameters:
gyro
- TheGyro
to be used for field-relative controlflWheel
- The front leftAutoSwerveWheel
frWheel
- The front rightAutoSwerveWheel
rlWheel
- The rear leftAutoSwerveWheel
rrWheel
- The rear rightAutoSwerveWheel
wheelbaseToTrackRatio
- The distance between the centers of the left and right wheels divided by the distance between the centers of the front and back wheels
-
-
Method Detail
-
resetPosition
public void resetPosition(Position newPosition)
Resets the robot's odometry to a givenPosition
.- Parameters:
newPosition
- The newPosition
for the robot's odometry
-
getPosition
public Position getPosition()
Gets the currentPosition
of the robot on the field.- Returns:
- The robot's
Position
-
updateOdometry
protected void updateOdometry()
Description copied from class:SwerveDrive
A method overridden inAutoSwerveDrive
which is called to update the odometry systems whenever new inputs are passed to the wheels.- Overrides:
updateOdometry
in classSwerveDrive
-
-