# Kinds of Detection Each kind is a subclass that adds what its sensor knows. A reader that only knows `Detection` can still read every kind: the base fields mean the same thing on all of them. ## Detection The base, for anything with a place: a node's report of itself, a marker someone dropped on a map. The producer sets `mount` (and `relative_to`) and the fields of {doc}`model`. ## BearingDetection Something seen along a direction from a sensor: a rangefinder hit, a radio or acoustic bearing. Its default `cot_type` is `b-m-p-s-p-i`, a sensor point of interest. ### The bearing `relative_to` links to the sensor's frame, FRD: x forward, where the sensor points; y right; z down. The bearing is in that frame: `azimuth` : Degrees to the right of the sensor's x axis. `elevation` : Degrees above it. `range` : Metres along the bearing, or None for a bearing alone. Set them together with {meth}`~SpiriDetect.BearingDetection.set_bearing`, which sets the `mount`: oriented along the bearing, so the detection's own x axis is the ray, and `range` metres out along it. {meth}`~SpiriDetect.BearingDetection.clear` says nothing is seen right now. ### Ray and pose `ray` : The sensor's place, facing down the bearing, with the sensor's accuracy. It's there with or without a range, so a map can draw the cone (from `ray` and `bearing_accuracy`) either way. `pose` : The thing's place: the end of the ray. Only with a range; without one it's None. ### Accuracy Two errors are the beam's own, both at 90%: `range_accuracy` : ± metres along the bearing. `bearing_accuracy` : ± degrees off it: the cone's half-angle. With a range, the beam's error is added to the sensor's own (`Accuracy` sums independent errors in quadrature). {func}`~SpiriDetect.beam_accuracy` splits it between horizontal and vertical by the beam's elevation above the horizon: - the error along the beam is mostly horizontal for a level beam and mostly vertical for a steep one; - the error across the beam, `range × tan(bearing_accuracy)`, is horizontal one way and partly vertical the other, so horizontal takes all of it and vertical takes the part the elevation tips up. "Up" is away from the earth's centre, within about 0.2° of the ellipsoid's normal: plenty to split an error by. A sensor that isn't on the globe in ECEF, such as one in a local test frame, is taken as level. ## BoxDetection A box around something in a camera's picture: a detector's output. A `BearingDetection` through the camera's lens. `relative_to` links to the camera. {meth}`~SpiriDetect.BoxDetection.set_box` takes the box (a {class}`~SpiriDetect.PixelBox`, in pixels from the image's top-left corner) and the camera's lens, as SpiriCamera's `Camera.intrinsics` has it, and sets: - the bearing, through the box's centre; - `angular_width` and `angular_height`, the box's size in degrees; - `box`, as given. A lens measured at another resolution is scaled to the box's image, assuming the same aspect. There's usually no range, so no `pose`: a map draws a narrow cone down the `ray`. Pass `range` to `set_box` when something else knows it. `label` is the detector's class and `confidence` its score. `cot_type` is None by default: mapping its classes to CoT types is the producer's call. The tracker's id is the detection's id, one object per tracked thing; a detector without a tracker makes a new detection per box.