7. SpiriDetect: design notes

7.1. Decided

  • Detections are live. One SpiriSynq object per thing, a Position in the pose tree, updated in place as it moves and closed when it’s gone. This replaces the charter’s original “immutable, timestamped claim, never edited” model, which predated SpiriSynq; the charter now says the same.

  • Where they live. <host>/detections/<producer>/<id>, one key chunk each (detection_topic()), so */detections/*/* finds them all. A node’s own position report is <host>/detections/self (self_topic()). Self is a place, not a kind: an ordinary Detection, so there’s no SelfDetection. What a self report carries beyond the base (course, speed) is just as true of any moving thing, so it’s on the base, as CoT’s <track> is on any event.

  • What it is stays out of the key. cot_type (Cursor on Target’s type) and label are fields, so a detection keeps its identity when it’s reclassified. Producers set only the “what”; affiliation is out of scope until we’ve met commanders.

  • Accuracy is 90%. pose.accuracy is CEP90/LEP90; CoT’s ce/le are 1σ, and the TAK bridge converts.

  • Confidence is the producer’s, 0 to 1, and None (“not given”) is valid. It’s not the position’s accuracy.

  • Time is the detection’s own. Pose has no timestamp, so time (Unix seconds of the observation) and stale_after (CoT’s stale, as a duration) are on the detection.

  • A detection doesn’t promise a place. pose is where the thing is, or None while that’s unknown, never a stand-in like the sensor’s place. “Has a pose” is the one test for “located”; there’s no flag beside it. A partial fix lives in its own field (a bearing’s ray), and bridges that need a point skip what has none.

  • Richer inside, lossy at bridges. Rays, angular footprints and boxes stay in the model; CoT is a projection made at SpiriTak. Never trim the model to fit CoT.

  • SpiriDetect doesn’t handle CoT. It borrows CoT’s vocabulary (cot_type, stale, track) and nothing else. SpiriTak owns the mapping both ways, reads detections untyped (no dependency either way), and publishes what TAK says as its own TakPosition at <gcs>/tak/<uid>, not as detections.

7.2. Kinds

  • Detection: the base, including a node’s report of itself.

  • BearingDetection: a ray from a sensor frame (azimuth/elevation in its FRD frame), with an optional range. The mount is oriented along the ray, so the detection’s x axis is the bearing. ray is the sensor’s place facing down the bearing, with or without a range, and bearing_accuracy is the cone. With a range, pose is the thing, the beam’s error (range_accuracy, bearing_accuracy) added to the sensor’s, split by the beam’s elevation above the horizon (geocentric up, within ~0.2° of the ellipsoid’s normal). Without one, pose is None.

  • BoxDetection: a box through a camera’s lens, as a bearing plus angular_width/angular_height. The tracker’s id is the detection’s id.

7.3. Fusion

Not built yet. From the charter (2 Nov, the authority), the WIP spec (Aug, partly superseded), SpiriTak’s notes and the IDEaS RF fusion proposal.

7.3.1. Decided

  • Identity is assembled, never owned. No canonical track, no node that mints “the car”. No sensor sees enough to know; the node best placed to know is the one most likely to be out of range; an identity authority’s absence blinds everyone. Two clients can hold different pictures, and both are valid.

  • The algorithm isn’t frozen into the protocol. Matching is the one computation that keeps improving (coarse matcher, then a model trained on the site’s data, then a better one). The detection and the interface are fixed; strategies are pluggable, and a better one is a deploy.

  • Fusion nodes are ordinary consumers. They mirror detections, decide, and publish their results as claims of their own. They never edit another producer’s detection, which also keeps every field to one writer (SpiriSynq doesn’t handle concurrent writers yet).

  • Claims beside observations. An enrichment (“ID1’s plate is ABC”) refers to one detection and may arrive seconds late, or never. A link (“ID1 is ID2”) refers to two or more and has the same standing as any observation. The network works with no enrichers and no fusion at all.

  • Disagreement is reported, not settled. “ID1 is ID2” and its contradiction can both exist; confidence is what a client filters, merges and chooses by.

  • Ids are UUIDs, minted by the owner. Kept as long as the producer holds the thing; lost and re-acquired is honestly a new detection. Links refer to detections by id, so ids are never reused. A tracker’s number is not an id (they restart from 1 and get reused); it becomes a field. Ids the thing already has stay, such as self.

  • The read side groups, it doesn’t own. A read-only, filterable view (the spec’s DetectionSet) groups detections into object-views. Seeing a link merges its references’ groups. A group has no id of its own; it’s reached through any member. A client that missed a link holds two groups where the network holds one: the model, not an error. Raw detections stay readable without it.

  • Staleness is the consumer’s. A node that’s been shot down sends no close, so consumers judge by age (time, stale_after), not by deletion. Closing is a tidy shutdown, not correctness. Stale is worth showing (“we lost contact”), not hiding.

7.3.2. Open

  • What a link looks like. References as topic paths (the RF proposal’s “a topic-path field pointing at the other object”) or UUIDs; its confidence and time; whether it can say “not the same”.

  • Where links and enrichments live. The spec had them under the detection’s own UUID topic, which conflicts with <host>/detections/<producer>/<id>. Probably under the fusion node’s own host, as any claim.

  • Enrichments: a claim type or a detection kind? The spec has one generic record (kind, refs, payload, source); the code has subclasses and takes attribution from the topic. Decide how enrichments fit.

  • What a fused thing publishes. If each client assembles its own picture, what does SpiriTak send TAK as “the car”? SpiriTak sends fusion results as new information, which suggests a fusion node also publishes the fused thing as an ordinary detection, linked to its inputs. Not yet a rule.

  • Tasking (“go look here”) is in scope as a claim; nothing more is designed.

  • Algorithms we have: SpiriSynq’s fuse_positions() (inverse-variance weighting, for observations already known to be one thing) and the RF proposal’s demo (triangulate DF bearings into a fix weighted by quality and age; successive fixes become a live emitter track). Matching itself is for strategy authors.

  • SpiriSynq’s charter disagrees. It says sensors publish “into a track’s topic” and an identification engine writes identity back so every consumer “sees the same truth”: the canonical track this rejects. The SpiriSynq vs ROS 2 comparison quotes it. Both need updating.

7.4. Next

  • Move SpiriMav onto it. The gimbal rangefinder’s BearingDetection in spiri_mav/gimbal.py becomes a subclass of this one (keeping status, min, max), at <robot>/detections/rangefinder/<gimbal> instead of <robot>_gimbal<id>_range. SpiriMav publishes <robot>/detections/self. The debug map and HUD follow the new keys.

  • A read side. A watcher over */detections/** that keeps the live set (and drops stale ones) for maps and fusion, per the charter’s assembly layer. SpiriTak keeps its own and needn’t move onto it.

  • UUID ids. id defaults to a fresh UUID; BoxDetection gets a track_id field. Decide whether the rangefinder (one object per sensor, whatever the beam hits) is the exception. Update the docs and examples.

  • Links and enrichments, once the open questions under Fusion are settled; then the read side’s grouping on top of them.

  • A known-size prior could give a box a rough range, with honestly large bounds; later and optional.

  • Packaging: 0.1.0 is the first release (GitHub repo, PyPI, docs).