Skip to content

Commit d7e0ef9

Browse files
committed
feat: check if limelight is connected.
1 parent 0277306 commit d7e0ef9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
plugins {
22
id "java"
3-
id "edu.wpi.first.GradleRIO" version "2025.2.1"
3+
id "edu.wpi.first.GradleRIO" version "2025.3.1"
44
}
55

66
java {

src/main/java/frc/robot/subsystems/DriveSubsystem.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ public void periodic() {
114114
m_poseEstimator.update(Robot.isReal() ? m_gyro.getRotation2d() : new Rotation2d(m_gyroAngle),
115115
m_swerveModulePositions);
116116

117-
if (VisionConstants.kUseVision && Robot.isReal()) {
117+
boolean limelightReal = LimelightHelpers.getLatency_Pipeline(getName()) != 0.0;
118+
if (VisionConstants.kUseVision && Robot.isReal() && limelightReal) {
118119
// Update LimeLight with current robot orientation
119120
LimelightHelpers.SetRobotOrientation(VisionConstants.kLimelightName, m_poseEstimator.getEstimatedPosition().getRotation().getDegrees(), 0.0, 0.0, 0.0, 0.0, 0.0);
120121

@@ -135,6 +136,7 @@ public void periodic() {
135136
SmartDashboard.putNumber("gyro angle", m_gyro.getAngle());
136137
SmartDashboard.putNumber("odometryX", m_poseEstimator.getEstimatedPosition().getX());
137138
SmartDashboard.putNumber("odometryY", m_poseEstimator.getEstimatedPosition().getY());
139+
SmartDashboard.putBoolean("Limelight isreal", limelightReal);
138140

139141
// AdvantageScope Logging
140142
// max speed = 1 (for ease of use in AdvantageScope)

0 commit comments

Comments
 (0)