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

Commit 9b6ad73

Browse files
committed
add if statement to check whether manipulator is plugged in, hopefully reduces amount of warnings
1 parent 1090534 commit 9b6ad73

1 file changed

Lines changed: 25 additions & 18 deletions

File tree

  • Robot2018/src/org/usfirst/frc/team199/Robot2018

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

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -100,23 +100,30 @@ public OI() {
100100
MoveLiftDownButton.whileHeld(new RunLift(Robot.lift, false));
101101

102102
manipulator = new Joystick(2);
103-
closeIntake = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
104-
closeIntake.whenPressed(new CloseIntake());
105-
openIntake = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
106-
openIntake.whenPressed(new OpenIntake());
107-
// raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake
108-
// Button", 3));
109-
// raiseIntake.whenPressed(new RaiseIntake());
110-
// lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake
111-
// Button", 4));
112-
lowerIntake.whenPressed(new LowerIntake());
113-
intake = new JoystickButton(manipulator, getButton("Intake Button", 5));
114-
intake.whenPressed(new IntakeCube());
115-
outake = new JoystickButton(manipulator, getButton("Outake Button", 6));
116-
outake.whenPressed(new OutakeCube());
117-
toggleLeftIntake = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3));
118-
toggleLeftIntake.whenPressed(new ToggleLeftIntake());
119-
toggleRightIntake = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
120-
toggleRightIntake.whenPressed(new ToggleRightIntake());
103+
if (manipulator.getButtonCount() == 0) {
104+
System.err.println(
105+
"ERROR: manipulator does not appear to be plugged in. Disabling intake code. Restart code with manipulator plugged in to enable intake code");
106+
} else {
107+
108+
closeIntake = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
109+
closeIntake.whenPressed(new CloseIntake());
110+
openIntake = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
111+
openIntake.whenPressed(new OpenIntake());
112+
// raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake
113+
// Button", 3));
114+
// raiseIntake.whenPressed(new RaiseIntake());
115+
// lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake
116+
// Button", 4));
117+
lowerIntake.whenPressed(new LowerIntake());
118+
intake = new JoystickButton(manipulator, getButton("Intake Button", 5));
119+
intake.whenPressed(new IntakeCube());
120+
outake = new JoystickButton(manipulator, getButton("Outake Button", 6));
121+
outake.whenPressed(new OutakeCube());
122+
toggleLeftIntake = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3));
123+
toggleLeftIntake.whenPressed(new ToggleLeftIntake());
124+
toggleRightIntake = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
125+
toggleRightIntake.whenPressed(new ToggleRightIntake());
126+
127+
}
121128
}
122129
}

0 commit comments

Comments
 (0)