# The Detection Model ## Topics Detections live at `/detections//`: `` : The node that publishes it, as SpiriSynq's base topic: a robot for what its own sensors find, a ground station or gateway for what it finds or relays. `` : What found it, such as `yolo` or `rangefinder`. `` : The thing, as the producer knows it: a tracker's id, a gimbal's number. {func}`~SpiriDetect.detection_topic` builds the topic and checks that the producer and the id are one key chunk each, so `*/detections/*/*` finds every detection and nothing else. A node's report of itself is the one exception: `/detections/self`, from {func}`~SpiriDetect.self_topic`. Self is a place, not a kind: it's an ordinary `Detection`, and `self` can't be a producer's name. What a thing *is* stays out of the topic: `cot_type` and `label` are fields, so a detection keeps its identity when it's reclassified. ## Lifecycle A detection is live, not a record: 1. The producer **creates** it, as the authoritative copy (`synq_authoritive=True`), when it first sees the thing. 2. It **updates** it in place: a new bearing, a new box, a better classification, a new `time`. Readers' mirrors follow. 3. It **closes** it when the thing is gone, which removes it from every reader. A detection that just stops being updated isn't closed. Readers use `time` and `stale_after` to stop believing it. ## Place A detection is a SpiriSynq `Position`, so its place comes from the pose tree: `relative_to` : What it's measured from: usually a `Link` to the sensor's own `Position`. `mount` : Where it is in that frame. `pose` : Where it is in the root frame (ECEF), computed from the two and kept current as the sensor moves. **A detection doesn't promise a place.** `pose` is where the thing is, or None while that's unknown. It's never a stand-in such as the sensor's own place. "Has a pose" is the one test for "located". A partial fix, such as a bearing without a range, lives in a field of its own (a bearing's `ray`), and anything that needs a point skips detections without one. ## Accuracy `pose.accuracy` is a SpiriSynq `Accuracy`: 90% bounds, a horizontal radius (CEP90) and a vertical half-height (LEP90), in metres. There's a 90% chance the thing is inside that cylinder. Cursor on Target's `ce` and `le` are 1σ instead. The TAK bridge converts them; see {doc}`cot`. ## Confidence `confidence` is the producer's own, 0 to 1, that the thing is there and is what it says: a detector's score, for example. None means "not given", which is honest for most sources; CoT has no such field. It isn't the position's accuracy: a detector can be sure it saw a person and have no idea how far away they are. ## Time `Pose` has no timestamp, so time is the detection's own: `time` : When the current state was observed, in Unix seconds. `stale_after` : How many seconds past `time` a reader should stop believing it if nothing updates it, as CoT's stale time. None means it holds until it's closed. {meth}`~SpiriDetect.Detection.is_stale` answers "is it stale at this time?". ## Motion `course` (degrees from true north) and `speed` (m/s) are over the ground, as CoT's ``, for a thing whose motion the producer knows. The thing's heading, if it has one, is the pose's orientation. ## Fields | Field | Type | Meaning | | --- | --- | --- | | `pose` | `Pose` or None | Where the thing is, in the root frame, with its 90% accuracy | | `cot_type` | str or None | Cursor on Target's type, such as `a-u-G` | | `label` | str or None | The producer's name for it: a class name, a callsign | | `confidence` | float or None | 0 to 1, the producer's; None: not given | | `time` | float or None | When observed, Unix seconds | | `stale_after` | float or None | Seconds past `time` it holds; None: until closed | | `course` | float or None | Degrees from true north, over the ground | | `speed` | float or None | m/s, over the ground |