Skip to content

Commit ff89d51

Browse files
committed
add tags_state logging tunable
1 parent e1e03ed commit ff89d51

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

components/vision.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ class VisualLocalizer(HasPerLoopCache):
7272

7373
reproj_error_threshold = tunable(2.0)
7474

75+
tags_state = tunable("none")
76+
7577
def __init__(
7678
self,
7779
# The name of the camera in PhotonVision.
@@ -323,6 +325,8 @@ def execute(self) -> None:
323325
for results in all_results:
324326
# if results didn't see any targets
325327
if not results.getTargets():
328+
self.tags_state = "none"
329+
326330
return
327331

328332
# if we have already processed these results
@@ -353,6 +357,9 @@ def execute(self) -> None:
353357
self.rotation_vision_uncertainty_multi_tag,
354358
),
355359
)
360+
self.tags_state = "multi"
361+
else:
362+
self.tags_state = "none"
356363

357364
if self.should_log:
358365
# Multitag results don't have best and alternates
@@ -369,6 +376,7 @@ def execute(self) -> None:
369376
or target.getBestCameraToTarget().translation().norm()
370377
> self.CAMERA_MAX_RANGE
371378
):
379+
self.tags_state = "none"
372380
continue
373381

374382
heading = self.heading_buffer.sample(results.getTimestampSeconds())
@@ -396,6 +404,8 @@ def execute(self) -> None:
396404
),
397405
)
398406

407+
self.tags_state = "single"
408+
399409
if self.should_log:
400410
self.best_log.setPose(pose)
401411

0 commit comments

Comments
 (0)