Package org.photonvision.targeting
Class PhotonPipelineResult
java.lang.Object
org.photonvision.targeting.PhotonPipelineResult
- All Implemented Interfaces:
ProtobufSerializable,WPISerializable,PhotonStructSerializable<PhotonPipelineResult>
public class PhotonPipelineResult
extends Object
implements ProtobufSerializable, PhotonStructSerializable<PhotonPipelineResult>
Represents a pipeline result from a PhotonCamera.
-
Field Summary
FieldsModifier and TypeFieldDescriptionFrame capture metadata.The multitag result, if using an AprilTag pipeline with Multi-Target Estimation enabled.static final PhotonPipelineResultSerdePhotonPipelineResult PhotonStruct for serialization.static final PhotonPipelineResultProtoPhotonPipelineResult Protobuf for serialization.The list of targets detected by the pipeline. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty pipeline result.PhotonPipelineResult(long sequenceID, long captureTimestampMicros, long publishTimestampMicros, long timeSinceLastPong, List<PhotonTrackedTarget> targets) Constructs a pipeline result.PhotonPipelineResult(long sequenceID, long captureTimestamp, long publishTimestamp, long timeSinceLastPong, List<PhotonTrackedTarget> targets, Optional<MultiTargetPNPResult> result) Constructs a pipeline result.PhotonPipelineResult(PhotonPipelineMetadata metadata, List<PhotonTrackedTarget> targets, Optional<MultiTargetPNPResult> result) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the best target in this pipeline result.Return the latest multi-target result.intReturns the size of the packet needed to store this pipeline result.getSerde()Returns the PhotonStruct serializer for this type.Returns a copy of the vector of targets.doubleReturns the estimated time the frame was taken, in the Time Sync Server's time base (nt::Now).inthashCode()booleanReturns whether the pipeline has targets.toString()
-
Field Details
-
metadata
Frame capture metadata. -
targets
The list of targets detected by the pipeline. -
multitagResult
The multitag result, if using an AprilTag pipeline with Multi-Target Estimation enabled. -
photonStruct
PhotonPipelineResult PhotonStruct for serialization. -
proto
PhotonPipelineResult Protobuf for serialization.
-
-
Constructor Details
-
PhotonPipelineResult
public PhotonPipelineResult()Constructs an empty pipeline result. -
PhotonPipelineResult
public PhotonPipelineResult(long sequenceID, long captureTimestampMicros, long publishTimestampMicros, long timeSinceLastPong, List<PhotonTrackedTarget> targets) Constructs a pipeline result.- Parameters:
sequenceID- The number of frames processed by this camera since bootcaptureTimestampMicros- The time, in uS in the coprocessor's timebase, that the coprocessor captured the image this result contains the targeting info ofpublishTimestampMicros- The time, in uS in the coprocessor's timebase, that the coprocessor published targeting infotimeSinceLastPong- The time since the last Time Sync Pong in uS.targets- The list of targets identified by the pipeline.
-
PhotonPipelineResult
public PhotonPipelineResult(long sequenceID, long captureTimestamp, long publishTimestamp, long timeSinceLastPong, List<PhotonTrackedTarget> targets, Optional<MultiTargetPNPResult> result) Constructs a pipeline result.- Parameters:
sequenceID- The number of frames processed by this camera since bootcaptureTimestamp- The time, in uS in the coprocessor's timebase, that the coprocessor captured the image this result contains the targeting info ofpublishTimestamp- The time, in uS in the coprocessor's timebase, that the coprocessor published targeting infotimeSinceLastPong- The time since the last Time Sync Pong in uS.targets- The list of targets identified by the pipeline.result- Result from multi-target PNP.
-
PhotonPipelineResult
public PhotonPipelineResult(PhotonPipelineMetadata metadata, List<PhotonTrackedTarget> targets, Optional<MultiTargetPNPResult> result)
-
-
Method Details
-
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.
-
hasTargets
Returns whether the pipeline has targets.- Returns:
- Whether the pipeline has targets.
-
getTargets
Returns a copy of the vector of targets.Returned in the order set by target sort mode.
- Returns:
- A copy of the vector of targets.
-
getMultiTagResult
Return the latest multi-target result. Be sure to checkgetMultiTagResult().isPresent()before using the pose estimate!- Returns:
- The multi-target result. Empty if there's no multi-target result/Multi-Target Estimation is disabled in the UI.
-
getTimestampSeconds
Returns the estimated time the frame was taken, in the Time Sync Server's time base (nt::Now). This is calculated using the estimated offset between Time Sync Server time and local time. The robot shall run a server, so the offset shall be 0.- Returns:
- The timestamp in seconds
-
toString
-
hashCode
-
equals
-
getSerde
Description copied from interface:PhotonStructSerializableReturns the PhotonStruct serializer for this type.- Specified by:
getSerdein interfacePhotonStructSerializable<PhotonPipelineResult>- Returns:
- The PhotonStruct serializer
-