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

Commit 07d1fb8

Browse files
committed
Merge branch 'controller-docs' of https://github.com/Gabe-Mitnick/RobotCode2018 into controller-docs
2 parents 7405909 + 8d5328f commit 07d1fb8

7 files changed

Lines changed: 35 additions & 107 deletions

File tree

Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
#Sun Feb 18 11:01:27 PST 2018
1+
#Sun Feb 18 15:40:25 PST 2018
22
C\:\\Users\\dean\\git\\RobotCode2018\\Robot2018\\lib\\libpathfinderjava.so=4087ee38c338446b8305f67716260df4

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

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
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;
17-
import org.usfirst.frc.team199.Robot2018.commands.RaiseIntake;
1817
import org.usfirst.frc.team199.Robot2018.commands.ResetEncoders;
1918
import org.usfirst.frc.team199.Robot2018.commands.RunLift;
2019
import org.usfirst.frc.team199.Robot2018.commands.SetDistancePerPulse;
@@ -96,18 +95,18 @@ public OI() {
9695
moveLiftUpButton.whileHeld(new RunLift(Robot.lift, true));
9796
moveLiftDownButton.whileHeld(new RunLift(Robot.lift, false));
9897

99-
manipulator = new Joystick(2);
100-
closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
101-
closeIntakeButton.whenPressed(new CloseIntake());
102-
openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
103-
openIntakeButton.whenPressed(new OpenIntake());
104-
raiseIntakeButton = new JoystickButton(manipulator, getButton("Raise Intake Button", 3));
105-
raiseIntakeButton.whenPressed(new RaiseIntake());
106-
lowerIntakeButton = new JoystickButton(manipulator, getButton("Lower Intake Button", 4));
107-
lowerIntakeButton.whenPressed(new LowerIntake());
108-
intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
109-
intakeCubeButton.whenPressed(new IntakeCube());
110-
outtakeCubeButton = new JoystickButton(manipulator, getButton("Outake Button", 6));
111-
outtakeCubeButton.whenPressed(new OuttakeCube());
98+
// manipulator = new Joystick(2);
99+
// closeIntakeButton = new JoystickButton(manipulator, getButton("Close Intake Button", 1));
100+
// closeIntakeButton.whenPressed(new CloseIntake());
101+
// openIntakeButton = new JoystickButton(manipulator, getButton("Open Intake Button", 2));
102+
// openIntakeButton.whenPressed(new OpenIntake());
103+
// raiseIntakeButton = new JoystickButton(manipulator, getButton("Raise Intake Button", 3));
104+
// raiseIntakeButton.whenPressed(new RaiseIntake());
105+
// lowerIntakeButton = new JoystickButton(manipulator, getButton("Lower Intake Button", 4));
106+
// lowerIntakeButton.whenPressed(new LowerIntake());
107+
// intakeCubeButton = new JoystickButton(manipulator, getButton("Intake Button", 5));
108+
// intakeCubeButton.whenPressed(new IntakeCube());
109+
// outtakeCubeButton = new JoystickButton(manipulator, getButton("Outtake Button", 6));
110+
// outtakeCubeButton.whenPressed(new OuttakeCube());
112111
}
113112
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public void teleopPeriodic() {
212212
// SmartDashboard.putNumber("Right Enc Dist", dt.getRightDist());
213213
// SmartDashboard.putNumber("Avg Enc Dist", dt.getEncAvgDist());
214214
//
215-
// SmartDashboard.putNumber("Angle", dt.getAHRSAngle());
215+
SmartDashboard.putNumber("Angle", dt.getAHRSAngle());
216216
}
217217

218218
boolean firstTime = true;

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ public PIDMove(double targ, DrivetrainInterface dt, SmartDashboardInterface sd,
4343
if (Robot.dt != null) {
4444
requires(Robot.dt);
4545
}
46-
moveController = new PIDController(sd.getConst("MovekP", 1), sd.getConst("MovekI", 0), sd.getConst("MovekD", 0),
47-
avg, this);
4846
double kf = 1 / (dt.getCurrentMaxSpeed() * sd.getConst("Default PID Update Time", 0.05));
49-
moveController = new PIDController(sd.getConst("MovekP", 1), sd.getConst("MovekI", 0), sd.getConst("MovekD", 0),
50-
kf, avg, this);
47+
moveController = new PIDController(sd.getConst("MovekP", 0.1), sd.getConst("MovekI", 0),
48+
sd.getConst("MovekD", 0), kf, avg, this);
49+
SmartDashboard.putData("Move PID", moveController);
5150
}
5251

5352
/**
@@ -66,8 +65,6 @@ public void initialize() {
6665
moveController.setAbsoluteTolerance(Robot.getConst("MoveTolerance", 0.1));
6766
moveController.setSetpoint(Robot.getConst("Move Targ", 24));
6867

69-
SmartDashboard.putData("Move PID", moveController);
70-
7168
moveController.enable();
7269
// dt.enableVelocityPIDs();
7370
}

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public PIDTurn(double targ, DrivetrainInterface dt, SmartDashboardInterface sd,
5858
turnController = new PIDController(sd.getConst("TurnkP", 1), sd.getConst("TurnkI", 0), sd.getConst("TurnkD", 0),
5959
kf, ahrs, this);
6060
// tim = new Timer();
61+
SmartDashboard.putData("Turn PID", turnController);
6162
}
6263

6364
/**
@@ -69,23 +70,21 @@ protected void initialize() {
6970
turnController.disable();
7071
// dt.enableVelocityPIDs();
7172
System.out.println("initialize2s");
72-
dt.resetAHRS();
73+
// dt.resetAHRS();
7374
System.out.println("after reset");
7475
System.out.println("after disabling");
7576
// input is in degrees
7677
turnController.setInputRange(-180, 180);
7778
// output in "motor units" (arcade and tank only accept values [-1, 1]
78-
turnController.setOutputRange(-1.0, 1.0);
79+
turnController.setOutputRange(Robot.getConst("Output", 0.5) * -1, Robot.getConst("Output", 0.5));
7980
turnController.setContinuous(true);
8081
turnController.setAbsoluteTolerance(Robot.getConst("TurnTolerance", 1));
81-
double newSetPoint = Robot.getConst("Turn Targ", 90);
82+
double newSetPoint = Robot.getConst("Turn Targ", 90) + dt.getAHRSAngle();
8283
while (Math.abs(newSetPoint) > 180) {
8384
newSetPoint = newSetPoint - Math.signum(newSetPoint) * 360;
8485
}
8586
turnController.setSetpoint(newSetPoint);
8687

87-
SmartDashboard.putData("Turn PID", turnController);
88-
8988
turnController.enable();
9089
System.out.println("initialize finished");
9190
// tim.start();

shuffleboard.json

Lines changed: 13 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"dividerPosition": 0.2218100890207715,
2+
"dividerPosition": 0.45185185185185184,
33
"tabPane": [
44
{
55
"title": "PID Testing",
@@ -41,9 +41,8 @@
4141
"content": {
4242
"_type": "Graph",
4343
"_source0": "network_table:///SmartDashboard/Left Enc Rate",
44-
"_title": "SmartDashboard/Left Enc Rate",
45-
"Visible time": 30.0,
46-
"SmartDashboard/Left Enc Rate visible": true
44+
"_title": "/SmartDashboard/Left Enc Rate",
45+
"Visible time": 30.0
4746
}
4847
},
4948
"5,2": {
@@ -65,9 +64,8 @@
6564
"content": {
6665
"_type": "Graph",
6766
"_source0": "network_table:///SmartDashboard/Right Enc Rate",
68-
"_title": "SmartDashboard/Right Enc Rate",
69-
"Visible time": 30.0,
70-
"SmartDashboard/Right Enc Rate visible": true
67+
"_title": "/SmartDashboard/Right Enc Rate",
68+
"Visible time": 30.0
7169
}
7270
},
7371
"5,3": {
@@ -242,17 +240,6 @@
242240
"colorWhenTrue": "#7CFC00FF",
243241
"colorWhenFalse": "#8B0000FF"
244242
}
245-
},
246-
"2,1": {
247-
"size": [
248-
2,
249-
1
250-
],
251-
"content": {
252-
"_type": "Text View",
253-
"_source0": "network_table:///SmartDashboard/Const/DPP",
254-
"_title": "SmartDashboard/Const/DPP"
255-
}
256243
}
257244
}
258245
}
@@ -297,9 +284,8 @@
297284
"content": {
298285
"_type": "Graph",
299286
"_source0": "network_table:///SmartDashboard/Right Enc Dist",
300-
"_title": "SmartDashboard/Right Enc Dist",
301-
"Visible time": 10.0,
302-
"SmartDashboard/Right Enc Dist visible": true
287+
"_title": "/SmartDashboard/Right Enc Dist",
288+
"Visible time": 10.0
303289
}
304290
},
305291
"1,0": {
@@ -310,14 +296,13 @@
310296
"content": {
311297
"_type": "Graph",
312298
"_source0": "network_table:///SmartDashboard/Left Enc Dist",
313-
"_title": "SmartDashboard/Left Enc Dist",
314-
"Visible time": 10.0,
315-
"SmartDashboard/Left Enc Dist visible": true
299+
"_title": "/SmartDashboard/Left Enc Dist",
300+
"Visible time": 10.0
316301
}
317302
},
318303
"5,0": {
319304
"size": [
320-
2,
305+
1,
321306
1
322307
],
323308
"content": {
@@ -431,7 +416,7 @@
431416
"hgap": 16.0,
432417
"vgap": 16.0,
433418
"tiles": {
434-
"5,0": {
419+
"1,0": {
435420
"size": [
436421
2,
437422
1
@@ -475,7 +460,7 @@
475460
"_title": "SmartDashboard/Turn PID Result"
476461
}
477462
},
478-
"5,1": {
463+
"2,1": {
479464
"size": [
480465
1,
481466
1
@@ -519,32 +504,6 @@
519504
"_title": "SmartDashboard/Right VPID Error"
520505
}
521506
},
522-
"3,2": {
523-
"size": [
524-
2,
525-
2
526-
],
527-
"content": {
528-
"_type": "Graph",
529-
"_source0": "network_table:///SmartDashboard/Drivetrain/Left VPID Targ",
530-
"_title": "SmartDashboard/Drivetrain/Left VPID Targ",
531-
"Visible time": 30.0,
532-
"SmartDashboard/Drivetrain/Left VPID Targ visible": true
533-
}
534-
},
535-
"5,2": {
536-
"size": [
537-
2,
538-
2
539-
],
540-
"content": {
541-
"_type": "Graph",
542-
"_source0": "network_table:///SmartDashboard/Drivetrain/Right VPID Targ",
543-
"_title": "SmartDashboard/Drivetrain/Right VPID Targ",
544-
"Visible time": 30.0,
545-
"SmartDashboard/Drivetrain/Right VPID Targ visible": true
546-
}
547-
},
548507
"0,2": {
549508
"size": [
550509
1,
@@ -556,7 +515,7 @@
556515
"_title": "SmartDashboard/Const/Turn Targ"
557516
}
558517
},
559-
"6,1": {
518+
"1,1": {
560519
"size": [
561520
1,
562521
1
@@ -566,32 +525,6 @@
566525
"_source0": "network_table:///SmartDashboard/Const/TurnTolerance",
567526
"_title": "SmartDashboard/Const/TurnTolerance"
568527
}
569-
},
570-
"3,0": {
571-
"size": [
572-
2,
573-
2
574-
],
575-
"content": {
576-
"_type": "Graph",
577-
"_source0": "network_table:///SmartDashboard/Drivetrain/Right Enc Dist",
578-
"_title": "SmartDashboard/Drivetrain/Right Enc Dist",
579-
"Visible time": 30.0,
580-
"SmartDashboard/Drivetrain/Right Enc Dist visible": true
581-
}
582-
},
583-
"1,0": {
584-
"size": [
585-
2,
586-
2
587-
],
588-
"content": {
589-
"_type": "Graph",
590-
"_source0": "network_table:///SmartDashboard/Drivetrain/Left Enc Dist",
591-
"_title": "SmartDashboard/Drivetrain/Left Enc Dist",
592-
"Visible time": 30.0,
593-
"SmartDashboard/Drivetrain/Left Enc Dist visible": true
594-
}
595528
}
596529
}
597530
}

0 commit comments

Comments
 (0)