From: EvanYap Date: Tue, 17 Nov 2015 04:14:53 +0000 (-0800) Subject: add comments for noobs who need help X-Git-Url: http://challenge-bot.com/repos/?a=commitdiff_plain;h=refs%2Fheads%2Fevan%2Flimitswitch;p=3501%2F2015-FRC-Spark add comments for noobs who need help --- diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java new file mode 100644 index 0000000..6080ade --- /dev/null +++ b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmTillSwitchHit.java @@ -0,0 +1,33 @@ +package org.usfirst.frc3501.RiceCatRobot.commands; + +import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm; + +import edu.wpi.first.wpilibj.command.Command; + +public class MoveArmTillSwitchHit extends Command { + Arm arm; //declares the arm object to reference some methods + double slowSpeed = 0.2; //Slow speed to reach a limit switch + + public MoveArmTillSwitchHit(double leveldesired) { + arm.setArmSpeeds(slowSpeed); //Moves the arm to a certain slow speed + } + + protected void initialize() { + arm.initializeCounter(); + } + + protected void execute() { + } + + protected boolean isFinished() { + return arm.isSwitchHit(); + } + + protected void end() { + arm.stop(); //stops arm once limit switch hit + } + + protected void interrupted() { + end(); + } +} diff --git a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java b/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java deleted file mode 100644 index a3b77ac..0000000 --- a/src/org/usfirst/frc3501/RiceCatRobot/commands/MoveArmToLevel.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.usfirst.frc3501.RiceCatRobot.commands; - -import org.usfirst.frc3501.RiceCatRobot.subsystems.Arm; - -import edu.wpi.first.wpilibj.command.Command; - -public class MoveArmToLevel extends Command { - Arm arm; - double slowSpeed = 0.2; //Slow speed to reach a limit switch - - public MoveArmToLevel(double leveldesired) { - arm.setArmSpeeds(slowSpeed); //Moves the arm to a certain slow speed - } - - protected void initialize() { - arm.initializeCounter(); - } - - protected void execute() { - } - - protected boolean isFinished() { - return arm.isSwitchHit(); - } - - protected void end() { - arm.stop(); //stops arm once limit switch hit - } - - protected void interrupted() { - end(); - } -} diff --git a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java index 50322e5..947d165 100644 --- a/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java +++ b/src/org/usfirst/frc3501/RiceCatRobot/subsystems/Arm.java @@ -22,11 +22,11 @@ public class Arm extends Subsystem { } public boolean isSwitchHit() { - return counter.get() > 0; - } + return counter.get() > 0; //detects if switch is hit + } public void initializeCounter() { - counter.reset(); + counter.reset(); //resets the counter back to 0 } public void fineTuneControl(double d) {