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 theGyroSwerveDrivefor autonomous control, requiring the use ofAutoSwerveWheelrather thanSwerveWheel. UsesOdometryto 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 newAutoSwerveDrivegivenAutoSwerveWheelwheels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PositiongetPosition()Gets the currentPositionof the robot on the field.voidresetPosition(Position newPosition)Resets the robot's odometry to a givenPosition.protected voidupdateOdometry()A method overridden inAutoSwerveDrivewhich 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 newAutoSwerveDrivegivenAutoSwerveWheelwheels.- Parameters:
gyro- TheGyroto be used for field-relative controlflWheel- The front leftAutoSwerveWheelfrWheel- The front rightAutoSwerveWheelrlWheel- The rear leftAutoSwerveWheelrrWheel- The rear rightAutoSwerveWheelwheelbaseToTrackRatio- 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 newPositionfor the robot's odometry
-
getPosition
public Position getPosition()
Gets the currentPositionof the robot on the field.- Returns:
- The robot's
Position
-
updateOdometry
protected void updateOdometry()
Description copied from class:SwerveDriveA method overridden inAutoSwerveDrivewhich is called to update the odometry systems whenever new inputs are passed to the wheels.- Overrides:
updateOdometryin classSwerveDrive
-
-