Interface DriveParameters

  • All Known Implementing Classes:
    ArcadeDriveParams, CartesianDriveParams, PolarDriveParams, TankDriveParams

    public interface DriveParameters
    The DriveParameters interface allows one to use polymorphism to represent the various drive modes of the robot, such as tank drive, arcade drive, meccanum drive (Cartesian or polar), swerve drive, etc. A single instance of DriveParameters should contain a specific set of values for one of those modes. Using this interface, one can drive the robot by continuously supplying the drive train with DriveParameters objects. One can also create new drive modes and switch between modes without having to modify the drivetrain subsystem, or write separate commands for each mode. See the hypercode2016 userDrive class for a good example of this.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void drive​(edu.wpi.first.wpilibj.drive.DifferentialDrive driveTrain, double currentGyro)
      Drive the robot.
      void drive​(edu.wpi.first.wpilibj.drive.MecanumDrive driveTrain, double currentGyro)
      Drive the robot.
    • Method Detail

      • drive

        void drive​(edu.wpi.first.wpilibj.drive.DifferentialDrive driveTrain,
                   double currentGyro)
            throws WrongDriveTypeException
        Drive the robot. This method should not call any "stateful" methods of the drivetrain (anything that starts with "set") to allow one to switch between modes easily. TODO: pass a wrapper of DifferentialDrive, which only allows certain methods TODO: remove currentGyro. This is pretty irrelevant, and can be obtained in other ways.
        Parameters:
        driveTrain - A DifferentialDrive object representing the drivetrain of the robot.
        currentGyro - The current gyro heading, if a gyro exists. Nothing should use this right now, so just pass in 0.0 if you're not sure.
        Throws:
        WrongDriveTypeException - if an incompatible Drive type is used
      • drive

        void drive​(edu.wpi.first.wpilibj.drive.MecanumDrive driveTrain,
                   double currentGyro)
            throws WrongDriveTypeException
        Drive the robot. This method should not call any "stateful" methods of the drivetrain (anything that starts with "set") to allow one to switch between modes easily.
        Parameters:
        driveTrain - A MecanumDrive object representing the drivetrain of the robot.
        currentGyro - The current gyro heading, if a gyro exists. Nothing should use this right now, so just pass in 0.0 if you're not sure.
        Throws:
        WrongDriveTypeException - if an incompatible Drive type is used