Skip to main content

ViewStateProvider

Trait ViewStateProvider 

Source
pub trait ViewStateProvider:
    Send
    + Sync
    + 'static {
    // Required method
    fn poll(&self, ctx: &MotionPollContext<'_>) -> MotionReport;
}
Expand description

User-implementable trait: provides camera motion information each frame.

Required when CameraMode::Observed is configured.

§Implementation categories

  • Telemetry providers: poll ONVIF/serial, populate ptz field.
  • Egomotion providers: run optical flow or feature matching on the frame, populate frame_transform field.
  • External providers: receive transforms or hints from an outside system.

§Performance

poll() is called on the stage thread, synchronously, before any stage executes. Its latency adds directly to every frame’s pipeline latency.

  • Telemetry providers should pre-fetch asynchronously and return cached data.
  • Egomotion providers run computation directly (typically 1–5ms).
  • External providers should return pre-computed data.

Required Methods§

Source

fn poll(&self, ctx: &MotionPollContext<'_>) -> MotionReport

Called once per frame. Return the current motion report.

Implementors§