Package org.photonvision.estimation
Class TargetModel
java.lang.Object
org.photonvision.estimation.TargetModel
Describes the 3d model of a target.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal booleanTrue if the target is planar, like an AprilTag.final booleanTrue if the target is spherical, like a ball.static final TargetModelThe model of AprilTags in the 16h5 family used by FIRST in FRC 2023.static final TargetModelThe model of AprilTags in the 36h11 family used by FIRST in FRC 2024 and later years.final List<Translation3d>Translations of this target's vertices relative to its pose. -
Constructor Summary
ConstructorsConstructorDescriptionTargetModel(double diameterMeters) Creates a spherical target model which has similar dimensions regardless of its rotation.TargetModel(double widthMeters, double heightMeters) Creates a rectangular, planar target model given the width and height.TargetModel(double lengthMeters, double widthMeters, double heightMeters) Creates a cuboid target model given the length, width, height.TargetModel(List<Translation3d> vertices) Creates a target model from arbitrary 3d vertices. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetFieldVertices(Pose3d targetPose) This target's vertices offset from its field pose.static Pose3dgetOrientedPose(Translation3d tgtTrl, Translation3d cameraTrl) Returns a Pose3d with the given target translation oriented (with its relative x-axis aligned) to the camera translation.
-
Field Details
-
vertices
Translations of this target's vertices relative to its pose. Rectangular and spherical targets will have four vertices. See their respective constructors for more info. -
isPlanar
True if the target is planar, like an AprilTag. False otherwise. -
isSpherical
True if the target is spherical, like a ball. False otherwise. -
kAprilTag16h5
The model of AprilTags in the 16h5 family used by FIRST in FRC 2023. -
kAprilTag36h11
The model of AprilTags in the 36h11 family used by FIRST in FRC 2024 and later years.
-
-
Constructor Details
-
TargetModel
Creates a rectangular, planar target model given the width and height. The model has four vertices:- Point 0: [0, -width/2, -height/2]
- Point 1: [0, width/2, -height/2]
- Point 2: [0, width/2, height/2]
- Point 3: [0, -width/2, height/2]
-
TargetModel
Creates a cuboid target model given the length, width, height. The model has eight vertices:- Point 0: [length/2, -width/2, -height/2]
- Point 1: [length/2, width/2, -height/2]
- Point 2: [length/2, width/2, height/2]
- Point 3: [length/2, -width/2, height/2]
- Point 4: [-length/2, -width/2, height/2]
- Point 5: [-length/2, width/2, height/2]
- Point 6: [-length/2, width/2, -height/2]
- Point 7: [-length/2, -width/2, -height/2]
-
TargetModel
Creates a spherical target model which has similar dimensions regardless of its rotation. This model has four vertices:- Point 0: [0, -radius, 0]
- Point 1: [0, 0, -radius]
- Point 2: [0, radius, 0]
- Point 3: [0, 0, radius]
-
TargetModel
Creates a target model from arbitrary 3d vertices. Automatically determines if the given vertices are planar(x == 0). More than 2 vertices must be given. If this is a planar model, the vertices should define a non-intersecting contour.- Parameters:
vertices- Translations representing the vertices of this target model relative to its pose.
-
-
Method Details
-
getFieldVertices
This target's vertices offset from its field pose.Note: If this target is spherical, use
getOrientedPose(Translation3d, Translation3d)with this method.- Parameters:
targetPose- The field pose to offset the vertices by.- Returns:
- The list of vertices offset from the target pose.
-
getOrientedPose
Returns a Pose3d with the given target translation oriented (with its relative x-axis aligned) to the camera translation. This is used for spherical targets which should not have their projection change regardless of their own rotation.- Parameters:
tgtTrl- This target's translationcameraTrl- Camera's translation- Returns:
- This target's pose oriented to the camera
-
equals
-