Skip to content
This repository was archived by the owner on Sep 14, 2019. It is now read-only.

Commit 84b4434

Browse files
fix StopIntake
The problem was that StopIntake was called and the intake was stopped, but the IntakeCube command was still running so StopIntake only jerked it to a stop and then restarted.
1 parent cf83e64 commit 84b4434

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

Robot2018/src/org/usfirst/frc/team199/Robot2018/Robot.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public class Robot extends IterativeRobot {
5454

5555
public static Map<String, ArrayList<String[]>> autoScripts;
5656

57+
public static boolean stopIntake = false;
58+
5759
Command autonomousCommand;
5860
SendableChooser<Autonomous.Position> posChooser = new SendableChooser<Autonomous.Position>();
5961
Map<String, SendableChooser<Strategy>> stratChoosers = new HashMap<String, SendableChooser<Strategy>>();

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/IntakeCube.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@ protected void execute() {
4848
// Make this return true when this Command no longer needs to run execute()
4949
@Override
5050
protected boolean isFinished() {
51-
return tim.get() > Robot.getConst("Has Cube Timeout", 0.5);
51+
return tim.get() > Robot.getConst("Has Cube Timeout", 0.5) || Robot.stopIntake;
5252
}
5353

5454
// Called once after isFinished returns true
5555
@Override
5656
protected void end() {
5757
Robot.intakeEject.stopIntake();
58+
Robot.stopIntake = false;
5859
}
5960

6061
// Called when another command which requires one or more of the same

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/StopIntake.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ public StopIntake() {
2222
// Called just before this Command runs the first time
2323
@Override
2424
protected void initialize() {
25+
Robot.stopIntake = true;
2526
tim = new Timer();
2627
tim.reset();
2728
tim.start();
2829
}
2930

3031
@Override
3132
protected void execute() {
32-
Robot.intakeEject.stopIntake();
33+
// Robot.intakeEject.stopIntake();
3334
}
3435

3536
@Override

0 commit comments

Comments
 (0)