}
public void act() {
GRTDriverStation ds = (GRTDriverStation) getMechanism("DriverStation");
GRTBreakawayRobotBase rb =
(GRTBreakawayRobotBase) getMechanism("RobotBase");
if (ds.getRightButton(9) && driveMode == GRTBreakawayRobotBase.TANK_DRIVE) {
driveMode = GRTBreakawayRobotBase.CAR_DRIVE;
} else if (ds.getRightButton(9) && driveMode == GRTBreakawayRobotBase.CAR_DRIVE){
driveMode = GRTBreakawayRobotBase.TANK_DRIVE;
}
switch (driveMode) {
case GRTBreakawayRobotBase.TANK_DRIVE:
rb.tankDrive(ds.getYLeftJoystick(), -ds.getYRightJoystick());
break;
case GRTBreakawayRobotBase.CAR_DRIVE:
rb.carDrive(ds.getXRightJoystick(),ds.getYRightJoystick(),
Math.abs(ds.getYRightJoystick()) < SPIN_THRESHOLD);
break;
case GRTBreakawayRobotBase.ONE_STICK_DRIVE:
rb.oneStickDrive(
Util.distance(Util.roundValue(
ds.getYLeftJoystick()),
Util.roundValue(ds.getYRightJoystick())),
((GRTJoystick) ds.getSensor("leftJoystick")).getState("JoystickAngle"));
driveMode = GRTBreakawayRobotBase.TANK_DRIVE;