Trait Subsystem

Source
pub trait Subsystem: Sized {
    type Config: Debug + Send + Sync + Clone + 'static;
    type Output: Send + 'static;
    type Error: Debug + Send + 'static;

    const NAME: &'static str;

    // Required methods
    async fn init() -> Result<Self, Self::Error>;
    fn preproc(
        cam_config: Camera,
        pipeline: &Pipeline,
    ) -> Result<(Element, Element), Self::Error>;
    async fn process(
        &self,
        manager: SubsysManager,
        nt: NtConn,
        cam_config: Camera,
        rx: Receiver<Option<Vec<u8>>>,
    ) -> Result<Self::Output, Self::Error>;
}
Expand description

A processing subsystem

Subsystems implement different computer vision tasks, such as AprilTags or object detection.

A subsystem should be generic, not something that is only used for some specific aspect of a game. For example, note detection for the 2024 game, Crescendo, would go under the object detection subsystem, rather than a brand new subsystem.

Make sure to pay attention to and respect each subsystem’s documentation and structure.

Required Associated Constants§

Source

const NAME: &'static str

Required Associated Types§

Source

type Config: Debug + Send + Sync + Clone + 'static

Source

type Output: Send + 'static

Source

type Error: Debug + Send + 'static

Required Methods§

Source

async fn init() -> Result<Self, Self::Error>

Initialize the subsystem

Source

fn preproc( cam_config: Camera, pipeline: &Pipeline, ) -> Result<(Element, Element), Self::Error>

Initialize the subsystem’s preprocessing pipeline chunk

Source

async fn process( &self, manager: SubsysManager, nt: NtConn, cam_config: Camera, rx: Receiver<Option<Vec<u8>>>, ) -> Result<Self::Output, Self::Error>

Process a frame

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§