summaryrefslogtreecommitdiff
path: root/src/org/usfirst
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-03-04 11:29:50 -0500
committerLuke Shumaker <lukeshu@lukeshu.com>2017-03-04 11:30:56 -0500
commit2696a9fc8c17ff632c1f5e7d3838e89dd9c0dea3 (patch)
treef840f620e6e114036c5185ff354a160fff029c75 /src/org/usfirst
parent7ec2732ece0e94ab9fa5ae983adfcbaef24c336d (diff)
tidy
Diffstat (limited to 'src/org/usfirst')
-rw-r--r--src/org/usfirst/frc/team4272/robot2017/Autonomous.java26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java
index 8398688..7220d89 100644
--- a/src/org/usfirst/frc/team4272/robot2017/Autonomous.java
+++ b/src/org/usfirst/frc/team4272/robot2017/Autonomous.java
@@ -71,31 +71,38 @@ public class Autonomous {
double rDistCurr = robot.rDriveE.getDistance();
double lPct = lDistCurr/lDistTarget;
double rPct = rDistCurr/rDistTarget;
- /* Left Drive train */
+
+ /* Left side */
c.lDrive = lSpeed;
if (Math.abs(1-lPct) < pctTaper) {
- c.lDrive *= Math.abs((1-lPct)/pctTaper); /* Tapering off to slow down to the designed target*/
+ /* Taper off, slowing down as we approach the designed target */
+ c.lDrive *= Math.abs((1-lPct)/pctTaper);
if (Math.abs(robot.lRate.pidGet()) < 0.5) {
- lMin = c.lDrive = Math.max(c.lDrive, lMin) * 1.05; /* Multiplier*/
+ /* oops, tapered off too quickly */
+ lMin = c.lDrive = Math.max(c.lDrive, lMin) * 1.05; /* Multiplier */
}
- if (c.lDrive > lSpeed) { /* Speed to high*/
+ if (c.lDrive > lSpeed) { /* Speed too high */
c.lDrive = lSpeed;
}
}
c.lDrive *= Math.signum(lDistTarget) * Math.signum(1-lPct);
- /* Right Drive Train*/
+
+ /* Right side */
c.rDrive = rSpeed;
if (Math.abs(1-rPct) < pctTaper) {
- c.rDrive *= Math.abs((1-rPct)/pctTaper); /* Tapering off to slow down to the deigned target*/
+ /* Taper off, slowing down as we approach the designated target */
+ c.rDrive *= Math.abs((1-rPct)/pctTaper);
if (Math.abs(robot.rRate.pidGet()) < 0.5) {
- rMin = c.rDrive = Math.max(c.rDrive, rMin) * 1.05; /* Multiplier*/
+ /* oops, tapered off too quickly */
+ rMin = c.rDrive = Math.max(c.rDrive, rMin) * 1.05; /* Multiplier */
}
- if (c.rDrive > rSpeed) { /* Speed to high*/
+ if (c.rDrive > rSpeed) { /* Speed too high */
c.rDrive = rSpeed;
}
}
c.rDrive *= Math.signum(rDistTarget) * Math.signum(1-rPct);
- /* If lDrive or rDrive is not even */
+
+ /* Make sure the left and right sides are even */
if (Math.abs(lPct - rPct) > pctTolerance) {
if (lPct > rPct) {
c.lDrive *= pctThrottle;
@@ -103,6 +110,7 @@ public class Autonomous {
c.rDrive *= pctThrottle;
}
}
+
SmartDashboard.putNumber("lPct", lPct);
SmartDashboard.putNumber("rPct", rPct);
SmartDashboard.putNumber("lMin", lMin);