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;
// 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);
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.intakearm;
-
-import org.usfirst.frc.team3501.robot.Constants.IntakeArm;
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-public class RunIntake extends Command {
- int direction;
-
- public RunIntake(int direction) {
- requires(Robot.intakeArm);
- this.direction = direction;
- }
-
- @Override
- protected void initialize() {
- if (direction == IntakeArm.IN)
- Robot.intakeArm.intakeBall();
- else if (direction == IntakeArm.OUT)
- Robot.intakeArm.outputBall();
- else
- Robot.intakeArm.stopRollers();
- }
-
- @Override
- protected void execute() {
- if (Photogate.ballState())
- Robot.intakeArm.outputBall();
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- }
-
- @Override
- protected void interrupted() {
- }
-
- // while holding right trigger, intake intakes
- // it intakes until it sees the ball with the photogate
- // as soon as it sees the ball, it outtakes for 0.2 seconds.
- // after this happens, the right trigger does nothing for 2 seconds
-
-}
--- /dev/null
+package org.usfirst.frc.team3501.robot.commands.intakearm;
+
+import org.usfirst.frc.team3501.robot.Constants.IntakeArm;
+import org.usfirst.frc.team3501.robot.Robot;
+
+import edu.wpi.first.wpilibj.command.Command;
+
+public class RunIntakeContinuous extends Command {
+ int direction;
+
+ public RunIntakeContinuous(int direction) {
+ requires(Robot.intakeArm);
+ this.direction = direction;
+ }
+
+ @Override
+ protected void initialize() {
+ if (direction == IntakeArm.IN)
+ Robot.intakeArm.intakeBall();
+ else if (direction == IntakeArm.OUT)
+ Robot.intakeArm.outputBall();
+ else
+ Robot.intakeArm.stopRollers();
+ }
+
+ @Override
+ protected void execute() {
+ if (Photogate.ballState())
+ Robot.intakeArm.outputBall();
+ }
+
+ @Override
+ protected boolean isFinished() {
+ return true;
+ }
+
+ @Override
+ protected void end() {
+ }
+
+ @Override
+ protected void interrupted() {
+ }
+
+ // while holding right trigger, intake intakes
+ // it intakes until it sees the ball with the photogate
+ // as soon as it sees the ball, it outtakes for 0.2 seconds.
+ // after this happens, the right trigger does nothing for 2 seconds
+
+}
* 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());
+ //
}
}