castacks/tartancalib

illegal to run the optimizer with no error terms

JzHuai0108 opened this issue · 3 comments

Traceback (most recent call last):
  File "/media/jhuai/Seagate2TB/jhuai/tools/continuous-time/tartancalib_ws/devel/lib/kalibr/tartan_calibrate", line 15, in <module>
    exec(compile(fh.read(), python_script, 'exec'), context)
  File "/media/jhuai/Seagate2TB/jhuai/tools/continuous-time/tartancalib_ws/src/tartancalib/aslam_offline_calibration/kalibr/python/tartan_calibrate", line 654, in <module>
    main()
  File "/media/jhuai/Seagate2TB/jhuai/tools/continuous-time/tartancalib_ws/src/tartancalib/aslam_offline_calibration/kalibr/python/tartan_calibrate", line 388, in main
    success = calibrator.addTargetView(obs_tuple, T_tc_guess,parsed.forceAll)
  File "/media/jhuai/Seagate2TB/jhuai/tools/continuous-time/tartancalib_ws/src/tartancalib/aslam_offline_calibration/kalibr/python/kalibr_camera_calibration/CameraCalibrator.py", line 348, in addTargetView
    self.estimator_return_value = self.estimator.addBatch(batch_problem, force)
RuntimeError: [Exception] /media/jhuai/Seagate2TB/jhuai/tools/continuous-time/tartancalib_ws/src/tartancalib/aslam_optimizer/aslam_backend/src/Optimizer2.cpp:137: initialize() assert( not _errorTerms.empty()) failed: It is illegal to run the optimizer with no error terms.

Dear authors,
Thank you for the great work.
However, there is one problem as shown above. This error occasionally arises on some datasets we collected with an aprilgrid.
That is, if we run your program again, the error may not show up at all.
Do you have a clue how to fix this?

FYI, here are the log before the error,


Processed 1176 of 1200 views with 50 views used

Camera-system parameters:
	cam0 (/cam0/image_raw):
	 type: <class 'aslam_cv.libaslam_cv_python.EquidistantDistortedPinholeCameraGeometry'>
	 distortion: [ 0.01495533  0.0165746  -0.0049423   0.00219222] +- [0.00290736 0.00544983 0.0041254  0.00107575]
	 projection: [474.35787003 473.9336576  796.16480152 569.73508203] +- [0.5769482  0.54900586 0.37586068 0.30820423]
	 reprojection error: [0.000002, 0.000003] +- [0.397710, 0.364691]


------------------------------------------------------------------

  Progress 1176 / 1200 	 Time remaining: 1s                  
  Progress 1177 / 1200 	 Time remaining: 1s                  
  Progress 1178 / 1200 	 Time remaining: 1s                  
  Progress 1179 / 1200 	 Time remaining: 0s                  
  Progress 1180 / 1200 	 Time remaining: 0s                  
  Progress 1181 / 1200 	 Time remaining: 0s                  
  Progress 1182 / 1200 	 Time remaining: 0s                  
  Progress 1183 / 1200 	 Time remaining: 0s                  
  Progress 1184 / 1200 	 Time remaining: 0s                  
  Progress 1185 / 1200 	 Time remaining: 0s                  
  Progress 1186 / 1200 	 Time remaining: 0s                  
  Progress 1187 / 1200 	 Time remaining: 0s                  
  Progress 1188 / 1200 	 Time remaining: 0s                  
  Progress 1189 / 1200 	 Time remaining: 0s                  
  Progress 1190 / 1200 	 Time remaining: 0s                  
  Progress 1191 / 1200 	 Time remaining: 0s                  
  Progress 1192 / 1200 	 Time remaining: 0s                  
  Progress 1193 / 1200 	 Time remaining: 0s                  
  Progress 1194 / 1200 	 Time remaining: 0s                  
  Progress 1195 / 1200 	 Time remaining: 0s                  
  Progress 1196 / 1200 	 Time remaining: 0s                  
  Progress 1197 / 1200 	 Time remaining: 0s                  
  Progress 1198 / 1200 	 Time remaining: 0s                  
  Progress 1199 / 1200 	 Time remaining: 0s                  
  Progress 1200 / 1200 	 Time remaining:                   

All views have been processed.

Starting final outlier filtering...

  Progress 1 / 50 	 Time remaining: 2s                  
  Progress 2 / 50 	 Time remaining: 2s                  
  Progress 3 / 50 	 Time remaining: 2s                  
  Progress 4 / 50 	 Time remaining: 2s                  
  Progress 5 / 50 	 Time remaining: 3s                  
  Progress 6 / 50 	 Time remaining: 3s                  
  Progress 7 / 50 	 Time remaining: 3s                  
  Progress 8 / 50 	 Time remaining: 3s                  
  Progress 9 / 50 	 Time remaining: 2s                  
  Progress 10 / 50 	 Time remaining: 2s                  
  Progress 11 / 50 	 Time remaining: 2s                  
  Progress 12 / 50 	 Time remaining: 2s                  
  Progress 13 / 50 	 Time remaining: 2s                  
  Progress 14 / 50 	 Time remaining: 2s                  
  Progress 15 / 50 	 Time remaining: 2s                  
  Progress 16 / 50 	 Time remaining: 2s                  
  Progress 17 / 50 	 Time remaining: 2s                  
  Progress 18 / 50 	 Time remaining: 2s                  
  Progress 19 / 50 	 Time remaining: 2s                  
  Progress 20 / 50 	 Time remaining: 1s                  
  Progress 21 / 50 	 Time remaining: 1s                  
  Progress 22 / 50 	 Time remaining: 1s                  
  Progress 23 / 50 	 Time remaining: 1s                  
  Progress 24 / 50 	 Time remaining: 1s                  
  Progress 25 / 50 	 Time remaining: 1s                  
  Progress 26 / 50 	 Time remaining: 1s                  
  Progress 27 / 50 	 Time remaining: 1s                  
  Progress 28 / 50 	 Time remaining: 1s                  
  Progress 29 / 50 	 Time remaining: 1s                  
  Progress 30 / 50 	 Time remaining: 1s                  
  Progress 31 / 50 	 Time remaining: 1s                  
  Progress 32 / 50 	 Time remaining: 1s                  
  Progress 33 / 50 	 Time remaining: 1s                  
  Progress 34 / 50 	 Time remaining: 0s                  
  Progress 35 / 50 	 Time remaining: 0s                  
  Progress 36 / 50 	 Time remaining: 0s                  
  Progress 37 / 50 	 Time remaining: 0s                  
  Progress 38 / 50 	 Time remaining: 0s                  
  Progress 39 / 50 	 Time remaining: 0s                  
  Progress 40 / 50 	 Time remaining: 0s                  
  Progress 41 / 50 	 Time remaining: 0s                  
  Progress 42 / 50 	 Time remaining: 0s                  
  Progress 43 / 50 	 Time remaining: 0s                  
  Progress 44 / 50 	 Time remaining: 0s                  
  Progress 45 / 50 	 Time remaining: 0s                  
  Progress 46 / 50 	 Time remaining: 0s                  
  Progress 47 / 50 	 Time remaining: 0s                  
  Progress 48 / 50 	 Time remaining: 0s                  
  Progress 49 / 50 	 Time remaining: 0s                  
  Progress 50 / 50 	 Time remaining:                   �[0m[ INFO] [1670491101.537319]: Started tartan calib with 105853 points.�[0m
�[0m[ INFO] [1670491518.740424]: Default debug mode means no plotting.�[0m
�[0m[ INFO] [1670491518.741673]: Ended tartan calib with 126811 corners.�[0m
�[33m[ WARN] [1670491519.339236]: Removed 28 outlier corners.�[0m
�[33m[ WARN] [1670491691.650392]: getTargetPoseGuess: solvePnP failed with solution: <sm.libsm_python.Transformation object at 0x7f7565bbb890>�[0m


..................................................................

Calibration complete.
Saving to MatLab matrix


Processed 1200 images with 48 images used
Camera-system parameters:
	cam0 (/cam0/image_raw):
	 type: <class 'aslam_cv.libaslam_cv_python.EquidistantDistortedPinholeCameraGeometry'>
	 distortion: [ 0.01438801  0.01702609 -0.00515978  0.00223461] +- [0.00298229 0.00558551 0.00423363 0.00110568]
	 projection: [474.87554348 474.41587225 796.08490782 569.81563698] +- [0.61857653 0.58944089 0.38855305 0.31407241]
	 reprojection error: [0.000002, 0.000004] +- [0.394647, 0.362048]

Results written to file: /media/jhuai/OldWin8OS/jhuai/rolling_shutter_calibration/results/intrinsics_calib/ueye3251_calib_far/ueye3251-151-near-1log0-camchain.yaml
  Detailed results written to file: /media/jhuai/OldWin8OS/jhuai/rolling_shutter_calibration/results/intrinsics_calib/ueye3251_calib_far/ueye3251-151-near-1log0-results-cam.txt
initializing initial guesses
initialized cam0 to:
	 projection cam0: [474.87554348 474.41587225 796.08490782 569.81563698]
	 distortion cam0: [ 0.01438801  0.01702609 -0.00515978  0.00223461]
initializing calibrator
STARTING MODE
PolarOptions.NONE
starting calibration...
krtt commented

We have seemingly the same problem. And yes it occurs in 40-50% of cases. Any ideas what causes it? Workaround or solution?

Are you running this in docker? Can you send me a failing bag file to bduister@cs.cmu.edu?

krtt commented

I have tried both, local installation and docker. I have provided you the bag to mentioned email. Thanks for your help.