Skip to content

feat: support AprilTag 36h11 for ARENA XR scene relocalization - #167

Draft
mwfarb with Copilot wants to merge 3 commits into
mainfrom
copilot/support-apriltags
Draft

feat: support AprilTag 36h11 for ARENA XR scene relocalization#167
mwfarb with Copilot wants to merge 3 commits into
mainfrom
copilot/support-apriltags

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown

ARENA uses tag36h11 AprilTags (tag #0 = scene origin) for physical relocalization. The commonly referenced jp.keijiro.apriltag package only ships tagStandard41h12 native binaries, making it unusable for ARENA without recompilation. This PR bundles a self-contained native plugin compiled from AprilRobotics/apriltag source with 36h11 enabled, plus a new ArenaAprilTag MonoBehaviour for XR relocalization.

Native plugin (Runtime/AprilTag/Plugin/)

  • libArenaAprilTag.so (Linux x86-64) — compiled from upstream apriltag source, exports tag36h11_create/destroy alongside the full detector API
  • Named ArenaAprilTag (not AprilTag) to avoid conflicts if jp.keijiro.apriltag is also installed
  • Plugin/README.md — cmake build instructions for Windows, macOS, iOS, Android

C# apriltag layer (Runtime/AprilTag/)

Self-contained P/Invoke layer adapted from the keijiro package (BSD-2-Clause attributed), with two key changes:

  • Interop/Family.cs — wires tag36h11_create/destroy instead of tagStandard41h12
  • Unity/TagDetector.cs — detector configured for tag36h11; uses Unity Jobs + Burst for pose estimation

ArenaAprilTag MonoBehaviour (Runtime/ArenaAprilTag.cs)

// Add to XR rig or main camera. No additional setup required when
// ArenaClientScene is present — sceneRoot defaults to its transform.
[DisallowMultipleComponent]
public class ArenaAprilTag : MonoBehaviour
{
    public float tagSize = 0.15f;       // physical tag size in meters
    public int   originTagId = 0;       // ARENA origin tag (default: 0)
    public int   decimation = 2;        // speed/accuracy trade-off
    public bool  smoothing = true;      // EMA smoothing across frames
    public float smoothingFactor = 0.2f;
    public Transform sceneRoot;         // falls back to ArenaClientScene.Instance
}

Each frame: captures WebCamTexture, detects 36h11 tags, and when tag originTagId is seen, repositions sceneRoot so the physical tag maps to (0,0,0) / identity rotation in Unity world space (with optional EMA smoothing). Pose math uses the tag world-space inversion:

newRootRot = Inverse(tagWorldRot)
newRootPos = -(Inverse(tagWorldRot) * tagWorldPos)

Other

  • .gitattributes — marks .so/.dll/.a/.bundle as binary
  • Third Party Notices.md — adds AprilRobotics/apriltag and keijiro attributions

Copilot AI linked an issue Jul 18, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add support for 36h11 apriltags in XR feat: support AprilTag 36h11 for ARENA XR scene relocalization Jul 18, 2026
Copilot AI requested a review from mwfarb July 18, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

support apriltags

2 participants