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:
| Part | How |
|---|---|
| Name | The stream’s source name, such as conveyor-1: a sleeper waits on Wake::Queue { source: "conveyor-1" } |
| Key | keys::vision: queue:<source>:<session>:<track>:<condition>:<event>, so one track seen for forty frames wakes one process once, and a redelivery wakes nothing |
| Fallback | With no sleeper, a Trigger on the same Wake::Queue starts a Triggered process |
| Payload | The 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) |
| Delivery | The 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§
- Vision
Wake Source - A
WakeSourcefor one camera, screen or browser stream (spec 3.7 §7.10): eachVisualWakepublished becomes aWakeEventnamed after the stream and keyedkeys::vision, whichWake::Queue { source }matches. - Visual
Frame - 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.
- Visual
Region - One region of a visual wake: its box in source pixels, label, score and track.
- Visual
Wake - 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
kindof every visual wake payload.
Functions§
- vision_
payload - The payload of
wakefrom the streamsource, as compact JSON withinWAKE_PAYLOAD_LIMITbytes:kind(vision),source,session,condition,event,label,score,track,frames,frame(index,capturedAt,digest,width,height,artifact),regions(eachbox,label,score,track) andmoreRegions, the count of regions left out.