Package org.photonvision.targeting
Class PhotonPipelineResult
java.lang.Object
org.photonvision.targeting.PhotonPipelineResult
- All Implemented Interfaces:
edu.wpi.first.util.protobuf.ProtobufSerializable
,edu.wpi.first.util.WPISerializable
public class PhotonPipelineResult
extends Object
implements edu.wpi.first.util.protobuf.ProtobufSerializable
Represents a pipeline result from a PhotonCamera.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PhotonPipelineResultProto
static final PhotonPipelineResult.APacketSerde
final List<PhotonTrackedTarget>
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty pipeline result.PhotonPipelineResult
(double latencyMillis, List<PhotonTrackedTarget> targets) Constructs a pipeline result.PhotonPipelineResult
(double latencyMillis, List<PhotonTrackedTarget> targets, MultiTargetPNPResult result) Constructs a pipeline result. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the best target in this pipeline result.double
Returns the latency in the pipeline.Return the latest multi-target result.int
Returns the size of the packet needed to store this pipeline result.Returns a copy of the vector of targets.double
Returns the estimated time the frame was taken, This is more accurate than usinggetLatencyMillis()
int
hashCode()
boolean
Returns whether the pipeline has targets.void
setTimestampSeconds
(double timestampSeconds) Sets the FPGA timestamp of this result in seconds.toString()
-
Field Details
-
targets
-
serde
-
proto
-
-
Constructor Details
-
PhotonPipelineResult
public PhotonPipelineResult()Constructs an empty pipeline result. -
PhotonPipelineResult
Constructs a pipeline result.- Parameters:
latencyMillis
- The latency in the pipeline.targets
- The list of targets identified by the pipeline.
-
PhotonPipelineResult
public PhotonPipelineResult(double latencyMillis, List<PhotonTrackedTarget> targets, MultiTargetPNPResult result) Constructs a pipeline result.- Parameters:
latencyMillis
- The latency in the pipeline.targets
- The list of targets identified by the pipeline.result
- Result from multi-target PNP.
-
-
Method Details
-
getPacketSize
public int getPacketSize()Returns the size of the packet needed to store this pipeline result.- Returns:
- The size of the packet needed to store this pipeline result.
-
getBestTarget
Returns the best target in this pipeline result. If there are no targets, this method will return null. The best target is determined by the target sort mode in the PhotonVision UI.- Returns:
- The best target of the pipeline result.
-
getLatencyMillis
public double getLatencyMillis()Returns the latency in the pipeline.- Returns:
- The latency in the pipeline.
-
getTimestampSeconds
public double getTimestampSeconds()Returns the estimated time the frame was taken, This is more accurate than usinggetLatencyMillis()
- Returns:
- The timestamp in seconds, or -1 if this result has no timestamp set.
-
setTimestampSeconds
public void setTimestampSeconds(double timestampSeconds) Sets the FPGA timestamp of this result in seconds.- Parameters:
timestampSeconds
- The timestamp in seconds.
-
hasTargets
public boolean hasTargets()Returns whether the pipeline has targets.- Returns:
- Whether the pipeline has targets.
-
getTargets
Returns a copy of the vector of targets.- Returns:
- A copy of the vector of targets.
-
getMultiTagResult
Return the latest multi-target result. Be sure to check getMultiTagResult().estimatedPose.isPresent before using the pose estimate! -
hashCode
public int hashCode() -
equals
-
toString
-