# Getting Started ## Installation SpiriDetect isn't published yet. Until it is, depend on a checkout: ```console uv add --editable ../SpiriDetect ``` To work on it: ```console uv sync uv run pytest ``` It needs Python 3.13 and SpiriSynq 0.6 or later. ## Publishing a detection A producer makes one detection per thing it sees, at a topic from {func}`~SpiriDetect.detection_topic`: the producer's name, then the thing's id. It updates that object as the thing moves, and closes it when the thing is gone. A camera tracker, for example, reports each tracked box through the camera's lens: ```python from SpiriSynq.link import Link from SpiriDetect import BoxDetection, PixelBox, detection_topic person = BoxDetection( detection_topic("yolo", str(track_id)), synq_authoritive=True, relative_to=Link.to(camera), label="person", confidence=0.83, ) person.set_box(PixelBox(412, 180, 36, 90, 1280, 720), camera.intrinsics) # Each frame the tracker still has it: person.set_box(new_box, camera.intrinsics) person.time = frame_time # When the tracker drops it: person.close() ``` `relative_to` links the detection to the camera's own `Position`, so as the camera (or the gimbal, or the aircraft) moves, the detection's `ray` moves with it, with no work from the producer. ## Reporting a node's own position A node reports itself at {func}`~SpiriDetect.self_topic`, `/detections/self`, as a plain {class}`~SpiriDetect.Detection`: ```python from SpiriSynq.example_types.position import Pose from SpiriSynq.link import Link from SpiriDetect import Detection, self_topic me = Detection(self_topic(), synq_authoritive=True, relative_to=Link.to(airframe)) me.mount = Pose() # at the airframe's origin me.course, me.speed = 270.0, 12.5 ``` ## Reading detections Every detection matches `*/detections/*/*`, and a node's own report is `/detections/self`. Mirror one with SpiriSynq, as any other object: ```python from SpiriDetect import Detection d = Detection.from_topic("drone1/detections/yolo/17") if d.pose is not None: print(d.pose.offset.to_geodetic(), d.pose.accuracy) ``` Check `pose` before using it: a detection without a place, such as a bearing without a range, has none. Check {meth}`~SpiriDetect.Detection.is_stale` before trusting an old one. A watcher that keeps the live set of detections for readers is planned; see {doc}`design`.