@@ -160,11 +160,12 @@ public SimCameraProperties(Path path, int width, int height) throws IOException
160
160
if (!success ) throw new IOException ("Requested resolution not found in calibration" );
161
161
}
162
162
163
- public void setRandomSeed (long seed ) {
163
+ public SimCameraProperties setRandomSeed (long seed ) {
164
164
rand .setSeed (seed );
165
+ return this ;
165
166
}
166
167
167
- public void setCalibration (int resWidth , int resHeight , Rotation2d fovDiag ) {
168
+ public SimCameraProperties setCalibration (int resWidth , int resHeight , Rotation2d fovDiag ) {
168
169
if (fovDiag .getDegrees () < 1 || fovDiag .getDegrees () > 179 ) {
169
170
fovDiag = Rotation2d .fromDegrees (MathUtil .clamp (fovDiag .getDegrees (), 1 , 179 ));
170
171
DriverStation .reportError (
@@ -189,9 +190,11 @@ public void setCalibration(int resWidth, int resHeight, Rotation2d fovDiag) {
189
190
// create camera intrinsics matrix
190
191
var camIntrinsics = MatBuilder .fill (Nat .N3 (), Nat .N3 (), fx , 0 , cx , 0 , fy , cy , 0 , 0 , 1 );
191
192
setCalibration (resWidth , resHeight , camIntrinsics , distCoeff );
193
+
194
+ return this ;
192
195
}
193
196
194
- public void setCalibration (
197
+ public SimCameraProperties setCalibration (
195
198
int resWidth , int resHeight , Matrix <N3 , N3 > camIntrinsics , Matrix <N8 , N1 > distCoeffs ) {
196
199
this .resWidth = resWidth ;
197
200
this .resHeight = resHeight ;
@@ -222,43 +225,54 @@ public void setCalibration(
222
225
viewplanes .add (
223
226
new DMatrix3 (translation3d .getX (), translation3d .getY (), translation3d .getZ ()));
224
227
}
228
+
229
+ return this ;
225
230
}
226
231
227
- public void setCalibError (double avgErrorPx , double errorStdDevPx ) {
232
+ public SimCameraProperties setCalibError (double avgErrorPx , double errorStdDevPx ) {
228
233
this .avgErrorPx = avgErrorPx ;
229
234
this .errorStdDevPx = errorStdDevPx ;
235
+ return this ;
230
236
}
231
237
232
238
/**
233
239
* @param fps The average frames per second the camera should process at. <b>Exposure time limits
234
240
* FPS if set!</b>
235
241
*/
236
- public void setFPS (double fps ) {
242
+ public SimCameraProperties setFPS (double fps ) {
237
243
frameSpeedMs = Math .max (1000.0 / fps , exposureTimeMs );
244
+
245
+ return this ;
238
246
}
239
247
240
248
/**
241
249
* @param exposureTimeMs The amount of time the "shutter" is open for one frame. Affects motion
242
250
* blur. <b>Frame speed(from FPS) is limited to this!</b>
243
251
*/
244
- public void setExposureTimeMs (double exposureTimeMs ) {
252
+ public SimCameraProperties setExposureTimeMs (double exposureTimeMs ) {
245
253
this .exposureTimeMs = exposureTimeMs ;
246
254
frameSpeedMs = Math .max (frameSpeedMs , exposureTimeMs );
255
+
256
+ return this ;
247
257
}
248
258
249
259
/**
250
260
* @param avgLatencyMs The average latency (from image capture to data published) in milliseconds
251
261
* a frame should have
252
262
*/
253
- public void setAvgLatencyMs (double avgLatencyMs ) {
263
+ public SimCameraProperties setAvgLatencyMs (double avgLatencyMs ) {
254
264
this .avgLatencyMs = avgLatencyMs ;
265
+
266
+ return this ;
255
267
}
256
268
257
269
/**
258
270
* @param latencyStdDevMs The standard deviation in milliseconds of the latency
259
271
*/
260
- public void setLatencyStdDevMs (double latencyStdDevMs ) {
272
+ public SimCameraProperties setLatencyStdDevMs (double latencyStdDevMs ) {
261
273
this .latencyStdDevMs = latencyStdDevMs ;
274
+
275
+ return this ;
262
276
}
263
277
264
278
public int getResWidth () {
0 commit comments