Skip to content

Commit c014588

Browse files
Fix dean's comments and fix toggle limelight btn
1 parent 8dc4594 commit c014588

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

Robot2019/src/main/java/frc/robot/commands/Drive.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ private void autoAlign() {
248248
}
249249
}
250250
else if (limelightMode == Limelight.Mode.STEER) {
251-
adjustment = lime.distanceAssist();
251+
adjustment = lime.steeringAssist();
252252
dt.drive(adjustment, -adjustment);
253253
if (Math.abs(adjustment) < minError) {
254254
SmartDashboard.putBoolean("Finished Aligning", true);
@@ -266,13 +266,7 @@ else if (limelightMode == Limelight.Mode.STEER) {
266266
// Make this return true when this Command no longer needs to run execute()
267267
@Override
268268
protected boolean isFinished() {
269-
if (!SmartDashboard.getBoolean("Use Limelight", false) || SmartDashboard.getBoolean("Finished Aligning", false)) {
270-
SmartDashboard.putBoolean("Use Limelight", false);
271-
SmartDashboard.putBoolean("Finished Aligning", false);
272-
return true;
273-
} else {
274-
return false;
275-
}
269+
return false;
276270
}
277271

278272
// Called once after isFinished returns true

Robot2019/src/main/java/frc/robot/commands/ToggleLimelight.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public ToggleLimelight() {
1717
@Override
1818
protected void initialize() {
1919
if (SmartDashboard.getBoolean("Using Limelight", false)) {
20-
SmartDashboard.putBoolean("Using Limelight", true);
21-
} else {
2220
SmartDashboard.putBoolean("Using Limelight", false);
21+
} else {
22+
SmartDashboard.putBoolean("Using Limelight", true);
2323
}
2424
}
2525
}

Robot2019/src/main/java/frc/robot/lib/Limelight.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ public enum Mode {
1818

1919
private NetworkTableInstance inst;
2020
private NetworkTable table;
21+
/* http://docs.limelightvision.io/en/latest/networktables_api.html
22+
tv = Whether the limelight has any valid targets (0 or 1)
23+
tx = Horizontal Offset From Crosshair To Target (-27 degrees to 27 degrees)
24+
ty = Vertical Offset From Crosshair To Target (-20.5 degrees to 20.5 degrees)
25+
ta = Target Area (0% of image to 100% of image)
26+
There are more values we could be using. Check the documentation.
27+
*/
2128
private double tv, tx, ty, ta;
2229

2330
public Limelight() {

0 commit comments

Comments
 (0)