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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PhotonPipelineResultProto
static final PhotonPipelineResult.APacketSerde
final List<PhotonTrackedTarget>
-
Constructor Summary
ConstructorDescriptionConstructs an empty pipeline result.PhotonPipelineResult
(long sequenceID, long captureTimestamp, long publishTimestamp, List<PhotonTrackedTarget> targets) Constructs a pipeline result.PhotonPipelineResult
(long sequenceID, long captureTimestamp, long publishTimestamp, List<PhotonTrackedTarget> targets, MultiTargetPNPResult result) Constructs a pipeline result. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns the best target in this pipeline result.long
The time that this image was captured, in the coprocessor's time base.double
Returns the time between image capture and publish to NTReturn the latest multi-target result.long
The time that the robot recieved this result, in the FPGA timebase.int
Returns the size of the packet needed to store this pipeline result.long
The time that this result was published to NT, in the coprocessor's time base.long
The number of non-empty frames processed by this camera since boot.Returns a copy of the vector of targets.double
Returns the estimated time the frame was taken, in the recieved system's time base.int
hashCode()
boolean
Returns whether the pipeline has targets.void
setRecieveTimestampMicros
(long timestampMicros) Sets the FPGA timestamp this result was recieved by robot codetoString()
-
Field Details
-
targets
-
serde
-
proto
-
-
Constructor Details
-
PhotonPipelineResult
public PhotonPipelineResult()Constructs an empty pipeline result. -
PhotonPipelineResult
public PhotonPipelineResult(long sequenceID, long captureTimestamp, long publishTimestamp, List<PhotonTrackedTarget> targets) 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 infotargets
- The list of targets identified by the pipeline.
-
PhotonPipelineResult
public PhotonPipelineResult(long sequenceID, long captureTimestamp, long publishTimestamp, List<PhotonTrackedTarget> targets, 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 infotargets
- 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 time between image capture and publish to NT -
getTimestampSeconds
public double getTimestampSeconds()Returns the estimated time the frame was taken, in the recieved system's time base. This is calculated as (NT recieve time (robot base) - (publish timestamp, coproc timebase - capture timestamp, coproc timebase))- Returns:
- The timestamp in seconds
-
getCaptureTimestampMicros
public long getCaptureTimestampMicros()The time that this image was captured, in the coprocessor's time base. -
getPublishTimestampMicros
public long getPublishTimestampMicros()The time that this result was published to NT, in the coprocessor's time base. -
getSequenceID
public long getSequenceID()The number of non-empty frames processed by this camera since boot. Useful to checking if a camera is alive. -
getNtRecieveTimestampMicros
public long getNtRecieveTimestampMicros()The time that the robot recieved this result, in the FPGA timebase. -
setRecieveTimestampMicros
public void setRecieveTimestampMicros(long timestampMicros) Sets the FPGA timestamp this result was recieved by robot code -
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
-