From 7988f380b7cf243129ad2678b2d3f5c300ad29c4 Mon Sep 17 00:00:00 2001 From: Harel Dor Date: Fri, 11 Mar 2016 15:57:40 -0800 Subject: [PATCH] Moderately streamline imports of constants --- .../usfirst/frc/team3501/robot/Constants.java | 4 ++-- src/org/usfirst/frc/team3501/robot/OI.java | 21 ++++++++++--------- .../commands/intakearm/MoveIntakeArm.java | 4 ++-- .../robot/commands/intakearm/RunIntake.java | 6 +++--- .../robot/commands/shooter/Shoot.java | 6 ++---- .../team3501/robot/subsystems/IntakeArm.java | 6 ++++-- .../team3501/robot/subsystems/Shooter.java | 8 +++---- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/Constants.java b/src/org/usfirst/frc/team3501/robot/Constants.java index 38899ea4..2c7971dc 100644 --- a/src/org/usfirst/frc/team3501/robot/Constants.java +++ b/src/org/usfirst/frc/team3501/robot/Constants.java @@ -82,8 +82,8 @@ public class Constants { public static final int CATAPULT2_FORWARD = 0; public static final int CATAPULT2_REVERSE = 1; - public static final Value shoot = Value.kForward; - public static final Value reset = Value.kReverse; + public static final Value SHOOT = Value.kForward; + public static final Value RESET = Value.kReverse; public static final double WAIT_TIME = 2.0; // In seconds } diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 0acc3c80..474ea983 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -1,5 +1,6 @@ package org.usfirst.frc.team3501.robot; +import org.usfirst.frc.team3501.robot.Constants.IntakeArm; import org.usfirst.frc.team3501.robot.commands.driving.SetHighGear; import org.usfirst.frc.team3501.robot.commands.driving.SetLowGear; import org.usfirst.frc.team3501.robot.commands.driving.ToggleFront; @@ -44,19 +45,19 @@ public class OI { extendIntake1 = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_1_PORT); - extendIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND)); + extendIntake1.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND)); extendIntake2 = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_EXTEND_INTAKE_2_PORT); - extendIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.EXTEND)); + extendIntake2.whenPressed(new MoveIntakeArm(IntakeArm.EXTEND)); retractIntake1 = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_1_PORT); - retractIntake1.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT)); + retractIntake1.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT)); retractIntake2 = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_RETRACT_INTAKE_2_PORT); - retractIntake2.whenPressed(new MoveIntakeArm(Constants.IntakeArm.RETRACT)); + retractIntake2.whenPressed(new MoveIntakeArm(IntakeArm.RETRACT)); toggleFront = new JoystickButton(leftJoystick, Constants.OI.LEFT_JOYSTICK_TOGGLE_FRONT_PORT); @@ -65,18 +66,18 @@ public class OI { // Right joystick intake = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT); - intake.whenPressed(new RunIntake(Constants.IntakeArm.IN)); - intake.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); + intake.whenPressed(new RunIntake(IntakeArm.IN)); + intake.whenReleased(new RunIntake(IntakeArm.STOP)); outtake1 = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT); - outtake1.whenPressed(new RunIntake(Constants.IntakeArm.OUT)); - outtake1.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); + outtake1.whenPressed(new RunIntake(IntakeArm.OUT)); + outtake1.whenReleased(new RunIntake(IntakeArm.STOP)); outtake2 = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT); - outtake2.whenPressed(new RunIntake(Constants.IntakeArm.OUT)); - outtake2.whenReleased(new RunIntake(Constants.IntakeArm.STOP)); + outtake2.whenPressed(new RunIntake(IntakeArm.OUT)); + outtake2.whenReleased(new RunIntake(IntakeArm.STOP)); shooterUp = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT); diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArm.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArm.java index 1991726a..b90b83e0 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArm.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArm.java @@ -1,6 +1,6 @@ package org.usfirst.frc.team3501.robot.commands.intakearm; -import org.usfirst.frc.team3501.robot.Constants; +import org.usfirst.frc.team3501.robot.Constants.IntakeArm; import org.usfirst.frc.team3501.robot.Robot; import edu.wpi.first.wpilibj.DoubleSolenoid.Value; @@ -20,7 +20,7 @@ public class MoveIntakeArm extends Command { @Override protected void initialize() { - if (direction == Constants.IntakeArm.EXTEND) + if (direction == IntakeArm.EXTEND) Robot.intakeArm.extendPistons(); else Robot.intakeArm.retractPistons(); diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java index c69b3506..7d2e490a 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java @@ -1,6 +1,6 @@ package org.usfirst.frc.team3501.robot.commands.intakearm; -import org.usfirst.frc.team3501.robot.Constants; +import org.usfirst.frc.team3501.robot.Constants.IntakeArm; import org.usfirst.frc.team3501.robot.Robot; import edu.wpi.first.wpilibj.command.Command; @@ -15,9 +15,9 @@ public class RunIntake extends Command { @Override protected void initialize() { - if (direction == Constants.IntakeArm.IN) + if (direction == IntakeArm.IN) Robot.intakeArm.intakeBall(); - else if (direction == Constants.IntakeArm.OUT) + else if (direction == IntakeArm.OUT) Robot.intakeArm.outputBall(); else Robot.intakeArm.stopRollers(); diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java index f0416b4e..498309c0 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java @@ -1,14 +1,12 @@ package org.usfirst.frc.team3501.robot.commands.shooter; -import org.usfirst.frc.team3501.robot.Constants; +import org.usfirst.frc.team3501.robot.Constants.Shooter; import edu.wpi.first.wpilibj.command.CommandGroup; import edu.wpi.first.wpilibj.command.WaitCommand; public class Shoot extends CommandGroup { - public boolean usePhotogate; - /** * Fires catapult, then resets after a pause. If robot is set to use photogate * and no ball is detected, nothing happens. @@ -18,7 +16,7 @@ public class Shoot extends CommandGroup { */ public Shoot() { addSequential(new FireCatapult()); - addSequential(new WaitCommand(Constants.Shooter.WAIT_TIME)); + addSequential(new WaitCommand(Shooter.WAIT_TIME)); addSequential(new ResetCatapult()); } } diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java b/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java index fab91f6e..c9c29dd2 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/IntakeArm.java @@ -28,10 +28,12 @@ public class IntakeArm extends Subsystem { intakeRoller = new CANTalon(Constants.IntakeArm.INTAKE_ROLLER_PORT); leftIntake = new DoubleSolenoid(Constants.IntakeArm.LEFT_INTAKE_MODULE, - Constants.IntakeArm.LEFT_INTAKE_FORWARD, Constants.IntakeArm.LEFT_INTAKE_REVERSE); + Constants.IntakeArm.LEFT_INTAKE_FORWARD, + Constants.IntakeArm.LEFT_INTAKE_REVERSE); rightIntake = new DoubleSolenoid(Constants.IntakeArm.RIGHT_INTAKE_MODULE, - Constants.IntakeArm.RIGHT_INTAKE_FORWARD, Constants.IntakeArm.RIGHT_INTAKE_REVERSE); + Constants.IntakeArm.RIGHT_INTAKE_FORWARD, + Constants.IntakeArm.RIGHT_INTAKE_REVERSE); } public void retractPistons() { diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index c613d7bb..95d69af9 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -29,13 +29,13 @@ public class Shooter extends Subsystem { // Catapult Commands public void fireCatapult() { - catapult1.set(Constants.Shooter.shoot); - catapult2.set(Constants.Shooter.shoot); + catapult1.set(Constants.Shooter.SHOOT); + catapult2.set(Constants.Shooter.SHOOT); } public void resetCatapult() { - catapult1.set(Constants.Shooter.reset); - catapult2.set(Constants.Shooter.reset); + catapult1.set(Constants.Shooter.RESET); + catapult2.set(Constants.Shooter.RESET); } @Override -- 2.30.2