org.usfirst.frc.team3695.robot.OI   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 57
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
B OI() 0 51 1
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.Mast;
10
import org.usfirst.frc.team3695.robot.enumeration.Position;
11
import org.usfirst.frc.team3695.robot.util.Util;
12
import org.usfirst.frc.team3695.robot.util.Xbox;
13
14
/** the Operator Interface setup */
15
public class OI {
16
	
17
	public static final Joystick DRIVER = new Joystick(0);
18
	public static final Joystick OPERATOR = new Joystick(1);
19
	
20
	/** assigns what every SmartDash and controller button does */
21
	public OI() {
0 ignored issues
show
Best Practice introduced by
Hide this public constructor.
Loading history...
22
		/// manipulator wheels
23
			Button spinIn = new JoystickButton(OPERATOR, Xbox.RB);
24
					spinIn.whileHeld(new ButtonCommandEat());
25
			Button spinOut = new JoystickButton(OPERATOR, Xbox.LB);
26
					spinOut.whileHeld(new ButtonCommandSpit());
27
		/// manipulator clamp
28
			Button toggleClamp = new JoystickButton(OPERATOR, Xbox.A);
29
				toggleClamp.toggleWhenActive(new ToggleCommandClamp());
30
		/// candy cane
31
			Button toggleHook = new JoystickButton(OPERATOR, Xbox.B);
32
				toggleHook.toggleWhenActive(new ToggleCommandHook());
33
		/// drop the mast
34
			Button dropIt = new JoystickButton(OPERATOR, Xbox.X);
35
				dropIt.toggleWhenPressed(new ButtonCommandHitTheDeck());
36
		/// Reversing mode
37
			Button toggleReverse = new JoystickButton(DRIVER, Xbox.Y);
38
				toggleReverse.toggleWhenPressed(new ToggleCommandReverse());
39
		/// Docking mode
40
			Button toggleDock = new JoystickButton(DRIVER, Xbox.X);
41
				toggleDock.toggleWhenPressed(new ToggleCommandDock());
42
		/// To Compress, or Not To Compress. It is now an option.
43
			SmartDashboard.putData("Disable Compressor", new ToggleCommandKillCompressor());
44
			
45
46
		/// PID
47
			SmartDashboard.putData("Kill PID", new ToggleCommandKillPID());
48
			SmartDashboard.putNumber("Right Encoder Position", 0);
49
			SmartDashboard.putNumber("Left Encoder Position", 0);
50
			
51
		/// limit switch displays
52
			SmartDashboard.putBoolean("Lower Screw", true);
53
	    	SmartDashboard.putBoolean("Upper Screw", false);
54
	    	SmartDashboard.putBoolean("Lower Pinion", true);
55
	    	SmartDashboard.putBoolean("Upper Pinion", false);
56
	    	
57
	    	SmartDashboard.putNumber("Left inches", 0);
58
	    	SmartDashboard.putNumber("Right inches", 0);
59
	    	
60
	    	DriverStation.reportWarning("OI IS INSTANTIATED", false);
61
62
	    /// Cyborg command testers
63
			SmartDashboard.putData("Drive Direct", new CyborgCommandDriveDirect(Util.getAndSetDouble("Drive Direct Power", 0)));
64
			SmartDashboard.putData("Drive Distance", new CyborgCommandDriveDistance(Util.getAndSetDouble("Drive Distance Inches", 0)));
65
			SmartDashboard.putData("Drive Until Error", new CyborgCommandDriveUntilError());
66
			SmartDashboard.putData("Rotate Degree", new CyborgCommandRotateDegrees(Util.getAndSetDouble("Rotate Degrees", 0)));
67
			SmartDashboard.putData("Spit", new CyborgCommandSpit((long)Util.getAndSetDouble("Spit Time", 500)));
0 ignored issues
show
Comprehensibility introduced by
Consider assigning this magic number 500 to a constant.

Using constants for hard-coded numbers is a best practice. A constant’s name can explain the rationale behind this magic number. It is also easier to find if you ever need to change it.

Loading history...
68
			SmartDashboard.putData("Raise to Position: Pinion Up", new CyborgCommandGrow(Mast.PINION_UP));
69
			SmartDashboard.putData("Raise to Position: Pinion Down", new CyborgCommandGrow(Mast.PINION_DOWN));
70
			SmartDashboard.putData("Raise to Position: Screw Up", new CyborgCommandGrow(Mast.SCREW_UP));
71
			SmartDashboard.putData("Raise to Position: Screw Down", new CyborgCommandGrow(Mast.SCREW_DOWN));
72
	}
73
	
74
}