Class AbstractTargetProcessor<T extends VisionResult>

  • Type Parameters:
    T - VisionResult type of this AbstractTargetProcessor
    All Implemented Interfaces:
    TargetProcessor
    Direct Known Subclasses:
    ClosestPairTargetProcessor, ClosestTargetProcessor

    public abstract class AbstractTargetProcessor<T extends VisionResult>
    extends java.lang.Object
    implements TargetProcessor
    Base class with common functionality used by TargetProcessors. In particular, this provides methods to store a result, and access it via PID sources.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract T computeResult​(java.util.List<org.opencv.core.Rect> targets)  
      abstract T getDefaultValue()  
      T getLastResult()
      Get the most recent result of this processor.
      void process​(java.util.List<org.opencv.core.Rect> targets)
      Extract the result type from a list of rectangles found.
      edu.wpi.first.wpilibj.PIDSource xPID()
      Get a PID source which tracks the x-coordinate of the target.
      edu.wpi.first.wpilibj.PIDSource yPID()
      Get a PID source which tracks the y-coordinate of the target.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractTargetProcessor

        public AbstractTargetProcessor()
    • Method Detail

      • computeResult

        public abstract T computeResult​(java.util.List<org.opencv.core.Rect> targets)
        Parameters:
        targets - list of targets to compute
        Returns:
        {T}
      • getDefaultValue

        public abstract T getDefaultValue()
        Returns:
        {T}
      • process

        public final void process​(java.util.List<org.opencv.core.Rect> targets)
        Description copied from interface: TargetProcessor
        Extract the result type from a list of rectangles found.
        Specified by:
        process in interface TargetProcessor
        Parameters:
        targets - The list of targets found.
      • getLastResult

        public T getLastResult()
        Get the most recent result of this processor. If no result has been produced yet, returns the default value.
        Returns:
        The most recent result.
      • xPID

        public edu.wpi.first.wpilibj.PIDSource xPID()
        Get a PID source which tracks the x-coordinate of the target.
        Returns:
        A PID source tracking the x-coordinate of the target.
      • yPID

        public edu.wpi.first.wpilibj.PIDSource yPID()
        Get a PID source which tracks the y-coordinate of the target.
        Returns:
        A PID source tracking the y-coordinate of the target.