Skip to content

Commit

Permalink
Prevent joysticks from overriding in Autonomous mode
Browse files Browse the repository at this point in the history
  • Loading branch information
briansemrau committed Mar 3, 2018
1 parent 2468451 commit 10772a7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/org/usfirst/frc/team4737/robot/OI.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ public OI() {
// User override to take control of the intake
new Trigger() {
public boolean get() {
return operator.getAxis("LT").get() != 0 || operator.getAxis("RT").get() != 0
|| operator.getAxis("RS_X").get() != 0;
return !Robot.getInstance().isAutonomous() && (operator.getAxis("LT").get() != 0
|| operator.getAxis("RT").get() != 0 || operator.getAxis("RS_X").get() != 0);
}
}.whileActive(new ControlIntake());

// User override to take control of driving
new Trigger() {
public boolean get() {
return driver.getThumbstick("LS").X.get() != 0 || driver.getAxis("LT").get() != 0
|| driver.getAxis("RT").get() != 0;
return !Robot.getInstance().isAutonomous() && (driver.getThumbstick("LS").X.get() != 0
|| driver.getAxis("LT").get() != 0 || driver.getAxis("RT").get() != 0);
}
}.whileActive(new TeleopRacingDrive());

// User override to take control of the elevator
new Trigger() {
public boolean get() {
return operator.getAxis("LS_Y").get() != 0;
return !Robot.getInstance().isAutonomous() && (operator.getAxis("LS_Y").get() != 0);
}
}.whileActive(new ControlElevator());

Expand Down
8 changes: 8 additions & 0 deletions src/org/usfirst/frc/team4737/robot/Robot.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
* project.
*/
public class Robot extends TimedRobot {

private static Robot instance;

public static Robot getInstance() {
return instance;
}

public static final Drivetrain DRIVETRAIN = new Drivetrain();
public static final Elevator ELEVATOR = new Elevator();
Expand All @@ -44,6 +50,8 @@ public class Robot extends TimedRobot {
*/
@Override
public void robotInit() {
instance = this;

chooser.addDefault("No Auto", null);
chooser.addObject("Blind Baseline", new AutoBlindBaseline());
// Add new autonomous routines here
Expand Down

0 comments on commit 10772a7

Please sign in to comment.