Class AbstractVisionConnector<T extends VisionResult>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected edu.wpi.first.networktables.NetworkTableEntry m_foundTarget  
      protected T m_lastResult  
      protected edu.wpi.first.networktables.NetworkTableEntry m_lastResultTimestamp  
      protected edu.wpi.first.networktables.NetworkTable m_table  
      protected edu.wpi.first.networktables.NetworkTableEntry m_xAbs  
      protected edu.wpi.first.networktables.NetworkTableEntry m_xError  
      protected edu.wpi.first.networktables.NetworkTableEntry m_yAbs  
      protected edu.wpi.first.networktables.NetworkTableEntry m_yError  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractVisionConnector​(java.lang.String subTableName, edu.wpi.first.networktables.NetworkTableInstance inst)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract T getDefaultValue()  
      T getLastResult()  
      protected abstract void next​(edu.wpi.first.networktables.NetworkTable table, java.lang.String key, edu.wpi.first.networktables.NetworkTableEntry entry, edu.wpi.first.networktables.NetworkTableValue value, int flags)
      evaluate and process the results in NetworkTables to my lastResult
      void publish()
      publish VisionResult values to corresponding NetworkTable Entries should be overriden and supered by any children of type T extends VisionResult
      protected VisionResult retrieve()
      retrieve a VisionResult from NetworkTable Entries should be overriden and supered by any children of type T extends VisionResult
      void subscribe()
      add listener for the lastResultTimestamp entry in NetworkTables process the next result on an update
      void unsubscribe()
      remove listener for the lastResultTimestamp entry in NetworkTables
      void updateResult​(T result)  
      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
    • Field Detail

      • m_xError

        protected final edu.wpi.first.networktables.NetworkTableEntry m_xError
      • m_yError

        protected final edu.wpi.first.networktables.NetworkTableEntry m_yError
      • m_xAbs

        protected final edu.wpi.first.networktables.NetworkTableEntry m_xAbs
      • m_yAbs

        protected final edu.wpi.first.networktables.NetworkTableEntry m_yAbs
      • m_foundTarget

        protected final edu.wpi.first.networktables.NetworkTableEntry m_foundTarget
      • m_lastResultTimestamp

        protected final edu.wpi.first.networktables.NetworkTableEntry m_lastResultTimestamp
      • m_table

        protected edu.wpi.first.networktables.NetworkTable m_table
    • Constructor Detail

      • AbstractVisionConnector

        protected AbstractVisionConnector​(java.lang.String subTableName,
                                          edu.wpi.first.networktables.NetworkTableInstance inst)
    • Method Detail

      • subscribe

        public void subscribe()
        add listener for the lastResultTimestamp entry in NetworkTables process the next result on an update
        Specified by:
        subscribe in interface VisionConnector
      • unsubscribe

        public void unsubscribe()
        remove listener for the lastResultTimestamp entry in NetworkTables
        Specified by:
        unsubscribe in interface VisionConnector
      • getDefaultValue

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

        public void updateResult​(T result)
        Parameters:
        result - {T}
      • publish

        public void publish()
        publish VisionResult values to corresponding NetworkTable Entries should be overriden and supered by any children of type T extends VisionResult
        Specified by:
        publish in interface VisionConnector
      • retrieve

        protected VisionResult retrieve()
        retrieve a VisionResult from NetworkTable Entries should be overriden and supered by any children of type T extends VisionResult
        Returns:
        {VisionResult}
      • next

        protected abstract void next​(edu.wpi.first.networktables.NetworkTable table,
                                     java.lang.String key,
                                     edu.wpi.first.networktables.NetworkTableEntry entry,
                                     edu.wpi.first.networktables.NetworkTableValue value,
                                     int flags)
        evaluate and process the results in NetworkTables to my lastResult
        Parameters:
        table - NetworkTable to get values from
        key - Key of the entry that triggered the Listener
        entry - Entry that was updated
        value - the new Value
        flags - Listener flags (created, updated, removed, etc)
      • getLastResult

        public T getLastResult()
        Returns:
        {T}
      • 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.