Class OrinSolver
java.lang.Object
frc.robot.subsystems.vision.OrinSolver
Turns one Orin camera's logged PhotonLib results into pose observations. Reads only
OrinCameraInputs and robot state that is itself replayed, so it runs identically live and in
replay (issue #10, section 2).
- Multi-tag: the Jetson's multi-tag solve (
estimatedPose.best). Tag count and distance come fromfiducialIDsUsed, not every visible target (section 10a). - Single tag: the lowest-ambiguity usable tag. Of its two PnP candidates, the one
whose heading is closest to the gyro's at the frame's timestamp (6328, section 8b); the
ambiguity gate in
VisionGates.orinGates(DoubleSupplier)then drops frames where the two are too alike. - Targets with
fiducialId < 0(game pieces), tags missing from the layout and tags on the excluded list (section 12) are never used. The Jetson already leaves excluded tags out of multi-tag; this keeps them out of the single-tag path too. - Each observation's std-dev scale is the camera's factor times
edgeScale(PhotonTrackedTarget): tags near the image edge are trusted less, not dropped (section 8b).
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<org.photonvision.targeting.PhotonPipelineResult> The lastsolve(OrinCameraInputs, Set, DoubleFunction)call's decoded results, oldest first, for sources built on them.intStats from the most recentsolve(OrinCameraInputs, Set, DoubleFunction)call, for logging.static final doubleStd-dev falloff starts this far (px) from the image edge.static final doubleStd-dev multiplier at the very edge; 1.0 turns the edge scaling off.intdoubledoublefinal BitSetEvery fiducial id seen in the lastsolve(OrinCameraInputs, Set, DoubleFunction)call's results. -
Constructor Summary
ConstructorsConstructorDescriptionOrinSolver(Transform3d robotToCamera, AprilTagFieldLayout layout, double cameraFactor, int imageWidth, int imageHeight) -
Method Summary
Modifier and TypeMethodDescriptiondoubleThis camera's std-dev factor.Optional<org.photonvision.targeting.PhotonPipelineResult> decode(byte[] bytes) Decodes one logged result, or empty if the bytes are bad (PhotonVision #2528).doubleedgeScale(org.photonvision.targeting.PhotonTrackedTarget t) 1.0 away from the image edges, rising smoothly toEDGE_MAX_SCALEas the tag's closest corner reaches an edge.solve(OrinCameraInputs inputs, Set<Integer> excludedTags, DoubleFunction<Rotation2d> headingAt) Solves every logged result.
-
Field Details
-
EDGE_BAND_PX
public static final double EDGE_BAND_PXStd-dev falloff starts this far (px) from the image edge.- See Also:
-
EDGE_MAX_SCALE
public static final double EDGE_MAX_SCALEStd-dev multiplier at the very edge; 1.0 turns the edge scaling off.- See Also:
-
decodeFailures
public int decodeFailuresStats from the most recentsolve(OrinCameraInputs, Set, DoubleFunction)call, for logging. -
excludedTargets
public int excludedTargets -
decoded
The lastsolve(OrinCameraInputs, Set, DoubleFunction)call's decoded results, oldest first, for sources built on them. -
seenTags
Every fiducial id seen in the lastsolve(OrinCameraInputs, Set, DoubleFunction)call's results. -
lastLatencyMs
public double lastLatencyMs -
lastTimestampSeconds
public double lastTimestampSeconds
-
-
Constructor Details
-
OrinSolver
public OrinSolver(Transform3d robotToCamera, AprilTagFieldLayout layout, double cameraFactor, int imageWidth, int imageHeight) - Parameters:
robotToCamera- camera mount, robot frame (x forward, y left, z up)layout- the field's AprilTags; must match the Jetson'scameraFactor- per-camera std-dev multiplier (6328's camera factor)imageWidth- image width in px (the Jetson's images are 1280x800)imageHeight- image height in px
-
-
Method Details
-
cameraFactor
public double cameraFactor()This camera's std-dev factor. -
decode
Decodes one logged result, or empty if the bytes are bad (PhotonVision #2528). -
solve
public List<PoseObservation> solve(OrinCameraInputs inputs, Set<Integer> excludedTags, DoubleFunction<Rotation2d> headingAt) Solves every logged result.- Parameters:
inputs- this loop's camera inputsexcludedTags- tag ids to leave out (section 12)headingAt- the robot's heading at a capture time, ornullif unknown (before the pose is seeded); picks between single-tag candidates- Returns:
- one observation per result that had a usable tag
-
edgeScale
public double edgeScale(org.photonvision.targeting.PhotonTrackedTarget t) 1.0 away from the image edges, rising smoothly toEDGE_MAX_SCALEas the tag's closest corner reaches an edge. Near the edge lens distortion is strongest, the calibration has the least data, and tags are often cut off.
-