Package org.hyperonline.hyperlib.driving
Class TankDriveParams
- java.lang.Object
- 
- org.hyperonline.hyperlib.driving.TankDriveParams
 
- 
- All Implemented Interfaces:
- DriveParameters
 
 public class TankDriveParams extends java.lang.Object implements DriveParameters A class which represents tank drive. This mode takes two inputs: left and right, and drives each side of the robot independently. This class simply wrapsDifferentialDrive.tankDrive(double, double, boolean). This class is immutable. That means you must construct a new instance each time you want to change the power to the drivetrain.
- 
- 
Constructor SummaryConstructors Constructor Description TankDriveParams(double left, double right, boolean squareInputs)Construct a newTankDriveParamsobject.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddrive(edu.wpi.first.wpilibj.drive.DifferentialDrive driveTrain, double currentGyro)Drive the robot.voiddrive(edu.wpi.first.wpilibj.drive.MecanumDrive driveTrain, double currentGyro)Drive the robot.doubleleft()Get the left parameterdoubleright()Get the right parameterbooleansquareInputs()Get the squareInputs parameter
 
- 
- 
- 
Constructor Detail- 
TankDriveParamspublic TankDriveParams(double left, double right, boolean squareInputs)Construct a newTankDriveParamsobject.- Parameters:
- left- The power to the left side of the drivetrain
- right- The power to the right side of the drivetrain
- squareInputs- Whether to square the inputs. This is desirable if the input is coming from a joystick, as it creates a "soft deadzone". If coming from another source, like a PID controller, this should be- false.
 
 
- 
 - 
Method Detail- 
drivepublic void drive(edu.wpi.first.wpilibj.drive.DifferentialDrive driveTrain, double currentGyro)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.- Specified by:
- drivein interface- DriveParameters
- Parameters:
- driveTrain- A- DifferentialDriveobject 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.
 
 - 
drivepublic void drive(edu.wpi.first.wpilibj.drive.MecanumDrive driveTrain, double currentGyro) throws WrongDriveTypeExceptionDrive 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.- Specified by:
- drivein interface- DriveParameters
- Parameters:
- driveTrain- A- MecanumDriveobject 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
 
 - 
leftpublic double left() Get the left parameter- Returns:
- the left parameter
 
 - 
rightpublic double right() Get the right parameter- Returns:
- the right parameter
 
 - 
squareInputspublic boolean squareInputs() Get the squareInputs parameter- Returns:
- the squareInputs parameter
 
 
- 
 
-