# Examples What detections look like on the wire: each one in full, as SpiriSynq sends it to a reader that asks for the whole object (`sr_rehydrate`, or `synq topic rehydrate` on the command line), and the puts that carry an update. None of this is written by hand. `docs/examples/generate.py` builds each detection with SpiriDetect and writes out what SpiriSynq sends, and a test fails if these files fall behind the code. The comment at the top of each says what it is and turns the root-frame (ECEF) positions into latitude, longitude and height. ## The setup They all come from one aircraft, `drone1`, at 180 m above Ottawa, flying west: `drone1/airframe` : The aircraft, in ECEF, with ±1.5 m horizontal and ±3 m vertical accuracy (90%). `drone1/gimbal0` : A gimbal under it, looking 20° down and 30° right of the nose. `drone1/camera0` : A camera on the gimbal: 1280×720, about 80° across. `drone1/df0` : A radio direction finder's antenna, on the airframe. Each of its detections' `relative_to` links to one of these, so each one moves with the aircraft. ## A node's own report The aircraft reporting itself, at `drone1/detections/self`: a plain `Detection` at its airframe's origin, with its course and speed. `pose` is the airframe's place. ```{literalinclude} examples/self.yaml :language: yaml ``` ## A rangefinder hit The gimbal's rangefinder, 487.3 m out along the gimbal's axis. With a range there's a `pose`, at the end of the `ray`. Its accuracy is the aircraft's own plus the beam's: ±1 m along it and ±0.05° across it, which at this range is about ±0.4 m. ```{literalinclude} examples/rangefinder-hit.yaml :language: yaml ``` ## No return The same rangefinder a second later, with nothing in range: {meth}`~SpiriDetect.BearingDetection.clear`. Same topic, but no `mount`, no `ray` and no `pose`, until the next hit. ```{literalinclude} examples/rangefinder-no-return.yaml :language: yaml ``` ## A bearing without a range A radio direction finder's bearing to a 433.92 MHz transmitter, 62° left of the nose, ±5°. No range, so no `pose`. The `ray` still says where to look: a map draws a 5° cone from it. ```{literalinclude} examples/rdf-bearing.yaml :language: yaml ``` ## A box in a camera's picture A detector's box around a person, tracker id 17, so `drone1/detections/yolo/17`. {meth}`~SpiriDetect.BoxDetection.set_box` turns the box, through the camera's lens, into a bearing and an angular size, 2.5° by 6.5°. No range, so no `pose`. ```{literalinclude} examples/camera-box.yaml :language: yaml ``` ## A box with a range A car near the middle of the picture, where the gimbal's rangefinder points, so the producer passes its range to `set_box` and the box has a `pose`. ```{literalinclude} examples/camera-box-ranged.yaml :language: yaml ``` ## An update The person one frame later: the tracker has moved the box 6 pixels right and 2 down, and the score has risen to 0.88. The producer just sets the fields again; SpiriSynq sends each changed field as a put on `/`, and readers' mirrors apply them in place. `pose` stays None, and fields that didn't change, such as `label`, aren't sent. ```{literalinclude} examples/camera-box-update.yaml :language: yaml ``` ## Reclassified The radio bearing, once something works out the transmitter is a car's key fob. The topic doesn't change: what a thing is lives in `cot_type` and `label`, not in its key, so it's the same detection with two new values. ```{literalinclude} examples/rdf-reclassified.yaml :language: yaml ```