Class AutoSwerveDrive

  • All Implemented Interfaces:
    edu.wpi.first.util.sendable.Sendable, edu.wpi.first.wpilibj2.command.Subsystem

    public abstract class AutoSwerveDrive
    extends GyroSwerveDrive
    Expands on the GyroSwerveDrive for autonomous control, requiring the use of AutoSwerveWheel rather than SwerveWheel. Uses Odometry to track the position of the robot on the field.
    • Constructor Detail

      • AutoSwerveDrive

        public AutoSwerveDrive​(edu.wpi.first.wpilibj.interfaces.Gyro gyro,
                               AutoSwerveWheel flWheel,
                               AutoSwerveWheel frWheel,
                               AutoSwerveWheel rlWheel,
                               AutoSwerveWheel rrWheel,
                               double wheelbaseToTrackRatio)
        Creates a new AutoSwerveDrive given AutoSwerveWheel wheels.
        Parameters:
        gyro - The Gyro to be used for field-relative control
        flWheel - The front left AutoSwerveWheel
        frWheel - The front right AutoSwerveWheel
        rlWheel - The rear left AutoSwerveWheel
        rrWheel - The rear right AutoSwerveWheel
        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 given Position.
        Parameters:
        newPosition - The new Position for the robot's odometry
      • getPosition

        public Position getPosition()
        Gets the current Position of the robot on the field.
        Returns:
        The robot's Position
      • updateOdometry

        protected void updateOdometry()
        Description copied from class: SwerveDrive
        A method overridden in AutoSwerveDrive which is called to update the odometry systems whenever new inputs are passed to the wheels.
        Overrides:
        updateOdometry in class SwerveDrive