Package org.hyperonline.hyperlib.driving
Class CartesianDriveParams
- java.lang.Object
-
- org.hyperonline.hyperlib.driving.CartesianDriveParams
-
- All Implemented Interfaces:
DriveParameters
public class CartesianDriveParams extends java.lang.Object implements DriveParameters
-
-
Constructor Summary
Constructors Constructor Description CartesianDriveParams(double ySpeed, double xSpeed, double zRotate, double gyroAngle)
Construct a newCartesianDriveParams
.
-
Method Summary
All Methods Instance Methods Concrete 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.double
gyroAngle()
get the gyro angledouble
xSpeed()
get the speed on the x-axisdouble
ySpeed()
get the speed on the y-axisdouble
zRotate()
get the rotation from the z-axis
-
-
-
Constructor Detail
-
CartesianDriveParams
public CartesianDriveParams(double ySpeed, double xSpeed, double zRotate, double gyroAngle)
Construct a newCartesianDriveParams
.- Parameters:
ySpeed
- the speed to move in the y-axisxSpeed
- the speed to move in the x-axiszRotate
- the rotation to apply in the z-axisgyroAngle
- the gyroAngle to use
-
-
Method Detail
-
ySpeed
public double ySpeed()
get the speed on the y-axis- Returns:
- the y-axis speed
-
xSpeed
public double xSpeed()
get the speed on the x-axis- Returns:
- the x-axis speed
-
zRotate
public double zRotate()
get the rotation from the z-axis- Returns:
- the z-axis rotation
-
gyroAngle
public double gyroAngle()
get the gyro angle- Returns:
- the gyro angle
-
drive
public 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.- Specified by:
drive
in interfaceDriveParameters
- Parameters:
driveTrain
- ADifferentialDrive
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
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:
drive
in interfaceDriveParameters
- Parameters:
driveTrain
- AMecanumDrive
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.
-
-