Package frclib.vision
Class FrcRemoteVisionProcessor
java.lang.Object
frclib.vision.FrcRemoteVisionProcessor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class encapsulate the info representing the detected target pose with a timestamp. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionFrcRemoteVisionProcessor
(String instanceName) Constructor: Create an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionGet the average pose of the last n frames where n=maxCachedFrames.getAveragePose
(int numFrames) Calculates the average pose of the last numFrames frames.getAveragePose
(int numFrames, boolean requireAll) Calculates the average pose of the last numFrames frames, optionally requiring numFrames frames.Gets the last calculated pose.getMedianPose
(int numFrames, boolean requireAll) Calculates the median pose of the last numFrames frames, optionally requiring numFrames frames.protected abstract FrcRemoteVisionProcessor.TargetData<?>
This method gets the latest target data from vision processor.protected abstract TrcPose2D
getTargetPose
(FrcRemoteVisionProcessor.TargetData<?> targetData) This method gets the target pose from the detected target data.void
setEnabled
(boolean enabled) This method enables/disables the vision processor task.void
setFreshnessTimeout
(double timeout) This method sets the timeout of a relative pose.void
setMaxCachedFrames
(int numFrames) Set the max number of frames to keep.toString()
This method returns the instance name.
-
Field Details
-
tracer
-
instanceName
-
-
Constructor Details
-
FrcRemoteVisionProcessor
Constructor: Create an instance of the object.- Parameters:
instanceName
- specifies the instance name.
-
-
Method Details
-
getTargetData
This method gets the latest target data from vision processor.- Returns:
- target data of the detected object, null if no object detected.
-
getTargetPose
This method gets the target pose from the detected target data.- Parameters:
targetData
- specifies the target data from which to get the target pose.- Returns:
- detected target pose.
-
toString
This method returns the instance name. -
setEnabled
public void setEnabled(boolean enabled) This method enables/disables the vision processor task.- Parameters:
enabled
- specifies true to enable vision process task, false to disable.
-
setFreshnessTimeout
public void setFreshnessTimeout(double timeout) This method sets the timeout of a relative pose.- Parameters:
timeout
- specifies relative pose timeout in seconds.
-
setMaxCachedFrames
public void setMaxCachedFrames(int numFrames) Set the max number of frames to keep. You will not be able to average more frames than this.- Parameters:
numFrames
- How many frames to keep for averaging at maximum.
-
getLastTargetData
Gets the last calculated pose.- Returns:
- The pose calculated by the vision system. If no object detected, returns null.
-
getAveragePose
Calculates the average pose of the last numFrames frames, optionally requiring numFrames frames.- Parameters:
numFrames
- How many frames to average.requireAll
- If true, require at least numFrames frames to average.- Returns:
- Average of last numFrames frames, or null if not enough frames and requireAll is true.
-
getAveragePose
Calculates the average pose of the last numFrames frames.- Parameters:
numFrames
- How many frames to average.- Returns:
- The average pose.
-
getAveragePose
Get the average pose of the last n frames where n=maxCachedFrames.- Returns:
- The average pose. (all attributes averaged)
-
getMedianPose
Calculates the median pose of the last numFrames frames, optionally requiring numFrames frames.- Parameters:
numFrames
- How many frames to calculate with.requireAll
- If true, require at least numFrames frames.- Returns:
- Median of last numFrames frames, or null if not enough frames and requireAll is true, or if all data is stale.
-