Metadata-Version: 2.5
Name: SpiriDetect
Version: 0.1.0
Summary: Detections for SpiriSynq: things in the world, where they are, how sure we are, and who saw them
Author-email: Alex Davies <traverse.da@gmail.com>
License-Expression: MIT
Requires-Python: >=3.13
Requires-Dist: spirisynq>=0.6.0
Description-Content-Type: text/markdown

# SpiriDetect

Detections are the Spiri platform's common language. Anything that finds
something publishes a detection; anything that wants to know what's out there
reads detections; neither needs to know about the other.

Documentation: https://spiri-robotics.github.io/SpiriDetect/

A detection is a live [SpiriSynq](https://github.com/spiri-robotics/SpiriSynq)
`Position`: one object per thing, at `<host>/detections/<producer>/<id>`,
updated in place as it moves and closed when it's gone. It carries where the
thing is and how accurately (`pose`, `pose.accuracy` at 90%), what it is
(`cot_type`, `label`), how sure the producer is (`confidence`, or None for
"not given"), when it was seen (`time`, `stale_after`), and how it's moving
(`course`, `speed`). A node's own position report is a plain `Detection` at
`<host>/detections/self` (`self_topic()`).

A detection doesn't promise a place: `pose` is None while the producer
doesn't know where the thing is, as for a bearing or a camera box without a
range. Those still carry their `ray`, the sensor's place facing down the
bearing, so a map can draw where to look.

## Kinds

- `Detection`: the base, for anything with a place, such as a node's
  report of itself.
- `BearingDetection`: a direction from a sensor (`ray`), with a range, and
  so a `pose`, when there is one: a rangefinder hit, a radio or acoustic
  bearing.
- `BoxDetection`: a box in a camera's picture, a bearing through the
  camera's lens with an angular footprint.

```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)
```

See [NOTES-design.md](NOTES-design.md) for what's decided and what's next.

## Development

```console
uv sync          # creates .venv and uv.lock; commit uv.lock
make check       # what CI runs: lint, tests, docs
```

## Releasing

1. Move the `## Unreleased` entries in `CHANGES.md` under the new version.
2. Bump `version` in `pyproject.toml`, then `uv lock`.
3. Tag `vX.Y.Z` and push the tag. CI then:
   - publishes the package to PyPI (trusted publishing; the tag must match the version);
   - attaches the docs' controlled PDF to the release.

## First-time GitHub setup

Docs are published to GitHub Pages by `.github/workflows/docs.yml`. Turn it on once, in
**Settings → Pages → Build and deployment → Source: GitHub Actions**.

## Template

Generated from [SpiriProjectTemplates](https://github.com/spiri-robotics/SpiriProjectTemplates).
Pull in template changes with `uvx copier update`.

## License
Licensed under the MIT License.
