1010import org .usfirst .frc .team199 .Robot2018 .commands .CloseIntake ;
1111import org .usfirst .frc .team199 .Robot2018 .commands .FindTurnTimeConstant ;
1212import org .usfirst .frc .team199 .Robot2018 .commands .IntakeCube ;
13+ import org .usfirst .frc .team199 .Robot2018 .commands .LiftToPosition ;
14+ import org .usfirst .frc .team199 .Robot2018 .commands .MoveLift ;
15+ import org .usfirst .frc .team199 .Robot2018 .commands .MoveLiftWithPID ;
1316import org .usfirst .frc .team199 .Robot2018 .commands .OpenIntake ;
1417import org .usfirst .frc .team199 .Robot2018 .commands .OuttakeCube ;
1518import org .usfirst .frc .team199 .Robot2018 .commands .PIDMove ;
1619import org .usfirst .frc .team199 .Robot2018 .commands .PIDTurn ;
1720import org .usfirst .frc .team199 .Robot2018 .commands .ResetEncoders ;
18- import org .usfirst .frc .team199 .Robot2018 .commands .RunLift ;
1921import org .usfirst .frc .team199 .Robot2018 .commands .SetDistancePerPulse ;
2022import org .usfirst .frc .team199 .Robot2018 .commands .ShiftDriveType ;
2123import org .usfirst .frc .team199 .Robot2018 .commands .ShiftHighGear ;
2224import org .usfirst .frc .team199 .Robot2018 .commands .ShiftLowGear ;
2325import org .usfirst .frc .team199 .Robot2018 .commands .ToggleLeftIntake ;
2426import org .usfirst .frc .team199 .Robot2018 .commands .ToggleRightIntake ;
2527import org .usfirst .frc .team199 .Robot2018 .commands .UpdatePIDConstants ;
28+ import org .usfirst .frc .team199 .Robot2018 .subsystems .LiftInterface .LiftHeight ;
2629
2730import edu .wpi .first .wpilibj .Joystick ;
2831import edu .wpi .first .wpilibj .buttons .JoystickButton ;
@@ -48,6 +51,9 @@ public class OI {
4851 private JoystickButton resetEncButton ;
4952 private JoystickButton moveLiftUpButton ;
5053 private JoystickButton moveLiftDownButton ;
54+ private JoystickButton moveLiftPIDUpButton ;
55+ private JoystickButton moveLiftPIDDownButton ;
56+ private JoystickButton testLiftPID ;
5157 private JoystickButton findTurnTimeConstantButton ;
5258 private JoystickButton updatePIDConstantsButton ;
5359 private JoystickButton updateEncoderDPPButton ;
@@ -76,38 +82,51 @@ public OI(Robot robot) {
7682 leftJoy = new Joystick (0 );
7783 shiftDriveTypeButton = new JoystickButton (leftJoy , getButton ("Shift Drive Type" , 2 ));
7884 shiftDriveTypeButton .whenPressed (new ShiftDriveType ());
85+
7986 pIDMoveButton = new JoystickButton (leftJoy , getButton ("PID Move" , 7 ));
8087 pIDMoveButton
8188 .whenPressed (new PIDMove (Robot .sd .getConst ("Move Targ" , 24 ), Robot .dt , Robot .sd , RobotMap .distEncAvg ));
8289 pIDTurnButton = new JoystickButton (leftJoy , getButton ("PID Turn" , 8 ));
83- // PIDTurnButton.whenPressed(new PIDTurn(Robot.getConst("Turn Targ", 90),
84- // Robot.dt, Robot.sd RobotMap.fancyGyro));
8590 pIDTurnButton
8691 .whenReleased (new PIDTurn (Robot .getConst ("Turn Targ" , 90 ), Robot .dt , Robot .sd , RobotMap .fancyGyro ));
92+
8793 resetEncButton = new JoystickButton (leftJoy , getButton ("Reset Dist Enc" , 10 ));
8894 resetEncButton .whenPressed (new ResetEncoders ());
95+
8996 findTurnTimeConstantButton = new JoystickButton (leftJoy , getButton ("Find Turn Time Constant" , 11 ));
9097 // the command will only run in test mode
9198 findTurnTimeConstantButton
9299 .whenPressed (new FindTurnTimeConstant (robot , Robot .dt , Robot .rmap .fancyGyro , Robot .sd ));
93100
101+ moveLiftPIDUpButton = new JoystickButton (leftJoy , getButton ("Run Lift PID Up" , 3 ));
102+ moveLiftPIDUpButton .whileHeld (new MoveLiftWithPID (Robot .lift , true ));
103+ moveLiftPIDDownButton = new JoystickButton (leftJoy , getButton ("Run Lift PID Down" , 4 ));
104+ moveLiftPIDDownButton .whileHeld (new MoveLiftWithPID (Robot .lift , false ));
105+
106+ testLiftPID = new JoystickButton (leftJoy , getButton ("Test Lift PID" , 5 ));
107+ testLiftPID .whenPressed (
108+ new LiftToPosition (Robot .lift , Robot .getString ("Lift Targ Height" , LiftHeight .SWITCH .toString ())));
109+
94110 rightJoy = new Joystick (1 );
95- shiftHighGearButton = new JoystickButton (rightJoy , getButton ("Shift High Gear" , 3 ));
111+ shiftHighGearButton = new JoystickButton (rightJoy , getButton ("Shift High Gear" , 4 ));
96112 shiftHighGearButton .whenPressed (new ShiftHighGear ());
97- shiftLowGearButton = new JoystickButton (rightJoy , getButton ("Shift Low Gear" , 2 ));
113+ shiftLowGearButton = new JoystickButton (rightJoy , getButton ("Shift Low Gear" , 3 ));
98114 shiftLowGearButton .whenPressed (new ShiftLowGear ());
115+
99116 updatePIDConstantsButton = new JoystickButton (rightJoy , getButton ("Get PID Constants" , 8 ));
100117 updatePIDConstantsButton .whenPressed (new UpdatePIDConstants ());
101118 updateEncoderDPPButton = new JoystickButton (rightJoy , getButton ("Get Encoder Dist Per Pulse" , 9 ));
102119 updateEncoderDPPButton .whenPressed (new SetDistancePerPulse ());
120+
103121 moveLiftUpButton = new JoystickButton (rightJoy , getButton ("Run Lift Motor Up" , 10 ));
122+ moveLiftUpButton .whileHeld (new MoveLift (Robot .lift , true ));
104123 moveLiftDownButton = new JoystickButton (rightJoy , getButton ("Run Lift Motor Down" , 11 ));
105- moveLiftUpButton .whileHeld (new RunLift (Robot .lift , true ));
106- moveLiftDownButton .whileHeld (new RunLift (Robot .lift , false ));
124+ moveLiftDownButton .whileHeld (new MoveLift (Robot .lift , false ));
107125
108126 manipulator = new Joystick (2 );
109127 if (manipulator .getButtonCount () == 0 ) {
110- System .out .println ("Manipulator not plugged in!" );
128+ System .err .println (
129+ "ERROR: manipulator does not appear to be plugged in. Disabling intake code. Restart code with manipulator plugged in to enable intake code" );
111130 } else {
112131 closeIntakeButton = new JoystickButton (manipulator , getButton ("Close Intake Button" , 1 ));
113132 closeIntakeButton .whenPressed (new CloseIntake ());
@@ -128,6 +147,7 @@ public OI(Robot robot) {
128147 toggleRightIntakeButton = new JoystickButton (manipulator , getButton ("Toggle Right Intake Button" , 4 ));
129148 toggleRightIntakeButton .whenPressed (new ToggleRightIntake ());
130149 }
150+
131151 }
132152
133153 // /**
0 commit comments