--- /dev/null
+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();
+ }
+}
+++ /dev/null
-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();
- }
-}
}
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) {