Skip to content

Commit d43f9dc

Browse files
Merge pull request #65 from Manchester-Central/megatag2-fix
oops
2 parents 048a5b2 + 4922e22 commit d43f9dc

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

src/main/java/com/chaos131/vision/LimelightCamera.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
import java.util.function.Supplier;
2020
import org.littletonrobotics.junction.Logger;
2121

22-
/** Implements a Camera behavior for the This is up to date for Limelight OS 2026.0 (Feb 17, 2026) */
22+
/**
23+
* Implements a Camera behavior for the This is up to date for Limelight OS 2026.0 (Feb 17, 2026)
24+
*/
2325
public class LimelightCamera extends AbstractChaosCamera {
2426
/** Limelight versions can help the implementation navigate features and calibration */
2527
public enum LimelightVersion {
@@ -351,19 +353,19 @@ public VisionData processMeasuredData(int idx) {
351353
m_poseDataMT2.deviations[0]);
352354

353355
if (m_poseData.averageTagDistance[idx] < m_megatag2Threshold) {
354-
return new VisionData(
355-
m_poseData.pose[idx],
356-
m_poseData.timestamps[idx],
357-
new double[] {m_poseData.deviations[idx], m_poseData.deviations[idx], 1},
358-
conf,
359-
m_name);
360-
} else {
361356
return new VisionData(
362357
m_poseDataMT2.pose[idx],
363358
m_poseDataMT2.timestamps[idx],
364359
new double[] {m_poseDataMT2.deviations[idx], m_poseDataMT2.deviations[idx], 1},
365360
conf2,
366361
m_name);
362+
} else {
363+
return new VisionData(
364+
m_poseData.pose[idx],
365+
m_poseData.timestamps[idx],
366+
new double[] {m_poseData.deviations[idx], m_poseData.deviations[idx], 1},
367+
conf,
368+
m_name);
367369
}
368370
}
369371

@@ -434,8 +436,11 @@ protected void LoadNTQueueToVisionData() {
434436
m_poseData.timestamps[idx] = timestampSeconds;
435437
} // End MT1
436438
if (mt1_poses.length > 0) {
437-
Logger.recordOutput(m_name+"/Mt1TagDistance", mt1_poses[mt1_poses.length-1].getDoubleArray()[idxTagDistance]);
438-
Logger.recordOutput(m_name+"/Mt1TagCount", mt1_poses[mt1_poses.length-1].getDoubleArray()[idxTagCount]);
439+
Logger.recordOutput(
440+
m_name + "/Mt1TagDistance",
441+
mt1_poses[mt1_poses.length - 1].getDoubleArray()[idxTagDistance]);
442+
Logger.recordOutput(
443+
m_name + "/Mt1TagCount", mt1_poses[mt1_poses.length - 1].getDoubleArray()[idxTagCount]);
439444
}
440445

441446
// Parse MegaTag2 Info
@@ -488,10 +493,12 @@ protected void LoadNTQueueToVisionData() {
488493
m_poseDataMT2.timestamps[idx] = timestampSeconds;
489494
} // End MT2
490495
if (mt2_poses.length > 0) {
491-
Logger.recordOutput(m_name+"/Mt2avgTagDistance", mt2_poses[mt2_poses.length-1].getDoubleArray()[idxTagDistance]);
492-
Logger.recordOutput(m_name+"/Mt2TagCount", mt2_poses[mt2_poses.length-1].getDoubleArray()[idxTagCount]);
496+
Logger.recordOutput(
497+
m_name + "/Mt2avgTagDistance",
498+
mt2_poses[mt2_poses.length - 1].getDoubleArray()[idxTagDistance]);
499+
Logger.recordOutput(
500+
m_name + "/Mt2TagCount", mt2_poses[mt2_poses.length - 1].getDoubleArray()[idxTagCount]);
493501
}
494-
495502
}
496503

497504
public static CameraSpecs LL3GSpecs() {

0 commit comments

Comments
 (0)