Skip to main content

Module vision

Module vision 

Source
Expand description

Visual wake sources (spec 3.7 §7.10).

A camera, screen or browser stream evaluates its watch conditions on the device; the kernel sees only the events that pass. VisionWakeSource turns each into a WakeEvent and needs no new Wake variant:

PartHow
NameThe stream’s source name, such as conveyor-1: a sleeper waits on Wake::Queue { source: "conveyor-1" }
Keykeys::vision: queue:<source>:<session>:<track>:<condition>:<event>, so one track seen for forty frames wakes one process once, and a redelivery wakes nothing
FallbackWith no sleeper, a Trigger on the same Wake::Queue starts a Triggered process
PayloadThe event, label, score, track, frame (index, capture time, digest, size, artifact and version) and the top regions with a count of the rest, within WAKE_PAYLOAD_LIMIT (vision_payload)
DeliveryThe woken turn reads the payload as delimited data, not instructions (WakeReason::notice), and loads the frame through the vision tools on the governed path

The payload carries digests and artifact references, never pixels (spec 3.7 V-I15). No principal is set, so standing rules and Auto stay inert for the run a camera starts: a consequential call it makes is held for a person.

The kernel takes the source’s events through its own types (VisualWake), so a default build compiles no perception code. Feature vision adds the bridge from adk-vision: VisualWake: From<&adk_vision::WatchEvent>, and VisionWakeSource as an adk_vision::WatchSink.

§Example

use adk_kernel::{VisionWakeSource, VisualFrame, VisualRegion, VisualWake, WakeSource};

let source = VisionWakeSource::new("conveyor-1").unwrap();
let frame = VisualFrame::new(1203, chrono::Utc::now(), "sha256:0f3a", 1280, 720);
let wake = VisualWake::new("shift-1", "torn-seal", "detected", 7, "torn seal", 0.91, frame)
    .with_frames(3)
    .with_regions([VisualRegion::new([412.0, 220.5, 448.0, 251.0]).with_label("torn seal").with_track(7)]);
let event = source.event(&wake).unwrap();
assert_eq!(event.source, "conveyor-1");
assert_eq!(event.key, "queue:conveyor-1:shift-1:7:torn-seal:detected");
assert_eq!(event.payload["track"], 7);
assert_eq!(event.payload["regions"][0]["box"][0], 412.0);
assert!(event.payload.to_string().len() <= adk_kernel::WAKE_PAYLOAD_LIMIT);
assert_eq!(source.name(), "conveyor-1");

Structs§

VisionWakeSource
A WakeSource for one camera, screen or browser stream (spec 3.7 §7.10): each VisualWake published becomes a WakeEvent named after the stream and keyed keys::vision, which Wake::Queue { source } matches.
VisualFrame
The frame a visual wake names: its place in the stream, the digest of its encoded bytes, its size, and the artifact it is kept as.
VisualRegion
One region of a visual wake: its box in source pixels, label, score and track.
VisualWake
A watch condition that passed on a stream, as the kernel takes it: the condition, what happened, the track with its label and score, the frame, and the regions that met the condition in it, the track’s first.

Constants§

VISION_PAYLOAD_KIND
The kind of every visual wake payload.

Functions§

vision_payload
The payload of wake from the stream source, as compact JSON within WAKE_PAYLOAD_LIMIT bytes: kind (vision), source, session, condition, event, label, score, track, frames, frame (index, capturedAt, digest, width, height, artifact), regions (each box, label, score, track) and moreRegions, the count of regions left out.