Skip to content

Commit 75ee66f

Browse files
authored
Merge pull request #476 from thedropbears/ignore-bad-tags
ignore opposing apriltags on wall
2 parents 9eca1ee + a7aa974 commit 75ee66f

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
@@ -20,6 +20,7 @@
2020
from wpimath.interpolation import TimeInterpolatableRotation2dBuffer
2121

2222
from components.chassis import ChassisComponent
23+
from utilities import game
2324
from utilities.caching import HasPerLoopCache, cache_per_loop
2425
from utilities.functions import clamp
2526
from utilities.game import APRILTAGS_2D, apriltag_layout
@@ -339,7 +340,16 @@ def execute(self) -> None:
339340

340341
if results.multitagResult:
341342
self.last_timestamp = timestamp
343+
344+
bad_tags = [12, 13, 16] if game.is_red() else [1, 2, 3]
345+
concatenated_list = bad_tags + results.multitagResult.fiducialIDsUsed
346+
if len(set(concatenated_list)) != len(concatenated_list):
347+
self.tags_state = "none"
348+
self.has_multitag = False
349+
continue
350+
342351
self.has_multitag = True
352+
343353
p = results.multitagResult.estimatedPose
344354
pose = (Pose3d() + p.best + camera_to_robot).toPose2d()
345355
reprojectionErr = p.bestReprojErr

0 commit comments

Comments
 (0)