1
|
|
|
package org.usfirst.frc.team3695.robot;
|
2
|
|
|
|
3
|
|
|
import edu.wpi.first.wpilibj.DriverStation;
|
4
|
|
|
import edu.wpi.first.wpilibj.Joystick;
|
5
|
|
|
import edu.wpi.first.wpilibj.buttons.Button;
|
6
|
|
|
import edu.wpi.first.wpilibj.buttons.JoystickButton;
|
7
|
|
|
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
|
8
|
|
|
import org.usfirst.frc.team3695.robot.commands.*;
|
9
|
|
|
import org.usfirst.frc.team3695.robot.enumeration.Position;
|
10
|
|
|
import org.usfirst.frc.team3695.robot.util.Util;
|
11
|
|
|
import org.usfirst.frc.team3695.robot.util.Xbox;
|
12
|
|
|
|
13
|
|
|
/** the output/input setup */
|
14
|
|
|
public class OI {
|
15
|
|
|
|
16
|
|
|
public static final Joystick DRIVER = new Joystick(0);
|
17
|
|
|
public static final Joystick OPERATOR = new Joystick(1);
|
18
|
|
|
|
19
|
|
|
/** assigns what every SmartDash and controller button does */
|
20
|
|
|
public OI() {
|
|
|
|
|
21
|
|
|
/// manipulator clamp
|
22
|
|
|
Button toggleClamp = new JoystickButton(OPERATOR, Xbox.A);
|
23
|
|
|
toggleClamp.toggleWhenActive(new ButtonCommandClamp());
|
24
|
|
|
/// candy cane
|
25
|
|
|
Button toggleHook = new JoystickButton(OPERATOR, Xbox.B);
|
26
|
|
|
toggleHook.toggleWhenActive(new ButtonCommandHook());
|
27
|
|
|
/// drop the mast
|
28
|
|
|
Button dropIt = new JoystickButton(OPERATOR, Xbox.X);
|
29
|
|
|
dropIt.whenPressed(new ButtonCommandHitTheDeck());
|
30
|
|
|
/// Reversing mode
|
31
|
|
|
Button toggleReverse = new JoystickButton(DRIVER, Xbox.Y);
|
32
|
|
|
toggleReverse.toggleWhenPressed(new ButtonCommandReverse());
|
33
|
|
|
/// Docking mode
|
34
|
|
|
Button toggleDock = new JoystickButton(DRIVER, Xbox.X);
|
35
|
|
|
toggleDock.toggleWhenPressed(new ButtonCommandDock());
|
36
|
|
|
/// To Compress, or Not To Compress. It is now an option.
|
37
|
|
|
SmartDashboard.putData("Disable Compressor", new ButtonCommandKillCompressor());
|
38
|
|
|
|
39
|
|
|
/// PID
|
40
|
|
|
SmartDashboard.putData("Kill PID", new ButtonCommandKillPID());
|
41
|
|
|
SmartDashboard.putNumber("Right Encoder Position", 0);
|
42
|
|
|
SmartDashboard.putNumber("Left Encoder Position", 0);
|
43
|
|
|
|
44
|
|
|
/// limit switch displays
|
45
|
|
|
SmartDashboard.putBoolean("Lower Screw", true);
|
46
|
|
|
SmartDashboard.putBoolean("Mid Position", false);
|
47
|
|
|
SmartDashboard.putBoolean("Upper Screw", false);
|
48
|
|
|
SmartDashboard.putBoolean("Lower Pinion", true);
|
49
|
|
|
SmartDashboard.putBoolean("Upper Pinion", false);
|
50
|
|
|
|
51
|
|
|
SmartDashboard.putNumber("Left inches", 0);
|
52
|
|
|
SmartDashboard.putNumber("Right inches", 0);
|
53
|
|
|
|
54
|
|
|
DriverStation.reportWarning("OI IS INSTANTIATED", false);
|
55
|
|
|
|
56
|
|
|
/// Cyborg command testers
|
57
|
|
|
SmartDashboard.putData("Drive Direct", new CyborgCommandDriveDirect(Util.getAndSetDouble("Drive Direct Power", 0)));
|
58
|
|
|
SmartDashboard.putData("Drive Distance", new CyborgCommandDriveDistance(Util.getAndSetDouble("Drive Distance Inches", 0)));
|
59
|
|
|
SmartDashboard.putData("Drive Until Error", new CyborgCommandDriveUntilError());
|
60
|
|
|
SmartDashboard.putData("Rotate Degree", new CyborgCommandRotateDegrees(Util.getAndSetDouble("Rotate Degrees", 0)));
|
61
|
|
|
}
|
62
|
|
|
|
63
|
|
|
} |