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

Commit 11e2b95

Browse files
Fixed move PID and jerky teleop when not using velocity PID.
We were setting the differential drive's maxOutput to 204 even when not using velocity PID. This caused the jerkiness and the massive move PID overshoot. Also fixed the NullReferenceException in PIDMove.end() caused by AutoUtils.state not being initialized during teleop.
1 parent ec14fe7 commit 11e2b95

3 files changed

Lines changed: 32 additions & 17 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ public void autonomousPeriodic() {
196196
@Override
197197
public void teleopInit() {
198198
System.out.println("In teleopInit()");
199+
dt.resetAHRS();
200+
AutoUtils.state = new State(0, 0, 0);
199201
// This makes sure that the autonomous stops running when
200202
// teleop starts running. If you want the autonomous to
201203
// continue until interrupted by another command, remove

Robot2018/src/org/usfirst/frc/team199/Robot2018/subsystems/Drivetrain.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,12 @@ public Drivetrain() {
7070

7171
if (Robot.getBool("Teleop velocity PID", false)) {
7272
robotDrive = new DifferentialDrive(leftVelocityController, rightVelocityController);
73+
robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
7374
} else {
7475
robotDrive = new DifferentialDrive(dtLeft, dtRight);
76+
7577
}
76-
robotDrive.setMaxOutput(Robot.getConst("Max High Speed", 204));
78+
7779
}
7880

7981
@Override

shuffleboard.json

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"dividerPosition": 0.28519061583577715,
2+
"dividerPosition": 0.28486646884273,
33
"tabPane": [
44
{
55
"title": "PID Testing",
@@ -87,7 +87,7 @@
8787
"content": {
8888
"_type": "Graph",
8989
"_source0": "network_table:///SmartDashboard/Drivetrain/Left VPID Targ",
90-
"_title": "/SmartDashboard/Drivetrain/Left VPID Targ",
90+
"_title": "SmartDashboard/Drivetrain/Left VPID Targ",
9191
"Visible time": 30.0,
9292
"SmartDashboard/Drivetrain/Left VPID Targ visible": true
9393
}
@@ -100,7 +100,7 @@
100100
"content": {
101101
"_type": "Graph",
102102
"_source0": "network_table:///SmartDashboard/Drivetrain/Right VPID Targ",
103-
"_title": "/SmartDashboard/Drivetrain/Right VPID Targ",
103+
"_title": "SmartDashboard/Drivetrain/Right VPID Targ",
104104
"Visible time": 30.0,
105105
"SmartDashboard/Drivetrain/Right VPID Targ visible": true
106106
}
@@ -262,6 +262,17 @@
262262
"_source0": "network_table:///Preferences/Bool/Square Joystick Values",
263263
"_title": "Preferences/Bool/Square Joystick Values"
264264
}
265+
},
266+
"1,2": {
267+
"size": [
268+
1,
269+
1
270+
],
271+
"content": {
272+
"_type": "Toggle Switch",
273+
"_source0": "network_table:///Preferences/Bool/Teleop velocity PID",
274+
"_title": "Preferences/Bool/Teleop velocity PID"
275+
}
265276
}
266277
}
267278
}
@@ -276,17 +287,6 @@
276287
"hgap": 16.0,
277288
"vgap": 16.0,
278289
"tiles": {
279-
"0,2": {
280-
"size": [
281-
1,
282-
1
283-
],
284-
"content": {
285-
"_type": "Text View",
286-
"_source0": "network_table:///SmartDashboard/Const/Move Targ",
287-
"_title": "SmartDashboard/Const/Move Targ"
288-
}
289-
},
290290
"3,0": {
291291
"size": [
292292
2,
@@ -385,7 +385,7 @@
385385
"content": {
386386
"_type": "Graph",
387387
"_source0": "network_table:///SmartDashboard/Drivetrain/Left VPID Targ",
388-
"_title": "/SmartDashboard/Drivetrain/Left VPID Targ",
388+
"_title": "SmartDashboard/Drivetrain/Left VPID Targ",
389389
"Visible time": 10.0,
390390
"SmartDashboard/Drivetrain/Left VPID Targ visible": true
391391
}
@@ -398,7 +398,7 @@
398398
"content": {
399399
"_type": "Graph",
400400
"_source0": "network_table:///SmartDashboard/Drivetrain/Right VPID Targ",
401-
"_title": "/SmartDashboard/Drivetrain/Right VPID Targ",
401+
"_title": "SmartDashboard/Drivetrain/Right VPID Targ",
402402
"Visible time": 10.0,
403403
"SmartDashboard/Drivetrain/Right VPID Targ visible": true
404404
}
@@ -424,6 +424,17 @@
424424
"_source0": "network_table:///SmartDashboard/Move PID",
425425
"_title": "SmartDashboard/Move PID"
426426
}
427+
},
428+
"0,2": {
429+
"size": [
430+
1,
431+
1
432+
],
433+
"content": {
434+
"_type": "Text View",
435+
"_source0": "network_table:///Preferences/Const/Move Targ",
436+
"_title": "Preferences/Const/Move Targ"
437+
}
427438
}
428439
}
429440
}

0 commit comments

Comments
 (0)