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

Commit 17eb98f

Browse files
Merge branch 'controller-docs' of
https://github.com/Gabe-Mitnick/RobotCode2018.git into vel-pid-2 Conflicts: Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java docs/controllers.txt
2 parents d016096 + 54d1f41 commit 17eb98f

File tree

6 files changed

+98
-98
lines changed

6 files changed

+98
-98
lines changed

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

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import org.usfirst.frc.team199.Robot2018.commands.FindTurnTimeConstant;
1212
import org.usfirst.frc.team199.Robot2018.commands.IntakeCube;
1313
import org.usfirst.frc.team199.Robot2018.commands.OpenIntake;
14-
import org.usfirst.frc.team199.Robot2018.commands.OutakeCube;
14+
import org.usfirst.frc.team199.Robot2018.commands.OuttakeCube;
1515
import org.usfirst.frc.team199.Robot2018.commands.PIDMove;
1616
import org.usfirst.frc.team199.Robot2018.commands.PIDTurn;
1717
import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders;
@@ -43,24 +43,24 @@ public class OI {
4343
private JoystickButton shiftLowGearButton;
4444
private JoystickButton shiftHighGearButton;
4545
private JoystickButton shiftDriveTypeButton;
46-
private JoystickButton PIDMoveButton;
47-
private JoystickButton PIDTurnButton;
46+
private JoystickButton pIDMoveButton;
47+
private JoystickButton pIDTurnButton;
4848
private JoystickButton resetEncButton;
49-
private JoystickButton MoveLiftUpButton;
50-
private JoystickButton MoveLiftDownButton;
49+
private JoystickButton moveLiftUpButton;
50+
private JoystickButton moveLiftDownButton;
5151
private JoystickButton findTurnTimeConstantButton;
5252
private JoystickButton updatePIDConstantsButton;
5353
private JoystickButton updateEncoderDPPButton;
5454

5555
public Joystick manipulator;
56-
private JoystickButton closeIntake;
57-
private JoystickButton openIntake;
58-
private JoystickButton raiseIntake;
59-
private JoystickButton lowerIntake;
60-
private JoystickButton intake;
61-
private JoystickButton outake;
62-
private JoystickButton toggleLeftIntake;
63-
private JoystickButton toggleRightIntake;
56+
private JoystickButton closeIntakeButton;
57+
private JoystickButton openIntakeButton;
58+
private JoystickButton raiseIntakeButton;
59+
private JoystickButton lowerIntakeButton;
60+
private JoystickButton intakeCubeButton;
61+
private JoystickButton outakeCubeButton;
62+
private JoystickButton toggleLeftIntakeButton;
63+
private JoystickButton toggleRightIntakeButton;
6464

6565
public int getButton(String key, int def) {
6666
if (!SmartDashboard.containsKey("Button/" + key)) {
@@ -76,13 +76,13 @@ public OI(Robot robot) {
7676
leftJoy = new Joystick(0);
7777
shiftDriveTypeButton = new JoystickButton(leftJoy, getButton("Shift Drive Type", 2));
7878
shiftDriveTypeButton.whenPressed(new ShiftDriveType());
79-
PIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7));
80-
PIDMoveButton
79+
pIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7));
80+
pIDMoveButton
8181
.whenPressed(new PIDMove(Robot.sd.getConst("Move Targ", 24), Robot.dt, Robot.sd, RobotMap.distEncAvg));
82-
PIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8));
82+
pIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8));
8383
// PIDTurnButton.whenPressed(new PIDTurn(Robot.getConst("Turn Targ", 90),
8484
// Robot.dt, Robot.sd RobotMap.fancyGyro));
85-
PIDTurnButton
85+
pIDTurnButton
8686
.whenReleased(new PIDTurn(Robot.getConst("Turn Targ", 90), Robot.dt, Robot.sd, RobotMap.fancyGyro));
8787
resetEncButton = new JoystickButton(leftJoy, getButton("Reset Dist Enc", 10));
8888
resetEncButton.whenPressed(new ResetEncoders());
@@ -100,33 +100,33 @@ public OI(Robot robot) {
100100
updatePIDConstantsButton.whenPressed(new UpdatePIDConstants());
101101
updateEncoderDPPButton = new JoystickButton(rightJoy, getButton("Get Encoder Dist Per Pulse", 9));
102102
updateEncoderDPPButton.whenPressed(new SetDistancePerPulse());
103-
MoveLiftUpButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Up", 10));
104-
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));
103+
moveLiftUpButton = new JoystickButton(rightJoy, getButton("Run Lift Motor Up", 10));
104+
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));
107107

108108
manipulator = new Joystick(2);
109109
if (manipulator.getButtonCount() == 0) {
110110
System.out.println("Manipulator not plugged in!");
111111
} else {
112-
closeIntake = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
113-
closeIntake.whenPressed(new CloseIntake());
114-
openIntake = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
115-
openIntake.whenPressed(new OpenIntake());
112+
closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
113+
closeIntakeButton.whenPressed(new CloseIntake());
114+
openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
115+
openIntakeButton.whenPressed(new OpenIntake());
116116
// raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake
117117
// Button", 3));
118118
// raiseIntake.whenPressed(new RaiseIntake());
119119
// lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake
120120
// Button", 4));
121121
// lowerIntake.whenPressed(new LowerIntake());
122-
intake = new JoystickButton(manipulator, getButton("Intake Button", 5));
123-
intake.whenPressed(new IntakeCube());
124-
outake = new JoystickButton(manipulator, getButton("Outake Button", 6));
125-
outake.whenPressed(new OutakeCube());
126-
toggleLeftIntake = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3));
127-
toggleLeftIntake.whenPressed(new ToggleLeftIntake());
128-
toggleRightIntake = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
129-
toggleRightIntake.whenPressed(new ToggleRightIntake());
122+
intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
123+
intakeCubeButton.whenPressed(new IntakeCube());
124+
outakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6));
125+
outakeCubeButton.whenPressed(new OuttakeCube());
126+
toggleLeftIntakeButton = new JoystickButton(manipulator, getButton("Toggle Left Intake Button", 3));
127+
toggleLeftIntakeButton.whenPressed(new ToggleLeftIntake());
128+
toggleRightIntakeButton = new JoystickButton(manipulator, getButton("Toggle Right Intake Button", 4));
129+
toggleRightIntakeButton.whenPressed(new ToggleRightIntake());
130130
}
131131
}
132132

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OutakeCube.java renamed to Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/OuttakeCube.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
/**
99
*
1010
*/
11-
public class OutakeCube extends Command {
11+
public class OuttakeCube extends Command {
1212

1313
Timer tim;
1414

15-
public OutakeCube() {
15+
public OuttakeCube() {
1616
// Use requires() here to declare subsystem dependencies
1717
// eg. requires(chassis);
1818
}

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/ResetEncoders.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import edu.wpi.first.wpilibj.command.InstantCommand;
66

77
/**
8-
*
8+
* Resets left and right drivetrain encoders to 0
99
*/
1010
public class ResetEncoders extends InstantCommand {
1111

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/SetDistancePerPulse.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
import edu.wpi.first.wpilibj.command.InstantCommand;
66

77
/**
8-
*
8+
* Sets distance per pulse for left and right drivetrain encoders from
9+
* SmartDashboard "Distance Per Pulse Left" & "Distance Per Pulse Right"
910
*/
1011
public class SetDistancePerPulse extends InstantCommand {
1112

Robot2018/src/org/usfirst/frc/team199/Robot2018/commands/UpdatePIDConstants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import edu.wpi.first.wpilibj.command.InstantCommand;
66

77
/**
8-
*
8+
* Updates the PIDControllers' PIDConstants based on SmartDashboard values
99
*/
1010
public class UpdatePIDConstants extends InstantCommand {
1111

docs/controllers.txt

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,59 @@
1-
controller indices
2-
manipulator
3-
buttons
4-
1 A
5-
2 B
6-
3 X
7-
4 Y
8-
5 LB
9-
6 RB
10-
7 back
11-
8 start
12-
9 N/a
13-
10 N/a
14-
press mode to toggle mode light
15-
axes
16-
0 left thumbstick X axis (D-pad if mode light on)
17-
1 left thumbstick Y axis (D-pad if mode light on)
18-
2 left trigger
19-
3 right trigger
20-
4 right thumbstick X axis
21-
5 right thumbstick Y axis
22-
mode light off:
23-
POV
24-
D-pad (left joystick if mode light on)
25-
rumble
26-
fake news
27-
left joystick
28-
buttons
29-
1 Slow forward-backward movement in arcade, or all movement in tank
30-
2
31-
3
32-
4
33-
5
34-
6
35-
7
36-
8
37-
9
38-
10
39-
11 Run expirement to find turning time constant (FindTurnTimeConstant)
40-
axes
41-
0 X axis
42-
1 Y axis (forward is negative)
43-
2 Z axis (knob at base)
44-
right joystick
45-
buttons
46-
1 Slow turning movement in arcade, or all movement in tank
47-
2
48-
3
49-
4
50-
5
51-
6
52-
7
53-
8
54-
9
55-
10
56-
11
57-
axes
58-
0 X axis
59-
1 Y axis (forward is negative)
60-
2 Z axis (knob at base)
1+
0 left joystick
2+
buttons
3+
1 slow forward-backward movement in arcade, or all movement in tank
4+
2 toggle drive type (arcade/tank) [ShiftDriveType]
5+
3
6+
4
7+
5
8+
6
9+
7 move with PID by inches from SmartDashboard "Move Targ" [PIDMove]
10+
8 turn with PID by degrees from SmartDashboard "Turn Targ" [PIDTurn]
11+
9
12+
10 reset left and right drivetrain encoders to 0 [ResetEncoders]
13+
11 run experiment to find turning time constant (FindTurnTimeConstant)
14+
axes
15+
0 X axis if NOT default: arcade turn
16+
1 Y axis tank left, arcade forward (if default)
17+
2 Z axis
18+
1 right joystick
19+
buttons
20+
1 slow turning movement in arcade, or all movement in tank
21+
2 shift drivetrain to low gear [ShiftLowGear]
22+
3 shift drivetrain to high gear [ShiftHighGear]
23+
4
24+
5
25+
6
26+
7
27+
8 update the PIDController constants with SmartDashboard values [UpdatePIDConstants]
28+
9 set the left and right encoder distance per pulse with SmartDashboard values [SetDistancePerPulse]
29+
10 run lift motor up [RunLift]
30+
11 run lift motor down [RunLift]
31+
axes
32+
0 X axis arcade turn (if default)
33+
1 Y axis tank right, if NOT default: arcade forward
34+
2 Z axis
35+
2 manipulator
36+
buttons
37+
1 A close intake [CloseIntake]
38+
2 B open intake [OpenIntake]
39+
3 X raise intake [RaiseIntake]
40+
4 Y lower intake [LowerIntake]
41+
5 LB take in [IntakeCube]
42+
6 RB take out [OuttakeCube]
43+
7 back
44+
8 start
45+
9 N/a
46+
10 N/a
47+
press mode to toggle mode light
48+
axes
49+
0 left thumbstick X axis (D-pad if mode light on)
50+
1 left thumbstick Y axis (D-pad if mode light on)
51+
2 left trigger
52+
3 right trigger
53+
4 right thumbstick X axis
54+
5 right thumbstick Y axis
55+
mode light off:
56+
POV
57+
D-pad (left joystick if mode light on)
58+
rumble
59+
fake news

0 commit comments

Comments
 (0)