@@ -81,8 +81,7 @@ public class PhotonCameraSim implements AutoCloseable {
81
81
private double minTargetAreaPercent ;
82
82
private PhotonTargetSortMode sortMode = PhotonTargetSortMode .Largest ;
83
83
84
- private final AprilTagFieldLayout tagLayout =
85
- AprilTagFieldLayout .loadField (AprilTagFields .kDefaultField );
84
+ private final AprilTagFieldLayout tagLayout ;
86
85
87
86
// video stream simulation
88
87
private final CvSource videoSimRaw ;
@@ -130,8 +129,24 @@ public PhotonCameraSim(PhotonCamera camera) {
130
129
* @param prop Properties of this camera such as FOV and FPS
131
130
*/
132
131
public PhotonCameraSim (PhotonCamera camera , SimCameraProperties prop ) {
132
+ this (camera , prop , AprilTagFieldLayout .loadField (AprilTagFields .kDefaultField ));
133
+ }
134
+
135
+ /**
136
+ * Constructs a handle for simulating {@link PhotonCamera} values. Processing simulated targets
137
+ * through this class will change the associated PhotonCamera's results.
138
+ *
139
+ * <p>By default, the minimum target area is 100 pixels and there is no maximum sight range.
140
+ *
141
+ * @param camera The camera to be simulated
142
+ * @param prop Properties of this camera such as FOV and FPS
143
+ * @param tagLayout The {@link AprilTagFieldLayout} used to solve for tag positions.
144
+ */
145
+ public PhotonCameraSim (
146
+ PhotonCamera camera , SimCameraProperties prop , AprilTagFieldLayout tagLayout ) {
133
147
this .cam = camera ;
134
148
this .prop = prop ;
149
+ this .tagLayout = tagLayout ;
135
150
setMinTargetAreaPixels (kDefaultMinAreaPx );
136
151
137
152
videoSimRaw =
@@ -163,6 +178,30 @@ public PhotonCameraSim(
163
178
SimCameraProperties prop ,
164
179
double minTargetAreaPercent ,
165
180
double maxSightRangeMeters ) {
181
+ this (camera , prop , AprilTagFieldLayout .loadField (AprilTagFields .kDefaultField ));
182
+ this .minTargetAreaPercent = minTargetAreaPercent ;
183
+ this .maxSightRangeMeters = maxSightRangeMeters ;
184
+ }
185
+
186
+ /**
187
+ * Constructs a handle for simulating {@link PhotonCamera} values. Processing simulated targets
188
+ * through this class will change the associated PhotonCamera's results.
189
+ *
190
+ * @param camera The camera to be simulated
191
+ * @param prop Properties of this camera such as FOV and FPS
192
+ * @param minTargetAreaPercent The minimum percentage(0 - 100) a detected target must take up of
193
+ * the camera's image to be processed. Match this with your contour filtering settings in the
194
+ * PhotonVision GUI.
195
+ * @param maxSightRangeMeters Maximum distance at which the target is illuminated to your camera.
196
+ * Note that minimum target area of the image is separate from this.
197
+ * @param tagLayout AprilTag field layout to use for multi-tag estimation
198
+ */
199
+ public PhotonCameraSim (
200
+ PhotonCamera camera ,
201
+ SimCameraProperties prop ,
202
+ double minTargetAreaPercent ,
203
+ double maxSightRangeMeters ,
204
+ AprilTagFieldLayout tagLayout ) {
166
205
this (camera , prop );
167
206
this .minTargetAreaPercent = minTargetAreaPercent ;
168
207
this .maxSightRangeMeters = maxSightRangeMeters ;
0 commit comments