Implemented stopping the arm using limit switches

This commit is contained in:
Austen Adler 2016-09-21 12:13:07 -04:00
parent da3c1b24d6
commit 94ce2eb3bc
No known key found for this signature in database
GPG Key ID: 7ECEE590CCDFE3F1
2 changed files with 8 additions and 0 deletions

View File

@ -20,6 +20,8 @@ public class Robot extends IterativeRobot {
SmartDashboard.putBoolean("CompressorEnabled", true); SmartDashboard.putBoolean("CompressorEnabled", true);
//Automatically determine if rolling in or rolling out //Automatically determine if rolling in or rolling out
SmartDashboard.putBoolean("SmartRollers", true); SmartDashboard.putBoolean("SmartRollers", true);
//Use the limit swithces on the shooter
SmartDashboard.putBoolean("UseLimitSwitches", true);
} }
public void disabledInit() { public void disabledInit() {
} }

View File

@ -1,6 +1,7 @@
package org.usfirst.frc.team2059.robot.commands.shooter; package org.usfirst.frc.team2059.robot.commands.shooter;
import org.usfirst.frc.team2059.robot.commands.CommandBase; import org.usfirst.frc.team2059.robot.commands.CommandBase;
import org.usfirst.frc.team2059.robot.Robot; import org.usfirst.frc.team2059.robot.Robot;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/** /**
* *
*/ */
@ -21,6 +22,11 @@ public class MoveArm extends CommandBase {
} }
// Make this return true when this Command no longer needs to run execute() // Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() { protected boolean isFinished() {
if (SmartDashboard.getBoolean("UseLimitSwitches")) {
if (mainArm.getTopPressed() || mainArm.getBottomPressed()) {
return true;
}
}
return false; return false;
} }
// Called once after isFinished returns true // Called once after isFinished returns true