projects
/
3501
/
stronghold-2016
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add precondition and Timeout to Expel and Intake commands
[3501/stronghold-2016]
/
src
/
org
/
usfirst
/
frc
/
team3501
/
robot
/
commands
/
ExpelBall.java
diff --git
a/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java
b/src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java
index 804ce7ae0a7ecf84ba59bf3bb1c13989ab3cec5d..ba95e6e27621358de74245dc27238d7f8282bc38 100644
(file)
--- a/
src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java
+++ b/
src/org/usfirst/frc/team3501/robot/commands/ExpelBall.java
@@
-8,7
+8,8
@@
import edu.wpi.first.wpilibj.command.Command;
* This command will expel a boulder from the robot, if it is even present to
* begin with.
*
* This command will expel a boulder from the robot, if it is even present to
* begin with.
*
- * pre-condition: A boulder is present inside the robot.
+ * 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.
*
* post-condition: A boulder is expelled from inside the robot to the field
* outside of the robot.
@@
-18,6
+19,7
@@
import edu.wpi.first.wpilibj.command.Command;
*/
public class ExpelBall extends Command {
*/
public class ExpelBall extends Command {
+ private final int TIMEOUT_AMOUNT = 5;
public ExpelBall() {
requires(Robot.intakeArm);
public ExpelBall() {
requires(Robot.intakeArm);
@@
-25,6
+27,7
@@
public class ExpelBall extends Command {
@Override
protected void initialize() {
@Override
protected void initialize() {
+ this.setTimeout(TIMEOUT_AMOUNT);
if (Robot.photogate.isBallPresent())
Robot.intakeArm.outputBall();
}
if (Robot.photogate.isBallPresent())
Robot.intakeArm.outputBall();
}
@@
-35,7
+38,7
@@
public class ExpelBall extends Command {
@Override
protected boolean isFinished() {
@Override
protected boolean isFinished() {
- return
!Robot.photogate.isBallPresent(
);
+ return
(this.isTimedOut() || !Robot.photogate.isBallPresent()
);
}
@Override
}
@Override