WPILibC++ 2024.3.2
frc::VisionRunner< T > Class Template Reference

A vision runner is a convenient wrapper object to make it easy to run vision pipelines from robot code. More...

#include <vision/VisionRunner.h>

Inheritance diagram for frc::VisionRunner< T >:
frc::VisionRunnerBase

Public Member Functions

 VisionRunner (cs::VideoSource videoSource, T *pipeline, std::function< void(T &)> listener)
 Creates a new vision runner. More...
 
virtual ~VisionRunner ()=default
 
- Public Member Functions inherited from frc::VisionRunnerBase
 VisionRunnerBase (cs::VideoSource videoSource)
 Creates a new vision runner. More...
 
 ~VisionRunnerBase ()
 
 VisionRunnerBase (const VisionRunnerBase &)=delete
 
VisionRunnerBaseoperator= (const VisionRunnerBase &)=delete
 
void RunOnce ()
 Runs the pipeline one time, giving it the next image from the video source specified in the constructor. More...
 
void RunForever ()
 A convenience method that calls runOnce() in an infinite loop. More...
 
void Stop ()
 Stop a RunForever() loop. More...
 

Protected Member Functions

void DoProcess (cv::Mat &image) override
 
virtual void DoProcess (cv::Mat &image)=0
 

Detailed Description

template<typename T>
class frc::VisionRunner< T >

A vision runner is a convenient wrapper object to make it easy to run vision pipelines from robot code.

The easiest way to use this is to run it in a std::thread and use the listener to take snapshots of the pipeline's outputs.

See also
VisionPipeline

Constructor & Destructor Documentation

◆ VisionRunner()

template<typename T >
frc::VisionRunner< T >::VisionRunner ( cs::VideoSource  videoSource,
T *  pipeline,
std::function< void(T &)>  listener 
)

Creates a new vision runner.

It will take images from the
videoSource
, send them to the pipeline, and call the
listener
when the pipeline has finished to alert user code when it is safe to access the pipeline's outputs.

Parameters
videoSourceThe video source to use to supply images for the pipeline
pipelineThe vision pipeline to run
listenerA function to call after the pipeline has finished running

◆ ~VisionRunner()

template<typename T >
virtual frc::VisionRunner< T >::~VisionRunner ( )
virtualdefault

Member Function Documentation

◆ DoProcess()

template<typename T >
void frc::VisionRunner< T >::DoProcess ( cv::Mat &  image)
overrideprotectedvirtual

Implements frc::VisionRunnerBase.


The documentation for this class was generated from the following files: