Skip to content

Commit bd4bcbc

Browse files
Merge pull request #91 from DeepBlueRobotics/limelightDisabled-flag
Limelight-disabling flag
2 parents f049273 + 3a9964f commit bd4bcbc

File tree

7 files changed

+22
-7
lines changed

7 files changed

+22
-7
lines changed

src/main/java/org/carlmontrobotics/Config.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public abstract class Config implements Sendable {
2424
protected boolean exampleFlagEnabled = false;
2525
protected boolean swimShady = false;
2626
protected boolean setupSysId = false;
27+
protected boolean limelightDisabled = false;
2728
protected boolean useSmartDashboardControl = false; // whether to control arm position + rpm of
2829
// outtake through SmartDashboard
2930
// Note: disables joystick control of arm and
@@ -49,7 +50,11 @@ public boolean useSmartDashboardControl() {
4950
return useSmartDashboardControl;
5051
}
5152

52-
// --- For clarity, place additional config settings ^above^ this line ---
53+
public boolean isLimelightDisabled() {
54+
return limelightDisabled;
55+
}
56+
57+
// --- Place additional config settings ^above^ this line ---
5358

5459
private static class MethodResult {
5560
String methodName = null;

src/main/java/org/carlmontrobotics/commands/AimArmSpeaker.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
import edu.wpi.first.wpilibj2.command.Command;
1313

14+
import static org.carlmontrobotics.Config.CONFIG;
15+
1416
public class AimArmSpeaker extends Command {
1517
private final Arm arm;
1618
private final Limelight ll;
@@ -45,6 +47,6 @@ public void end(boolean interrupted) {}
4547
// Returns true when the command should end.
4648
@Override
4749
public boolean isFinished() {
48-
return arm.armAtSetpoint();
50+
return arm.armAtSetpoint() || CONFIG.isLimelightDisabled();
4951
}
5052
}

src/main/java/org/carlmontrobotics/commands/AlignToApriltag.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1717
import edu.wpi.first.wpilibj2.command.Command;
1818

19+
import static org.carlmontrobotics.Config.CONFIG;
20+
1921
public class AlignToApriltag extends Command {
2022

2123
public final TeleopDrive teleopDrive;
@@ -106,6 +108,6 @@ public boolean isFinished() {
106108
// return false;
107109
// SmartDashboard.putBoolean("At Setpoint", rotationPID.atSetpoint());
108110
// SmartDashboard.putNumber("Error", rotationPID.getPositionError());
109-
return rotationPID.atSetpoint();
111+
return rotationPID.atSetpoint() || CONFIG.isLimelightDisabled();
110112
}
111113
}

src/main/java/org/carlmontrobotics/commands/AlignToNote.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
import edu.wpi.first.util.sendable.SendableRegistry;
1717
import edu.wpi.first.wpilibj2.command.Command;
1818

19+
import static org.carlmontrobotics.Config.CONFIG;
20+
1921
public class AlignToNote extends Command {
2022

2123
public final TeleopDrive teleopDrive;
@@ -54,7 +56,7 @@ public void execute() {
5456

5557
@Override
5658
public boolean isFinished() {
57-
return false;
59+
return CONFIG.isLimelightDisabled();
5860
// SmartDashboard.putBoolean("At Setpoint", rotationPID.atSetpoint());
5961
// SmartDashboard.putNumber("Error", rotationPID.getPositionError());
6062
// return rotationPID.atSetpoint();

src/main/java/org/carlmontrobotics/commands/AutoMATICALLYGetNote.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1919
import edu.wpi.first.wpilibj2.command.Command;
2020

21+
import static org.carlmontrobotics.Config.CONFIG;
22+
2123
public class AutoMATICALLYGetNote extends Command {
2224
/** Creates a new AutoMATICALLYGetNote. */
2325
private Drivetrain dt;
@@ -125,6 +127,6 @@ public void end(boolean interrupted) {
125127
// Returns true when the command should end.
126128
@Override
127129
public boolean isFinished() {
128-
return intake.outtakeDetectsNote();
130+
return intake.outtakeDetectsNote() || CONFIG.isLimelightDisabled();
129131
}
130132
}

src/main/java/org/carlmontrobotics/commands/MoveToNote.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import org.carlmontrobotics.subsystems.Limelight;
1010
import org.carlmontrobotics.subsystems.LimelightHelpers;
1111

12+
import static org.carlmontrobotics.Config.CONFIG;
13+
1214
import edu.wpi.first.math.util.Units;
1315
import edu.wpi.first.wpilibj.Timer;
1416
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
@@ -54,6 +56,6 @@ public void end(boolean interrupted) {
5456
// Returns true when the command should end.
5557
@Override
5658
public boolean isFinished() {
57-
return timer.get() >= 0.5;
59+
return timer.get() >= 0.5 || CONFIG.isLimelightDisabled();
5860
}
5961
}

src/main/java/org/carlmontrobotics/subsystems/Limelight.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,4 @@ public double getOptimizedArmAngleRadsMT2() {
136136
public boolean seesTag() {
137137
return LimelightHelpers.getTV(SHOOTER_LL_NAME);
138138
}
139-
}
139+
}

0 commit comments

Comments
 (0)