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

Commit c2fba8b

Browse files
committed
Merge branch 'controller-docs' of
https://github.com/gabe-mitnick/RobotCode2018 Conflicts: Robot2018/src/org/usfirst/frc/team199/Robot2018/OI.java
2 parents f2a2bec + 07d1fb8 commit c2fba8b

File tree

6 files changed

+96
-95
lines changed

6 files changed

+96
-95
lines changed

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

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77

88
package org.usfirst.frc.team199.Robot2018;
99

10+
import org.usfirst.frc.team199.Robot2018.commands.CloseIntake;
11+
import org.usfirst.frc.team199.Robot2018.commands.IntakeCube;
12+
import org.usfirst.frc.team199.Robot2018.commands.LowerIntake;
13+
import org.usfirst.frc.team199.Robot2018.commands.OpenIntake;
14+
import org.usfirst.frc.team199.Robot2018.commands.OuttakeCube;
1015
import org.usfirst.frc.team199.Robot2018.commands.PIDMove;
1116
import org.usfirst.frc.team199.Robot2018.commands.PIDTurn;
1217
import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders;
@@ -35,21 +40,21 @@ public class OI {
3540
private JoystickButton shiftLowGearButton;
3641
private JoystickButton shiftHighGearButton;
3742
private JoystickButton shiftDriveTypeButton;
38-
private JoystickButton PIDMoveButton;
39-
private JoystickButton PIDTurnButton;
43+
private JoystickButton pIDMoveButton;
44+
private JoystickButton pIDTurnButton;
4045
private JoystickButton resetEncButton;
41-
private JoystickButton MoveLiftUpButton;
42-
private JoystickButton MoveLiftDownButton;
46+
private JoystickButton moveLiftUpButton;
47+
private JoystickButton moveLiftDownButton;
4348
public Joystick rightJoy;
4449
private JoystickButton updatePIDConstantsButton;
4550
private JoystickButton updateEncoderDPPButton;
4651
public static Joystick manipulator;
47-
private JoystickButton closeIntake;
48-
private JoystickButton openIntake;
49-
private JoystickButton raiseIntake;
50-
private JoystickButton lowerIntake;
51-
private JoystickButton intake;
52-
private JoystickButton outake;
52+
private JoystickButton closeIntakeButton;
53+
private JoystickButton openIntakeButton;
54+
private JoystickButton raiseIntakeButton;
55+
private JoystickButton lowerIntakeButton;
56+
private JoystickButton intakeCubeButton;
57+
private JoystickButton outtakeCubeButton;
5358

5459
public int getButton(String key, int def) {
5560
if (!SmartDashboard.containsKey("Button/" + key)) {
@@ -65,13 +70,13 @@ public OI() {
6570
leftJoy = new Joystick(0);
6671
shiftDriveTypeButton = new JoystickButton(leftJoy, getButton("Shift Drive Type", 2));
6772
shiftDriveTypeButton.whenPressed(new ShiftDriveType());
68-
PIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7));
69-
PIDMoveButton
73+
pIDMoveButton = new JoystickButton(leftJoy, getButton("PID Move", 7));
74+
pIDMoveButton
7075
.whenPressed(new PIDMove(Robot.sd.getConst("Move Targ", 24), Robot.dt, Robot.sd, RobotMap.distEncAvg));
71-
PIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8));
76+
pIDTurnButton = new JoystickButton(leftJoy, getButton("PID Turn", 8));
7277
// PIDTurnButton.whenPressed(new PIDTurn(Robot.getConst("Turn Targ", 90),
7378
// Robot.dt, Robot.sd RobotMap.fancyGyro));
74-
PIDTurnButton
79+
pIDTurnButton
7580
.whenReleased(new PIDTurn(Robot.getConst("Turn Targ", 90), Robot.dt, Robot.sd, RobotMap.fancyGyro));
7681
resetEncButton = new JoystickButton(leftJoy, getButton("Reset Dist Enc", 10));
7782
resetEncButton.whenPressed(new ResetEncoders());
@@ -87,22 +92,18 @@ public OI() {
8792
updateEncoderDPPButton.whenPressed(new SetDistancePerPulse());
8893

8994
// manipulator = new Joystick(2);
90-
// closeIntake = new JoystickButton(manipulator, getButton("Close Intake
91-
// Button", 1));
92-
// closeIntake.whenPressed(new CloseIntake());
93-
// openIntake = new JoystickButton(manipulator, getButton("Open Intake Button",
94-
// 2));
95-
// openIntake.whenPressed(new OpenIntake());
96-
// raiseIntake = new JoystickButton(manipulator, getButton("Raise Intake
97-
// Button", 3));
98-
// raiseIntake.whenPressed(new RaiseIntake());
99-
// lowerIntake = new JoystickButton(manipulator, getButton("Lower Intake
100-
// Button", 4));
101-
// lowerIntake.whenPressed(new LowerIntake());
102-
// intake = new JoystickButton(manipulator, getButton("Intake Button", 5));
103-
// intake.whenPressed(new IntakeCube());
104-
// outake = new JoystickButton(manipulator, getButton("Outake Button", 6));
105-
// outake.whenPressed(new OutakeCube());
95+
// closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
96+
// closeIntakeButton.whenPressed(new CloseIntake());
97+
// openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
98+
// openIntakeButton.whenPressed(new OpenIntake());
99+
// raiseIntakeButton = new JoystickButton(manipulator, getButton("Raise Intake Button", 3));
100+
// raiseIntakeButton.whenPressed(new RaiseIntake());
101+
// lowerIntakeButton = new JoystickButton(manipulator, getButton("Lower Intake Button", 4));
102+
// lowerIntakeButton.whenPressed(new LowerIntake());
103+
// intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
104+
// intakeCubeButton.whenPressed(new IntakeCube());
105+
// outtakeCubeButton = new JoystickButton(manipulator, getButton("Outtake Button", 6));
106+
// outtakeCubeButton.whenPressed(new OuttakeCube());
106107

107108
/*MoveLiftUpButton = new JoystickButton(manipulator, getButton("Run Lift Motor Up", 7));
108109
MoveLiftDownButton = new JoystickButton(manipulator, getButton("Run Lift Motor Down", 8));

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
30-
2
31-
3
32-
4
33-
5
34-
6
35-
7
36-
8
37-
9
38-
10
39-
11
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
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+
left joystick [0]
2+
buttons
3+
1
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
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+
right joystick [1]
19+
buttons
20+
1
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+
manipulator [3]
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)