1.具体标定步骤,跟网上别的一模一样,此处就不列举
2.记录踩坑过程:RuntimeError: Optimization failed!
当执行到开始联合标定时,也就是如下指令:
kalibr_calibrate_imu_camera --target ./checkerboard_11x8_25x25cm.yaml --cam ./camchain-.camd435i.yaml --imu ./imu_self.yaml --bag ./imu_435i_move.bag --bag-from-to 10 90
当初直接执行这种指令,在小觅相机下标定成功,没报错。后面用realsense单目+独立IMU标定就开始报如下错误:
The Jacobian matrix is 194404 x 25179
[0.0]: J: 1.45862e+07
Exception in thread block: Exception in thread block: [aslam::Exception] /home/louis/catkin_ws/src/kalibr/aslam_nonparametric_estimation/aslam_splines/src/BSplineExpressions.cpp:447: toTransformationMatrixImplementation() assert(_bufferTmin <= _time.toScalar() < _bufferTmax) failed [15106.3 <= 15106.3 < 15106.4]: Spline Coefficient Buffer Exceeded. Set larger buffer margins!
[aslam::Exception] /home/louis/catkin_ws/src/kalibr/aslam_nonparametric_estimation/aslam_splines/src/BSplineExpressions.cpp:447: toTransformationMatrixImplementation() assert(_bufferTmin <= _time.toScalar() < _bufferTmax) failed [15118.2 <= 15118.2 < 15118.2]: Spline Coefficient Buffer Exceeded. Set larger buffer margins!
Exception in thread block: [aslam::Exception] /home/louis/catkin_ws/src/kalibr/aslam_nonparametric_estimation/aslam_splines/src/BSplineExpressions.cpp:447: toTransformationMatrixImplementation() assert(_bufferTmin <= _time.toScalar() < _bufferTmax) failed [15094.8 <= 15094.8 < 15094.9]: Spline Coefficient Buffer Exceeded. Set larger buffer margins!
[ERROR] [1454555378.858709]: Optimization failed!
Traceback (most recent call last):File "/home/hyper/catkin_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_imu_camera", line 206, in <module>main()File "/home/hyper/catkin_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_imu_camera", line 182, in mainiCal.optimize(maxIterations=parsed.max_iter, recoverCov=parsed.recover_cov)File "/home/hyper/catkin_ws/src/kalibr/aslam_offline_calibration/kalibr/python/kalibr_imu_camera_calibration/IccCalibrator.py", line 183, in optimizeraise RuntimeError("Optimization failed!")
RuntimeError: Optimization failed!
一开始查到的资料都说是数据录的有问题,但是我更换相机和imu反复试过多次发现并没有解决问题。而且在这个报错上面可以成功读取自己对应的imu信息和单目信息。所以说数据大概率也没问题。最终让我在kalibr的issues里找到了解决问题办法。
3.解决方法:
请打开kalibr/aslam_offline_calibration/kalibr/python/kalibr_calibrate_imu_camera.py文件,搜索timeOffsetPadding我的大概在198行。我先是输出它的值看了一下是0.03,然后增大此变量的值即可,我增大到了0.3 (PS:不能太大,我一开始改成了100,直接内存给干爆了)。具体修改如下,仅供参考:
print "Building the problem"#print(parsed.timeoffset_padding) #输出看一眼timeOffsetPadding的值iCal.buildProblem(splineOrder=6, poseKnotsPerSecond=100, biasKnotsPerSecond=50, doPoseMotionError=False,doBiasMotionError=True,blakeZisserCam=-1,huberAccel=-1,huberGyro=-1,noTimeCalibration=parsed.no_time,noChainExtrinsics=(not parsed.recompute_chain_extrinsics),maxIterations=parsed.max_iter,#timeOffsetPadding=parsed.timeoffset_padding, #原来的代码timeOffsetPadding=0.3, #修改后verbose = parsed.verbose)
修改后再从新进行标定即可。