Package org.hyperonline.hyperlib.driving
Class PolarDriveParams
- java.lang.Object
-
- org.hyperonline.hyperlib.driving.PolarDriveParams
-
- All Implemented Interfaces:
DriveParameters
public class PolarDriveParams extends java.lang.Object implements DriveParameters
-
-
Constructor Summary
Constructors Constructor Description PolarDriveParams(double magnitude, double angle, double rotate)Construct a newPolarDriveParams.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleangle()get the anglevoiddrive(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.doublemagnitude()get the magnitudedoublerotate()get the rotation
-
-
-
Constructor Detail
-
PolarDriveParams
public PolarDriveParams(double magnitude, double angle, double rotate)Construct a newPolarDriveParams.- Parameters:
magnitude- the amount to moveangle- the angle to move atrotate- the rotation to apply
-
-
Method Detail
-
magnitude
public double magnitude()
get the magnitude- Returns:
- the magnitude
-
angle
public double angle()
get the angle- Returns:
- the angle
-
rotate
public double rotate()
get the rotation- Returns:
- the z-axis rotation
-
drive
public void drive(edu.wpi.first.wpilibj.drive.DifferentialDrive 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. 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 interfaceDriveParameters- Parameters:
driveTrain- ADifferentialDriveobject 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
public void drive(edu.wpi.first.wpilibj.drive.MecanumDrive 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.- Specified by:
drivein interfaceDriveParameters- Parameters:
driveTrain- AMecanumDriveobject 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.
-
-