From 0b12952a242293f905e7117834a0f0ac24b193d7 Mon Sep 17 00:00:00 2001 From: Meryem Esa Date: Tue, 15 Mar 2016 19:45:47 -0700 Subject: [PATCH] refactor RunIntake to be RunIntakeContinous (because its used only with joysticks --- src/org/usfirst/frc/team3501/robot/OI.java | 14 +++++++------- .../{RunIntake.java => RunIntakeContinuous.java} | 4 ++-- .../robot/commands/shooter/ShootAtHighGoal.java | 13 ++++++++++--- 3 files changed, 19 insertions(+), 12 deletions(-) rename src/org/usfirst/frc/team3501/robot/commands/intakearm/{RunIntake.java => RunIntakeContinuous.java} (91%) diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 2412a36d..d63e6f8e 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -5,7 +5,7 @@ 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; import org.usfirst.frc.team3501.robot.commands.intakearm.MoveIntakeArm; -import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntake; +import org.usfirst.frc.team3501.robot.commands.intakearm.RunIntakeContinuous; import org.usfirst.frc.team3501.robot.commands.shooter.FireCatapult; import org.usfirst.frc.team3501.robot.commands.shooter.ResetCatapult; @@ -66,18 +66,18 @@ public class OI { // Right joystick intake = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_INTAKE_PORT); - intake.whenPressed(new RunIntake(IntakeArm.IN)); - intake.whenReleased(new RunIntake(IntakeArm.STOP)); + intake.whenPressed(new RunIntakeContinuous(IntakeArm.IN)); + intake.whenReleased(new RunIntakeContinuous(IntakeArm.STOP)); outtake1 = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_OUTTAKE_1_PORT); - outtake1.whenPressed(new RunIntake(IntakeArm.OUT)); - outtake1.whenReleased(new RunIntake(IntakeArm.STOP)); + outtake1.whenPressed(new RunIntakeContinuous(IntakeArm.OUT)); + outtake1.whenReleased(new RunIntakeContinuous(IntakeArm.STOP)); outtake2 = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_OUTTAKE_2_PORT); - outtake2.whenPressed(new RunIntake(IntakeArm.OUT)); - outtake2.whenReleased(new RunIntake(IntakeArm.STOP)); + outtake2.whenPressed(new RunIntakeContinuous(IntakeArm.OUT)); + outtake2.whenReleased(new RunIntakeContinuous(IntakeArm.STOP)); shooterUp = new JoystickButton(rightJoystick, Constants.OI.RIGHT_JOYSTICK_SHOOTER_UP_PORT); diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntakeContinuous.java similarity index 91% rename from src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java rename to src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntakeContinuous.java index 649ed5cf..989cde69 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntake.java +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/RunIntakeContinuous.java @@ -5,10 +5,10 @@ import org.usfirst.frc.team3501.robot.Robot; import edu.wpi.first.wpilibj.command.Command; -public class RunIntake extends Command { +public class RunIntakeContinuous extends Command { int direction; - public RunIntake(int direction) { + public RunIntakeContinuous(int direction) { requires(Robot.intakeArm); this.direction = direction; } diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ShootAtHighGoal.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ShootAtHighGoal.java index 6d15cde8..7fca1ff7 100755 --- a/src/org/usfirst/frc/team3501/robot/commands/shooter/ShootAtHighGoal.java +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/ShootAtHighGoal.java @@ -14,26 +14,33 @@ import edu.wpi.first.wpilibj.command.WaitCommand; * post-conditions: catapult is retracted, intake is extended */ public class ShootAtHighGoal extends CommandGroup { - private static final double WAIT_SECONDS = 0.4; + private static final double WAIT_SECONDS = 1.0; public ShootAtHighGoal() { - // make sure catapult is down - addSequential(new ResetCatapult()); // make sure intake is in up position addSequential(new MoveIntakeArm(IntakeArm.RETRACT)); + addSequential(new WaitCommand(WAIT_SECONDS)); + + // get ball onto catapult + // shoot catapult pistons addSequential(new FireCatapult()); + addSequential(new WaitCommand(WAIT_SECONDS)); + // extend intake (ball actually shoots here) addSequential(new MoveIntakeArm(IntakeArm.EXTEND)); + addSequential(new WaitCommand(WAIT_SECONDS)); + // wait a bit addSequential(new WaitCommand(WAIT_SECONDS)); // retract catapult pistons addSequential(new ResetCatapult()); + // } } -- 2.30.2