From: Kevin Zhang Date: Sun, 14 Feb 2016 23:27:35 +0000 (-0800) Subject: Add everything all commands to specific packages X-Git-Url: http://challenge-bot.com/repos/?p=3501%2Fstronghold-2016;a=commitdiff_plain;h=6bb7f8ac8eca89a8e0b308720f7e15178eef43ea Add everything all commands to specific packages --- diff --git a/src/org/usfirst/frc/team3501/robot/OI.java b/src/org/usfirst/frc/team3501/robot/OI.java index 6b2f0510..1c891af0 100644 --- a/src/org/usfirst/frc/team3501/robot/OI.java +++ b/src/org/usfirst/frc/team3501/robot/OI.java @@ -1,7 +1,7 @@ package org.usfirst.frc.team3501.robot; -import org.usfirst.frc.team3501.robot.commands.ChangeShooterSpeed; -import org.usfirst.frc.team3501.robot.commands.SetShooterSpeed; +import org.usfirst.frc.team3501.robot.commands.shooter.ChangeShooterSpeed; +import org.usfirst.frc.team3501.robot.commands.shooter.SetShooterSpeed; import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.buttons.Button; diff --git a/src/org/usfirst/frc/team3501/robot/commands/AimAndAlign.java b/src/org/usfirst/frc/team3501/robot/commands/AimAndAlign.java deleted file mode 100755 index 72819405..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/AimAndAlign.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class AimAndAlign extends Command { - - public AimAndAlign() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/BallRollerExpelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/BallRollerExpelContinuous.java deleted file mode 100644 index 30947453..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/BallRollerExpelContinuous.java +++ /dev/null @@ -1,48 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will continually roll the rollers of the intake arm in the - * outwards direction and stop the rollers once the command is canceled. - * - * pre-condition: This command must be called by a button with the method - * .whileHeld() in OI - * - * @author Lauren and Niyati - * - */ - -public class BallRollerExpelContinuous extends Command { - - public BallRollerExpelContinuous() { - requires(Robot.intakeArm); - } - - @Override - protected void initialize() { - Robot.intakeArm.outputBall(); - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.intakeArm.stopRollers(); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/BallRollerIntakeContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/BallRollerIntakeContinuous.java deleted file mode 100644 index f8c3ffdd..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/BallRollerIntakeContinuous.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will continually roll the rollers of the intake arm in the - * inwards direction and stop the rollers once the command is canceled. - * - * pre-condition: This command must be called by a button with the method - * .whileHeld() in OI - * - * @author Lauren and Niyati - * - */ - -public class BallRollerIntakeContinuous extends Command { - - public BallRollerIntakeContinuous() { - requires(Robot.intakeArm); - } - - @Override - protected void initialize() { - Robot.intakeArm.intakeBall(); - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.intakeArm.stopRollers(); - } - - @Override - protected void interrupted() { - end(); - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/ChangeShooterSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/ChangeShooterSpeed.java deleted file mode 100644 index 637afc17..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/ChangeShooterSpeed.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class ChangeShooterSpeed extends Command { - double change = 0; - - public ChangeShooterSpeed(double change) { - this.change = change; - } - - @Override - protected void initialize() { - Robot.shooter.changeSpeed(change); - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - - } - - @Override - protected void interrupted() { - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/ClampBar.java b/src/org/usfirst/frc/team3501/robot/commands/ClampBar.java deleted file mode 100755 index 90f9c7e6..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/ClampBar.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class ClampBar extends Command { - private double secondsToClamp = 2.0; // seconds for the winch to run in order - // for it to clamp(requires testing) - private double winchSpeed = 0.5; // requires testing - - public ClampBar() { - } - - @Override - protected void initialize() { - setTimeout(secondsToClamp); - Robot.scaler.runWinch(winchSpeed); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return isTimedOut(); - } - - @Override - protected void end() { - Robot.scaler.runWinch(0); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java b/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java deleted file mode 100755 index 99fe317d..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/DefaultAutonStrategy.java +++ /dev/null @@ -1,63 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Constants.Defense; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/** - * The default autonomous strategy involves passing the defense that is in front - * of it, aiming the robot/ shooter towards the goal, and shooting. - */ - -public class DefaultAutonStrategy extends CommandGroup { - - public DefaultAutonStrategy(int position, Defense defense) { - - switch (defense) { - - case PORTCULLIS: - - addSequential(new LiftPortcullis()); - - case SALLY_PORT: - - addSequential(new PassSallyPort()); - - case ROUGH_TERRAIN: - - addSequential(new PassRoughTerrain()); - - case LOW_BAR: - - addSequential(new PassLowBar()); - - case CHEVAL_DE_FRISE: - - addSequential(new PassChevalDeFrise()); - - case DRAWBRIDGE: - - addSequential(new PassDrawBridge()); - - case MOAT: - - addSequential(new PassMoat()); - - case ROCK_WALL: - - addSequential(new PassRockWall()); - - case RAMPART: - - addSequential(new PassRampart()); - - default: - break; - } - - addSequential(new AimAndAlign()); - addSequential(new Shoot()); - - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Detect.java b/src/org/usfirst/frc/team3501/robot/commands/Detect.java deleted file mode 100755 index 95ad0019..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Detect.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Detect extends Command { - - public Detect() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Drive.java b/src/org/usfirst/frc/team3501/robot/commands/Drive.java deleted file mode 100755 index d036f2c8..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Drive.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Drive extends Command { - - public Drive() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/DriveForDistance.java b/src/org/usfirst/frc/team3501/robot/commands/DriveForDistance.java deleted file mode 100755 index 719e1662..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/DriveForDistance.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will move the robot at the specified speed for the specified - * distance. - * - * post-condition: has driven for the distance and speed specified - * - * @author Meryem and Avi - * - */ -public class DriveForDistance extends Command { - - public DriveForDistance(double distance, double speed) { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java b/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java deleted file mode 100644 index ba95e6e2..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will expel a boulder from the robot, if it is even present to - * begin with. - * - * pre-condition: Intake arm is at correct height and a boulder is present - * inside the robot. - * - * post-condition: A boulder is expelled from inside the robot to the field - * outside of the robot. - * - * @author Lauren and Niyati - * - */ - -public class ExpelBall extends Command { - private final int TIMEOUT_AMOUNT = 5; - - public ExpelBall() { - requires(Robot.intakeArm); - } - - @Override - protected void initialize() { - this.setTimeout(TIMEOUT_AMOUNT); - if (Robot.photogate.isBallPresent()) - Robot.intakeArm.outputBall(); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return (this.isTimedOut() || !Robot.photogate.isBallPresent()); - } - - @Override - protected void end() { - Robot.intakeArm.stopRollers(); - } - - @Override - protected void interrupted() { - - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/ExtendLift.java b/src/org/usfirst/frc/team3501/robot/commands/ExtendLift.java deleted file mode 100755 index cebbc89b..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/ExtendLift.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class ExtendLift extends Command { - - public ExtendLift() { - } - - @Override - protected void initialize() { - Robot.scaler.liftScissorLift(); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Intake.java b/src/org/usfirst/frc/team3501/robot/commands/Intake.java deleted file mode 100755 index 3cef684d..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Intake.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Intake extends Command { - - public Intake() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/IntakeBall.java b/src/org/usfirst/frc/team3501/robot/commands/IntakeBall.java deleted file mode 100644 index 87902d39..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/IntakeBall.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will take a boulder into the robot if there is not a boulder - * present inside already. - * - * pre-condition: Intake arm must be at correct height and a boulder is not - * present inside the robot. - * - * post-condition: A boulder is taken in from the field outside of the robot - * into the robot. - * - * @author Lauren and Niyati - * - */ - -public class IntakeBall extends Command { - private final int TIMEOUT_AMOUNT = 5; - - public IntakeBall() { - requires(Robot.intakeArm); - } - - @Override - protected void initialize() { - this.setTimeout(TIMEOUT_AMOUNT); - if (!Robot.photogate.isBallPresent()) - Robot.intakeArm.intakeBall(); - - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - return (this.isTimedOut() || Robot.photogate.isBallPresent()); - } - - @Override - protected void end() { - Robot.intakeArm.stopRollers(); - - } - - @Override - protected void interrupted() { - - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/LiftPortcullis.java b/src/org/usfirst/frc/team3501/robot/commands/LiftPortcullis.java deleted file mode 100755 index 992f9e1a..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/LiftPortcullis.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will move the robot forward while lifting the defense arm up. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the portcullis - * - * This command has to drive forward at the same time because that's how the - * robot opens the portcullis - * - * post-condition: the robot has passed the portcullis and is in the next zone - * - * @author Meryem and Avi - * - */ - -public class LiftPortcullis extends Command { - - public LiftPortcullis() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/LiftRobot.java b/src/org/usfirst/frc/team3501/robot/commands/LiftRobot.java deleted file mode 100755 index 024958f4..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/LiftRobot.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class LiftRobot extends Command { - - public LiftRobot() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseArmContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseArmContinuous.java deleted file mode 100755 index b5fe5649..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseArmContinuous.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command is intended to be run from OI using button.whileHeld(...). - * It lowers the defenseArm continually while the button is being held down. - * - * @author shaina - * - */ -public class LowerDefenseArmContinuous extends Command { - - private double speed; - - public LowerDefenseArmContinuous(double speed) { - requires(Robot.defenseArm); - this.speed = -speed; - } - - @Override - protected void initialize() { - Robot.defenseArm.setArmSpeed(speed); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.defenseArm.setArmSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseWristContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseWristContinuous.java deleted file mode 100755 index d5319633..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/LowerDefenseWristContinuous.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command is intended to be run from OI using button.whileHeld(...). - * It lowers the defenseWrist continually while the button is being held down. - * - * @author shaina - * - */ -public class LowerDefenseWristContinuous extends Command { - - private double speed; - - public LowerDefenseWristContinuous(double speed) { - requires(Robot.defenseArm); - this.speed = -speed; - } - - @Override - protected void initialize() { - Robot.defenseArm.setHandSpeed(speed); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.defenseArm.setHandSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToAngle.java deleted file mode 100644 index 092f2d41..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToAngle.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class MoveIntakeArmToAngle extends Command { - private double currentAngle; - private double targetAngle; - private double targetSpeed; - private double SENSITIVITY_THRESHOLD = 0.1; - private boolean isDecreasing = false; - - public MoveIntakeArmToAngle(double angle, double speed) { - requires(Robot.intakeArm); - targetAngle = angle; - targetSpeed = speed; - - } - - @Override - protected void initialize() { - currentAngle = Robot.intakeArm.getArmAngle(); - double difference = targetAngle - currentAngle; - if (difference > 0) { - Robot.intakeArm.setArmSpeed(targetSpeed); - isDecreasing = true; - } else { - Robot.intakeArm.setArmSpeed(-targetSpeed); - isDecreasing = false; - } - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - currentAngle = Robot.intakeArm.getArmAngle(); - - if (isDecreasing == true) { - return (currentAngle <= targetAngle + SENSITIVITY_THRESHOLD); - } else { - return (currentAngle >= targetAngle + SENSITIVITY_THRESHOLD); - } - } - - @Override - protected void end() { - Robot.intakeArm.stop(); - } - - @Override - protected void interrupted() { - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToBallIntakeHeight.java b/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToBallIntakeHeight.java deleted file mode 100644 index 805bd786..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmToBallIntakeHeight.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -public class MoveIntakeArmToBallIntakeHeight { - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmUp.java b/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmUp.java deleted file mode 100644 index c51eeaee..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/MoveIntakeArmUp.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class MoveIntakeArmUp extends Command { - - public MoveIntakeArmUp() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassChevalDeFrise.java b/src/org/usfirst/frc/team3501/robot/commands/PassChevalDeFrise.java deleted file mode 100755 index 2f80dc23..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassChevalDeFrise.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will move the intake arm downwards using a motor to lower the - * cheval de frise and drive over it. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the cheval de frise - * - * post-condition: the robot has passed the cheval de frise and is in the next - * zone - * - * @author Meryem and Avi - * - */ -public class PassChevalDeFrise extends Command { - - public PassChevalDeFrise() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java b/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java deleted file mode 100755 index ad3d7ee7..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassDrawBridge.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will lower the draw bridge and go through it - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the draw bridge - * - * post-condition: the robot has passed the draw bridge and is in the next zone - * - * @author Meryem and Avi - * - */ -public class PassDrawBridge extends Command { - - public PassDrawBridge() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java b/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java deleted file mode 100755 index f5570041..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassLowBar.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will drive the robot through the low bar. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the low bar - * - * post-condition: the robot has passed the low bar and is in the next zone - * - * @author Meryem and Avi - * - */ -public class PassLowBar extends Command { - - public PassLowBar() { - - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassMoat.java b/src/org/usfirst/frc/team3501/robot/commands/PassMoat.java deleted file mode 100755 index 634240a4..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassMoat.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will drive the robot through the moat. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the moat - * - * post-condition: the robot has passed the moat and is in the next zone - * - * @author Meryem and Avi - * - */ -public class PassMoat extends Command { - - public PassMoat() { - - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassRampart.java b/src/org/usfirst/frc/team3501/robot/commands/PassRampart.java deleted file mode 100755 index d531d88b..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassRampart.java +++ /dev/null @@ -1,42 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will drive the robot through the rampart. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the rampart - * - * post-condition: the robot has passed the rampart and is in the next zone - * - * @author Meryem and Avi - * - */ -public class PassRampart extends Command { - - public PassRampart() { - - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java b/src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java deleted file mode 100755 index 874eb22a..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassRockWall.java +++ /dev/null @@ -1,41 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will drive the robot through the rock wall. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the rock wall - * - * post-condition: the robot has passed the rock wall and is in the next zone - * - * @author Meryem and Avi - * - */ -public class PassRockWall extends Command { - - public PassRockWall() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java b/src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java deleted file mode 100755 index b1f0fb76..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassRoughTerrain.java +++ /dev/null @@ -1,43 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command will drive the robot through the rough terrain. - * - * pre-condition: robot is flush against the ramp of the outerworks in front of - * the rough terrain - * - * post-condition: the robot has passed the rough terrain and is in the next - * zone - * - * @author Meryem and Avi - * - */ -public class PassRoughTerrain extends Command { - - public PassRoughTerrain() { - - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/PassSallyPort.java b/src/org/usfirst/frc/team3501/robot/commands/PassSallyPort.java deleted file mode 100755 index b2734acf..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/PassSallyPort.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class PassSallyPort extends Command { - /*** - * This command will only open the sally port pass through it. It will do this - * by hooking onto the port and driving backwards while rotating then driving - * backwards through the sally port. - * - * pre-condition: robot is in the neutral zone, flush against the ramp of the - * outerworks in front of the portcullis - * - * post-condition: the robot has passed the sally port and is in a courtyard - * - * note: to go from the courtyard to neutral zone, the driver just has to - * drive through the port - * - * @author Meryem and Avi - * - */ - - public PassSallyPort() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Position.java b/src/org/usfirst/frc/team3501/robot/commands/Position.java deleted file mode 100755 index e1a8c869..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Position.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Position extends Command { - - public Position() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseArmContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseArmContinuous.java deleted file mode 100755 index 9749ac3c..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseArmContinuous.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command is intended to be run from OI using button.whileHeld(...). - * It raises the defenseArm continually while the button is being held down. - * - * @author shaina - */ -public class RaiseDefenseArmContinuous extends Command { - - private double speed; - - public RaiseDefenseArmContinuous(double speed) { - requires(Robot.defenseArm); - this.speed = speed; - } - - @Override - protected void initialize() { - Robot.defenseArm.setArmSpeed(speed); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.defenseArm.setArmSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseWristContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseWristContinuous.java deleted file mode 100755 index 6b54111b..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/RaiseDefenseWristContinuous.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command is intended to be run from OI using button.whileHeld(...). - * It raises the defenseWrist continually while the button is being held down. - * - * @author shaina - * - */ -public class RaiseDefenseWristContinuous extends Command { - - private double speed; - - public RaiseDefenseWristContinuous(double speed) { - requires(Robot.defenseArm); - this.speed = speed; - } - - @Override - protected void initialize() { - Robot.defenseArm.setHandSpeed(speed); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - Robot.defenseArm.setHandSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/RetractDefenseArm.java b/src/org/usfirst/frc/team3501/robot/commands/RetractDefenseArm.java deleted file mode 100755 index 95f5f92e..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/RetractDefenseArm.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.CommandGroup; - -/*** - * This command group simultaneously move arm and hand to retracted position. - * - * @author shaina - * - */ -public class RetractDefenseArm extends CommandGroup { - static final double ARM_FULLY_RETRACTED_ANGLE = 0; // change value once tested - static final double HAND_FULLY_RETRACTED_ANGLE = 0; // change value once - // tested - - public RetractDefenseArm(double speed) { - requires(Robot.defenseArm); - - addParallel(new SetArmToAngle(speed, ARM_FULLY_RETRACTED_ANGLE)); - addParallel(new SetHandToAngle(speed, HAND_FULLY_RETRACTED_ANGLE)); - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/RetractLift.java b/src/org/usfirst/frc/team3501/robot/commands/RetractLift.java deleted file mode 100755 index 953d4289..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/RetractLift.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class RetractLift extends Command { - - public RetractLift() { - } - - @Override - protected void initialize() { - Robot.scaler.lowerScissorLift(); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/SetArmToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/SetArmToAngle.java deleted file mode 100755 index d5a0409b..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/SetArmToAngle.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command moves the defense arm to a input angle position. - * Requires input of a targetPosition and a speed. - * - * @author shaina - * - */ -public class SetArmToAngle extends Command { - private static final double THRESHOLD = 0.1; - private double speed; - private double targetPosition; - private double currentPosition; - private boolean isDecreasing = false; - - public SetArmToAngle(double speed, double targetPosition) { - requires(Robot.defenseArm); - - this.speed = speed; - this.targetPosition = targetPosition; - } - - @Override - public void initialize() { - currentPosition = Robot.defenseArm.getArmPotAngle(); - - if (currentPosition > targetPosition) { - Robot.defenseArm.setArmSpeed(-speed); - isDecreasing = true; - } else { - Robot.defenseArm.setArmSpeed(speed); - isDecreasing = false; - } - } - - @Override - public void execute() { - - } - - @Override - public boolean isFinished() { - currentPosition = Robot.defenseArm.getArmPotAngle(); - - if (isDecreasing == true) { - return (currentPosition <= targetPosition + THRESHOLD); - } else { - return (currentPosition >= targetPosition - THRESHOLD); - } - } - - @Override - public void end() { - Robot.defenseArm.setArmSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/SetHandToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/SetHandToAngle.java deleted file mode 100755 index f89ac0da..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/SetHandToAngle.java +++ /dev/null @@ -1,67 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/*** - * This command moves the defense arm to a input angle position. - * Requires input of a targetPosition and a speed. - * - * @author shaina - * - */ -public class SetHandToAngle extends Command { - private static final double THRESHOLD = 0.1; - private double speed; - private double targetPosition; - private double currentPosition; - private boolean isDecreasing = false; - - public SetHandToAngle(double speed, double targetPosition) { - requires(Robot.defenseArm); - - this.speed = speed; - this.targetPosition = targetPosition; - } - - @Override - public void initialize() { - currentPosition = Robot.defenseArm.getHandPotAngle(); - - if (currentPosition > targetPosition) { - Robot.defenseArm.setArmSpeed(-speed); - isDecreasing = true; - } else { - Robot.defenseArm.setArmSpeed(speed); - isDecreasing = false; - } - } - - @Override - public void execute() { - - } - - @Override - public boolean isFinished() { - currentPosition = Robot.defenseArm.getHandPotAngle(); - - if (isDecreasing == true) { - return (currentPosition <= targetPosition + THRESHOLD); - } else { - return (currentPosition >= targetPosition - THRESHOLD); - } - } - - @Override - public void end() { - Robot.defenseArm.setArmSpeed(0); - } - - @Override - protected void interrupted() { - end(); - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/SetShooterSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/SetShooterSpeed.java deleted file mode 100644 index 98c4c97d..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/SetShooterSpeed.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -public class SetShooterSpeed extends Command { - double speed = 0.0; - - public SetShooterSpeed(double speed) { - this.speed = speed; - } - - @Override - protected void initialize() { - Robot.shooter.setSpeed(speed); - } - - @Override - protected void execute() { - - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - - } - - @Override - protected void interrupted() { - - } - -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Shoot.java b/src/org/usfirst/frc/team3501/robot/commands/Shoot.java deleted file mode 100755 index fbfafeb9..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Shoot.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Shoot extends Command { - - public Shoot() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/Stop.java b/src/org/usfirst/frc/team3501/robot/commands/Stop.java deleted file mode 100755 index 69c67d6e..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/Stop.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class Stop extends Command { - - public Stop() { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/TurnForAngle.java b/src/org/usfirst/frc/team3501/robot/commands/TurnForAngle.java deleted file mode 100755 index d1b61a2a..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/TurnForAngle.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class TurnForAngle extends Command { - - public TurnForAngle(double degrees) { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/TurnForTime.java b/src/org/usfirst/frc/team3501/robot/commands/TurnForTime.java deleted file mode 100755 index e1987e7a..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/TurnForTime.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import edu.wpi.first.wpilibj.command.Command; - -public class TurnForTime extends Command { - - public TurnForTime(double seconds) { - } - - @Override - protected void initialize() { - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return false; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/AimAndAlign.java b/src/org/usfirst/frc/team3501/robot/commands/auton/AimAndAlign.java new file mode 100755 index 00000000..d304013f --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/AimAndAlign.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +public class AimAndAlign extends Command { + + public AimAndAlign() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java b/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java new file mode 100755 index 00000000..4146977d --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/DefaultAutonStrategy.java @@ -0,0 +1,64 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import org.usfirst.frc.team3501.robot.Constants.Defense; +import org.usfirst.frc.team3501.robot.commands.shooter.Shoot; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/** + * The default autonomous strategy involves passing the defense that is in front + * of it, aiming the robot/ shooter towards the goal, and shooting. + */ + +public class DefaultAutonStrategy extends CommandGroup { + + public DefaultAutonStrategy(int position, Defense defense) { + + switch (defense) { + + case PORTCULLIS: + + addSequential(new LiftPortcullis()); + + case SALLY_PORT: + + addSequential(new PassSallyPort()); + + case ROUGH_TERRAIN: + + addSequential(new PassRoughTerrain()); + + case LOW_BAR: + + addSequential(new PassLowBar()); + + case CHEVAL_DE_FRISE: + + addSequential(new PassChevalDeFrise()); + + case DRAWBRIDGE: + + addSequential(new PassDrawBridge()); + + case MOAT: + + addSequential(new PassMoat()); + + case ROCK_WALL: + + addSequential(new PassRockWall()); + + case RAMPART: + + addSequential(new PassRampart()); + + default: + break; + } + + addSequential(new AimAndAlign()); + addSequential(new Shoot()); + + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/LiftPortcullis.java b/src/org/usfirst/frc/team3501/robot/commands/auton/LiftPortcullis.java new file mode 100755 index 00000000..fbef75d4 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/LiftPortcullis.java @@ -0,0 +1,45 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will move the robot forward while lifting the defense arm up. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the portcullis + * + * This command has to drive forward at the same time because that's how the + * robot opens the portcullis + * + * post-condition: the robot has passed the portcullis and is in the next zone + * + * @author Meryem and Avi + * + */ + +public class LiftPortcullis extends Command { + + public LiftPortcullis() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/LiftRobot.java b/src/org/usfirst/frc/team3501/robot/commands/auton/LiftRobot.java new file mode 100755 index 00000000..e5953b19 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/LiftRobot.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +public class LiftRobot extends Command { + + public LiftRobot() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassChevalDeFrise.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassChevalDeFrise.java new file mode 100755 index 00000000..4dc469fd --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassChevalDeFrise.java @@ -0,0 +1,43 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will move the intake arm downwards using a motor to lower the + * cheval de frise and drive over it. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the cheval de frise + * + * post-condition: the robot has passed the cheval de frise and is in the next + * zone + * + * @author Meryem and Avi + * + */ +public class PassChevalDeFrise extends Command { + + public PassChevalDeFrise() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassDrawBridge.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassDrawBridge.java new file mode 100755 index 00000000..497ef92e --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassDrawBridge.java @@ -0,0 +1,41 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will lower the draw bridge and go through it + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the draw bridge + * + * post-condition: the robot has passed the draw bridge and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassDrawBridge extends Command { + + public PassDrawBridge() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassLowBar.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassLowBar.java new file mode 100755 index 00000000..8d42325e --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassLowBar.java @@ -0,0 +1,42 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the low bar. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the low bar + * + * post-condition: the robot has passed the low bar and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassLowBar extends Command { + + public PassLowBar() { + + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassMoat.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassMoat.java new file mode 100755 index 00000000..7178aa1f --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassMoat.java @@ -0,0 +1,42 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the moat. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the moat + * + * post-condition: the robot has passed the moat and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassMoat extends Command { + + public PassMoat() { + + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassRampart.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRampart.java new file mode 100755 index 00000000..f381af4f --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRampart.java @@ -0,0 +1,42 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rampart. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rampart + * + * post-condition: the robot has passed the rampart and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassRampart extends Command { + + public PassRampart() { + + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassRockWall.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRockWall.java new file mode 100755 index 00000000..7498138e --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRockWall.java @@ -0,0 +1,41 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rock wall. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rock wall + * + * post-condition: the robot has passed the rock wall and is in the next zone + * + * @author Meryem and Avi + * + */ +public class PassRockWall extends Command { + + public PassRockWall() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassRoughTerrain.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRoughTerrain.java new file mode 100755 index 00000000..6706fb38 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassRoughTerrain.java @@ -0,0 +1,43 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will drive the robot through the rough terrain. + * + * pre-condition: robot is flush against the ramp of the outerworks in front of + * the rough terrain + * + * post-condition: the robot has passed the rough terrain and is in the next + * zone + * + * @author Meryem and Avi + * + */ +public class PassRoughTerrain extends Command { + + public PassRoughTerrain() { + + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/auton/PassSallyPort.java b/src/org/usfirst/frc/team3501/robot/commands/auton/PassSallyPort.java new file mode 100755 index 00000000..8d5db25f --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/auton/PassSallyPort.java @@ -0,0 +1,46 @@ +package org.usfirst.frc.team3501.robot.commands.auton; + +import edu.wpi.first.wpilibj.command.Command; + +public class PassSallyPort extends Command { + /*** + * This command will only open the sally port pass through it. It will do this + * by hooking onto the port and driving backwards while rotating then driving + * backwards through the sally port. + * + * pre-condition: robot is in the neutral zone, flush against the ramp of the + * outerworks in front of the portcullis + * + * post-condition: the robot has passed the sally port and is in a courtyard + * + * note: to go from the courtyard to neutral zone, the driver just has to + * drive through the port + * + * @author Meryem and Avi + * + */ + + public PassSallyPort() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseArmContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseArmContinuous.java new file mode 100755 index 00000000..208accbd --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseArmContinuous.java @@ -0,0 +1,46 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command is intended to be run from OI using button.whileHeld(...). + * It lowers the defenseArm continually while the button is being held down. + * + * @author shaina + * + */ +public class LowerDefenseArmContinuous extends Command { + + private double speed; + + public LowerDefenseArmContinuous(double speed) { + requires(Robot.defenseArm); + this.speed = -speed; + } + + @Override + protected void initialize() { + Robot.defenseArm.setArmSpeed(speed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.defenseArm.setArmSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseWristContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseWristContinuous.java new file mode 100755 index 00000000..204bdf27 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/LowerDefenseWristContinuous.java @@ -0,0 +1,46 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command is intended to be run from OI using button.whileHeld(...). + * It lowers the defenseWrist continually while the button is being held down. + * + * @author shaina + * + */ +public class LowerDefenseWristContinuous extends Command { + + private double speed; + + public LowerDefenseWristContinuous(double speed) { + requires(Robot.defenseArm); + this.speed = -speed; + } + + @Override + protected void initialize() { + Robot.defenseArm.setHandSpeed(speed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.defenseArm.setHandSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseArmContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseArmContinuous.java new file mode 100755 index 00000000..53839142 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseArmContinuous.java @@ -0,0 +1,45 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command is intended to be run from OI using button.whileHeld(...). + * It raises the defenseArm continually while the button is being held down. + * + * @author shaina + */ +public class RaiseDefenseArmContinuous extends Command { + + private double speed; + + public RaiseDefenseArmContinuous(double speed) { + requires(Robot.defenseArm); + this.speed = speed; + } + + @Override + protected void initialize() { + Robot.defenseArm.setArmSpeed(speed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.defenseArm.setArmSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseWristContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseWristContinuous.java new file mode 100755 index 00000000..a670fac1 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RaiseDefenseWristContinuous.java @@ -0,0 +1,46 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command is intended to be run from OI using button.whileHeld(...). + * It raises the defenseWrist continually while the button is being held down. + * + * @author shaina + * + */ +public class RaiseDefenseWristContinuous extends Command { + + private double speed; + + public RaiseDefenseWristContinuous(double speed) { + requires(Robot.defenseArm); + this.speed = speed; + } + + @Override + protected void initialize() { + Robot.defenseArm.setHandSpeed(speed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.defenseArm.setHandSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/RetractDefenseArm.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RetractDefenseArm.java new file mode 100755 index 00000000..9a4c7880 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/RetractDefenseArm.java @@ -0,0 +1,24 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.CommandGroup; + +/*** + * This command group simultaneously move arm and hand to retracted position. + * + * @author shaina + * + */ +public class RetractDefenseArm extends CommandGroup { + static final double ARM_FULLY_RETRACTED_ANGLE = 0; // change value once tested + static final double HAND_FULLY_RETRACTED_ANGLE = 0; // change value once + // tested + + public RetractDefenseArm(double speed) { + requires(Robot.defenseArm); + + addParallel(new SetArmToAngle(speed, ARM_FULLY_RETRACTED_ANGLE)); + addParallel(new SetHandToAngle(speed, HAND_FULLY_RETRACTED_ANGLE)); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetArmToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetArmToAngle.java new file mode 100755 index 00000000..709757de --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetArmToAngle.java @@ -0,0 +1,67 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command moves the defense arm to a input angle position. + * Requires input of a targetPosition and a speed. + * + * @author shaina + * + */ +public class SetArmToAngle extends Command { + private static final double THRESHOLD = 0.1; + private double speed; + private double targetPosition; + private double currentPosition; + private boolean isDecreasing = false; + + public SetArmToAngle(double speed, double targetPosition) { + requires(Robot.defenseArm); + + this.speed = speed; + this.targetPosition = targetPosition; + } + + @Override + public void initialize() { + currentPosition = Robot.defenseArm.getArmPotAngle(); + + if (currentPosition > targetPosition) { + Robot.defenseArm.setArmSpeed(-speed); + isDecreasing = true; + } else { + Robot.defenseArm.setArmSpeed(speed); + isDecreasing = false; + } + } + + @Override + public void execute() { + + } + + @Override + public boolean isFinished() { + currentPosition = Robot.defenseArm.getArmPotAngle(); + + if (isDecreasing == true) { + return (currentPosition <= targetPosition + THRESHOLD); + } else { + return (currentPosition >= targetPosition - THRESHOLD); + } + } + + @Override + public void end() { + Robot.defenseArm.setArmSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetHandToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetHandToAngle.java new file mode 100755 index 00000000..60618d56 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/defensearm/SetHandToAngle.java @@ -0,0 +1,67 @@ +package org.usfirst.frc.team3501.robot.commands.defensearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command moves the defense arm to a input angle position. + * Requires input of a targetPosition and a speed. + * + * @author shaina + * + */ +public class SetHandToAngle extends Command { + private static final double THRESHOLD = 0.1; + private double speed; + private double targetPosition; + private double currentPosition; + private boolean isDecreasing = false; + + public SetHandToAngle(double speed, double targetPosition) { + requires(Robot.defenseArm); + + this.speed = speed; + this.targetPosition = targetPosition; + } + + @Override + public void initialize() { + currentPosition = Robot.defenseArm.getHandPotAngle(); + + if (currentPosition > targetPosition) { + Robot.defenseArm.setArmSpeed(-speed); + isDecreasing = true; + } else { + Robot.defenseArm.setArmSpeed(speed); + isDecreasing = false; + } + } + + @Override + public void execute() { + + } + + @Override + public boolean isFinished() { + currentPosition = Robot.defenseArm.getHandPotAngle(); + + if (isDecreasing == true) { + return (currentPosition <= targetPosition + THRESHOLD); + } else { + return (currentPosition >= targetPosition - THRESHOLD); + } + } + + @Override + public void end() { + Robot.defenseArm.setArmSpeed(0); + } + + @Override + protected void interrupted() { + end(); + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/DriveForDistance.java b/src/org/usfirst/frc/team3501/robot/commands/driving/DriveForDistance.java new file mode 100755 index 00000000..6765216d --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/DriveForDistance.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will move the robot at the specified speed for the specified + * distance. + * + * post-condition: has driven for the distance and speed specified + * + * @author Meryem and Avi + * + */ +public class DriveForDistance extends Command { + + public DriveForDistance(double distance, double speed) { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/Stop.java b/src/org/usfirst/frc/team3501/robot/commands/driving/Stop.java new file mode 100755 index 00000000..dc134394 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/Stop.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import edu.wpi.first.wpilibj.command.Command; + +public class Stop extends Command { + + public Stop() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java new file mode 100755 index 00000000..7c3fba79 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForAngle.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import edu.wpi.first.wpilibj.command.Command; + +public class TurnForAngle extends Command { + + public TurnForAngle(double degrees) { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForTime.java b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForTime.java new file mode 100755 index 00000000..d184f58c --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/driving/TurnForTime.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.driving; + +import edu.wpi.first.wpilibj.command.Command; + +public class TurnForTime extends Command { + + public TurnForTime(double seconds) { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerExpelContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerExpelContinuous.java new file mode 100644 index 00000000..638716cf --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerExpelContinuous.java @@ -0,0 +1,48 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will continually roll the rollers of the intake arm in the + * outwards direction and stop the rollers once the command is canceled. + * + * pre-condition: This command must be called by a button with the method + * .whileHeld() in OI + * + * @author Lauren and Niyati + * + */ + +public class BallRollerExpelContinuous extends Command { + + public BallRollerExpelContinuous() { + requires(Robot.intakeArm); + } + + @Override + protected void initialize() { + Robot.intakeArm.outputBall(); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.intakeArm.stopRollers(); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerIntakeContinuous.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerIntakeContinuous.java new file mode 100644 index 00000000..d3a01b4b --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/BallRollerIntakeContinuous.java @@ -0,0 +1,49 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will continually roll the rollers of the intake arm in the + * inwards direction and stop the rollers once the command is canceled. + * + * pre-condition: This command must be called by a button with the method + * .whileHeld() in OI + * + * @author Lauren and Niyati + * + */ + +public class BallRollerIntakeContinuous extends Command { + + public BallRollerIntakeContinuous() { + requires(Robot.intakeArm); + } + + @Override + protected void initialize() { + Robot.intakeArm.intakeBall(); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + Robot.intakeArm.stopRollers(); + } + + @Override + protected void interrupted() { + end(); + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/ExpelBall.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/ExpelBall.java new file mode 100644 index 00000000..83ee34e6 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/ExpelBall.java @@ -0,0 +1,54 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will expel a boulder from the robot, if it is even present to + * begin with. + * + * pre-condition: Intake arm is at correct height and a boulder is present + * inside the robot. + * + * post-condition: A boulder is expelled from inside the robot to the field + * outside of the robot. + * + * @author Lauren and Niyati + * + */ + +public class ExpelBall extends Command { + private final int TIMEOUT_AMOUNT = 5; + + public ExpelBall() { + requires(Robot.intakeArm); + } + + @Override + protected void initialize() { + this.setTimeout(TIMEOUT_AMOUNT); + if (Robot.photogate.isBallPresent()) + Robot.intakeArm.outputBall(); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return (this.isTimedOut() || !Robot.photogate.isBallPresent()); + } + + @Override + protected void end() { + Robot.intakeArm.stopRollers(); + } + + @Override + protected void interrupted() { + + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/IntakeBall.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/IntakeBall.java new file mode 100644 index 00000000..8eda8dba --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/IntakeBall.java @@ -0,0 +1,57 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/*** + * This command will take a boulder into the robot if there is not a boulder + * present inside already. + * + * pre-condition: Intake arm must be at correct height and a boulder is not + * present inside the robot. + * + * post-condition: A boulder is taken in from the field outside of the robot + * into the robot. + * + * @author Lauren and Niyati + * + */ + +public class IntakeBall extends Command { + private final int TIMEOUT_AMOUNT = 5; + + public IntakeBall() { + requires(Robot.intakeArm); + } + + @Override + protected void initialize() { + this.setTimeout(TIMEOUT_AMOUNT); + if (!Robot.photogate.isBallPresent()) + Robot.intakeArm.intakeBall(); + + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return (this.isTimedOut() || Robot.photogate.isBallPresent()); + } + + @Override + protected void end() { + Robot.intakeArm.stopRollers(); + + } + + @Override + protected void interrupted() { + + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToAngle.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToAngle.java new file mode 100644 index 00000000..8541262c --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToAngle.java @@ -0,0 +1,59 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class MoveIntakeArmToAngle extends Command { + private double currentAngle; + private double targetAngle; + private double targetSpeed; + private double SENSITIVITY_THRESHOLD = 0.1; + private boolean isDecreasing = false; + + public MoveIntakeArmToAngle(double angle, double speed) { + requires(Robot.intakeArm); + targetAngle = angle; + targetSpeed = speed; + + } + + @Override + protected void initialize() { + currentAngle = Robot.intakeArm.getArmAngle(); + double difference = targetAngle - currentAngle; + if (difference > 0) { + Robot.intakeArm.setArmSpeed(targetSpeed); + isDecreasing = true; + } else { + Robot.intakeArm.setArmSpeed(-targetSpeed); + isDecreasing = false; + } + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + currentAngle = Robot.intakeArm.getArmAngle(); + + if (isDecreasing == true) { + return (currentAngle <= targetAngle + SENSITIVITY_THRESHOLD); + } else { + return (currentAngle >= targetAngle + SENSITIVITY_THRESHOLD); + } + } + + @Override + protected void end() { + Robot.intakeArm.stop(); + } + + @Override + protected void interrupted() { + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToBallIntakeHeight.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToBallIntakeHeight.java new file mode 100644 index 00000000..e618c8a6 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmToBallIntakeHeight.java @@ -0,0 +1,5 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +public class MoveIntakeArmToBallIntakeHeight { + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmUp.java b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmUp.java new file mode 100644 index 00000000..c22bf82d --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/intakearm/MoveIntakeArmUp.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.intakearm; + +import edu.wpi.first.wpilibj.command.Command; + +public class MoveIntakeArmUp extends Command { + + public MoveIntakeArmUp() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/runShooter.java b/src/org/usfirst/frc/team3501/robot/commands/runShooter.java deleted file mode 100644 index 3d87624f..00000000 --- a/src/org/usfirst/frc/team3501/robot/commands/runShooter.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.usfirst.frc.team3501.robot.commands; - -import org.usfirst.frc.team3501.robot.Robot; - -import edu.wpi.first.wpilibj.command.Command; - -/** - * - */ -public class runShooter extends Command { - - public runShooter() { - - } - - @Override - protected void initialize() { - Robot.shooter.setSpeed(0.5); - } - - @Override - protected void execute() { - } - - @Override - protected boolean isFinished() { - return true; - } - - @Override - protected void end() { - } - - @Override - protected void interrupted() { - } -} diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java new file mode 100755 index 00000000..9e9fbc1b --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/ClampBar.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team3501.robot.commands.scaler; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class ClampBar extends Command { + private double secondsToClamp = 2.0; // seconds for the winch to run in order + // for it to clamp(requires testing) + private double winchSpeed = 0.5; // requires testing + + public ClampBar() { + } + + @Override + protected void initialize() { + setTimeout(secondsToClamp); + Robot.scaler.runWinch(winchSpeed); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return isTimedOut(); + } + + @Override + protected void end() { + Robot.scaler.runWinch(0); + } + + @Override + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java new file mode 100755 index 00000000..f4001d9a --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/ExtendLift.java @@ -0,0 +1,33 @@ +package org.usfirst.frc.team3501.robot.commands.scaler; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class ExtendLift extends Command { + + public ExtendLift() { + } + + @Override + protected void initialize() { + Robot.scaler.liftScissorLift(); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java b/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java new file mode 100755 index 00000000..e160b19c --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/scaler/RetractLift.java @@ -0,0 +1,33 @@ +package org.usfirst.frc.team3501.robot.commands.scaler; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class RetractLift extends Command { + + public RetractLift() { + } + + @Override + protected void initialize() { + Robot.scaler.lowerScissorLift(); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/ChangeShooterSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/ChangeShooterSpeed.java new file mode 100644 index 00000000..186f7972 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/ChangeShooterSpeed.java @@ -0,0 +1,38 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class ChangeShooterSpeed extends Command { + double change = 0; + + public ChangeShooterSpeed(double change) { + this.change = change; + } + + @Override + protected void initialize() { + Robot.shooter.changeSpeed(change); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + + } + + @Override + protected void interrupted() { + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/SetShooterSpeed.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/SetShooterSpeed.java new file mode 100644 index 00000000..6dce5005 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/SetShooterSpeed.java @@ -0,0 +1,39 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +public class SetShooterSpeed extends Command { + double speed = 0.0; + + public SetShooterSpeed(double speed) { + this.speed = speed; + } + + @Override + protected void initialize() { + Robot.shooter.setSpeed(speed); + } + + @Override + protected void execute() { + + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + + } + + @Override + protected void interrupted() { + + } + +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java new file mode 100755 index 00000000..ec5a11d5 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/Shoot.java @@ -0,0 +1,30 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import edu.wpi.first.wpilibj.command.Command; + +public class Shoot extends Command { + + public Shoot() { + } + + @Override + protected void initialize() { + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return false; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +} diff --git a/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java b/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java new file mode 100644 index 00000000..b69ae167 --- /dev/null +++ b/src/org/usfirst/frc/team3501/robot/commands/shooter/runShooter.java @@ -0,0 +1,37 @@ +package org.usfirst.frc.team3501.robot.commands.shooter; + +import org.usfirst.frc.team3501.robot.Robot; + +import edu.wpi.first.wpilibj.command.Command; + +/** + * + */ +public class runShooter extends Command { + + public runShooter() { + + } + + @Override + protected void initialize() { + Robot.shooter.setSpeed(0.5); + } + + @Override + protected void execute() { + } + + @Override + protected boolean isFinished() { + return true; + } + + @Override + protected void end() { + } + + @Override + protected void interrupted() { + } +}