Stop pid subsystems in the command instead of subsystem

This commit is contained in:
Austen Adler 2016-09-21 12:50:18 -04:00
parent 247e00ab75
commit 73c96c9b9d
No known key found for this signature in database
GPG Key ID: 7ECEE590CCDFE3F1
4 changed files with 7 additions and 9 deletions

View File

@ -21,7 +21,8 @@ public class ResetLower extends CommandBase {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return mainArm.getBottomPressed();
// Stop when either limit switch is hit
return mainArm.getBottomPressed() || mainArm.getTopPressed();
}
// Called once after isFinished returns true
protected void end() {

View File

@ -21,7 +21,8 @@ public class ResetUpper extends CommandBase {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return mainArm.getTopPressed();
// Stop when either limit switch is hit
return mainArm.getBottomPressed() || mainArm.getTopPressed();
}
// Called once after isFinished returns true
protected void end() {

View File

@ -27,7 +27,8 @@ public class SetArmPosition extends CommandBase {
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return false;
// Stop when either limit switch is hit
return mainArm.getBottomPressed() || mainArm.getTopPressed();
}
// Called once after isFinished returns true
protected void end() {

View File

@ -31,12 +31,7 @@ public class MainArm extends PIDSubsystem {
return getDegrees();
}
protected void usePIDOutput(double output) {
// Only run if neither limit switch is hit
if (!calibrate()) {
moveArm(output);
} else {
moveArm(0);
}
moveArm(output);
}
public double getRaw() {
return pot.getAverageVoltage();