Localization & SLAM · Theory · M6
M6-T8 — Sensor Calibration and Synchronization
SLAM trusts its inputs. If the geometry or the clocks of the sensors are wrong, no estimator can notice, so it has to be right before the data reach it.
Every residual in a SLAM system contains a model of the sensor: where it sits on the robot, how its lens bends light, and when each measurement was taken. Those parameters are measured once, by calibration, and then assumed. When they are wrong the estimator does not fail loudly; it converges to a slightly wrong answer, or invents a bias to explain the inconsistency. This lesson covers the three families of calibration (intrinsic, extrinsic, temporal), how they are done, and the size of the errors that result.
Learning objectives
After this lesson, you should be able to:
- Distinguish intrinsic, extrinsic and temporal calibration and say what each one affects.
- Estimate the pixel and position errors caused by a time offset or a lever-arm error.
- Describe how a camera, a camera–IMU pair and a time offset are calibrated.
- Explain rolling-shutter distortion and the difference between hardware and software timestamps.
The problem and the intuition
Imagine tracking a ball by combining two reports: a friend in the stand says where it is, and a radio commentator says where it was a moment ago. If you do not know the commentator is 0.3 s late, you will conclude the ball is behind where your friend says, and you will try to explain the gap by inventing a breeze. A SLAM estimator does the same. An unmodelled time offset between camera and IMU is explained as a gyroscope bias; a wrong lever arm between IMU and camera is explained as an accelerometer bias; a wrong focal length is explained as a scale error. The estimator is not wrong in its logic; it is given the wrong model.
Calibration comes in three kinds. Intrinsic: the properties of one sensor (focal length, principal point, distortion). Extrinsic: where the sensors are relative to each other (a rigid transform). Temporal: when each sensor’s time stamp is relative to the others.
Calibration errors masquerade as other errors. Before blaming drift on the algorithm, check that the sensors’ geometry and clocks are right.
The three calibrations and how they are done
Problem. Determine, with enough accuracy that they are negligible compared with the sensor noise, the intrinsic parameters of each sensor, the rigid transforms between sensors, and the time offsets between their clocks.
Assumptions. The sensors are rigidly mounted (extrinsics are constant); the intrinsics do not change with temperature or focus beyond tolerance; time offsets are constant over the run or slowly varying; the calibration target is known and observed with sufficient excitation.
Intrinsic calibration (camera)
Zhang’s method (2000): observe a planar target with known geometry (a checkerboard or an AprilGrid) from many orientations and minimise the reprojection error over the intrinsics (fx, fy, cx, cy), the distortion coefficients and the target pose in each image. The quality measure is the final reprojection RMS (a good result is a fraction of a pixel, typically below 0.3 px) and, more usefully, whether it is uniform across the image. Cover the corners of the image, because that is where distortion is largest, and vary the tilt.
Extrinsic calibration
The rigid transform TCI between camera and IMU, or between camera and lidar, is estimated by moving the rig in front of a target with enough rotation about all axes and acceleration along all axes (Furgale et al., 2013, the Kalibr toolbox). The camera sees the target and provides its pose; the IMU measures rotation rate and acceleration; the optimisation finds TCI, the biases and the time offset that make them consistent. Excitation matters: motion about a single axis leaves parts of the transform unobservable.
Temporal calibration
Two clocks are rarely the same. The offset td in tIMU = tcam + td can be estimated offline (Kalibr, or by cross-correlating the angular-velocity magnitude from the camera and from the gyroscope, the subject of the fourth lab of this module) or online in the estimator (VINS-Mono, OpenVINS). Better still, avoid the problem with hardware synchronisation: trigger the camera from the same clock that stamps the IMU, or use a shared time source (PPS, PTP) and stamp each measurement at the time of exposure rather than the time the driver delivered it.
Rolling shutter
Most consumer cameras read the sensor row by row, so the top and bottom rows of one image are taken tens of milliseconds apart. A moving camera therefore produces a skewed image: each row has its own pose. The effect is the visual analogue of lidar motion distortion (M5-T2). It can be modelled by letting the pose vary linearly over the readout time and estimating the readout time as a calibration parameter, or avoided with a global-shutter sensor.
- K, ki
- intrinsic matrix and distortion coefficients (M6-T1).
- TCI
- extrinsic transform from the IMU frame to the camera frame.
- td
- time offset between the camera and IMU clocks.
- tr
- rolling-shutter readout time from first to last row.
Effects of calibration errors
| Wrong parameter | Error it produces | How it shows |
|---|---|---|
| Focal length or principal point | Bearing errors that grow with the angle from the axis; scale errors in stereo | Systematic reprojection residuals; stereo depth biased |
| Distortion | Shift of tens of pixels near the corners | Residuals that grow with radius; bent straight lines |
| Extrinsic rotation | Camera and IMU disagree about every turn | Gyroscope bias that depends on the manoeuvre |
| Extrinsic translation (lever arm) | Centripetal and tangential accelerations mis-attributed | Accelerometer bias that changes with rotation |
| Time offset | Pixel error ≈ f·ω·Δt during rotation | Residuals correlated with angular velocity; bias drift |
| Rolling shutter | Image skew proportional to motion and readout | Larger residuals at top and bottom rows during fast motion |
A worked example: sizing the errors
- Time offset. The IMU clock is 10 ms ahead of the camera clock and the robot turns at 2 rad/s. The attitude seen by the IMU at the time of the image differs by ω Δt = 2 × 0.010 = 0.02 rad ≈ 1.15°. A camera with f = 600 px sees a rotation of 0.02 rad as a shift of 600 × 0.02 = 12 px. A 12 px mismatch is far bigger than the sub-pixel residuals a tracker achieves, so the estimator must explain it: it will bias the gyroscope or degrade the features’ weight.
- Rolling shutter. A sensor with a 30 ms readout and the same 2 rad/s rotation: the bottom row is taken 0.06 rad later than the top row, a 36 px skew over the image if ignored.
- Lever arm. The IMU is mounted 5 cm from the camera but the extrinsic says 0. During a turn at 2 rad/s the centripetal acceleration at 5 cm is ω² r = 4 × 0.05 = 0.2 m/s². If this is read as accelerometer bias for the 5 s of the turn, it integrates to ½ × 0.2 × 25 = 2.5 m. The same magnitude as a poor accelerometer bias (M6-T6), from a ruler error.
- Sampling versus offset. At 20 Hz a camera frame has a period of 50 ms; an offset of 10 ms is a fifth of a frame, and not detectable by eye. Because it matters only when the robot rotates, it is often missed in static tests and discovered in the field.
- Intrinsics. A 1% error in focal length means that a point 20° from the optical axis is predicted 0.2 × (tan 20° × 600 px ≈ 218 px) ≈ 2.2 px off. Small, but systematic and in the same direction for every landmark, so it biases the whole map.
Engineering implications and limitations
Engineering implications
- Calibrate the actual rig, after it is assembled and mounted, and repeat when anything is knocked, re-focused or re-mounted. Keep the result with the dataset.
- Use rich motion for extrinsics. Rotate about all three axes and accelerate along all three; check the estimated parameter covariances rather than only the residual.
- Prefer hardware synchronisation. Trigger the camera from the IMU clock or use PTP/PPS and stamp at mid-exposure. Software stamps (arrival time) include variable USB and driver latency of several to tens of milliseconds.
- Check the offset as part of bring-up. Compare the gyro norm with the camera-derived angular-speed norm and look at their cross-correlation peak. A peak away from zero lag is a clock problem.
- Monitor temperature drift of intrinsics and biases in long deployments; re-estimate online if the estimator supports it.
- Know what is estimated online. Check the estimator’s output for td and TCI: if they wander during a run, the calibration or the excitation is poor.
Limits
Calibration is only as good as its target observations, its model, and the excitation of the calibration motion. Parameters change slowly with temperature, vibration and wear, and some effects (rolling shutter, auto-exposure latency, lens heating) are not captured by the standard model. The standard approach also assumes a constant time offset, which is false when the clocks drift or the driver’s buffering varies.
Common misconceptions
“A small time offset is harmless because it is only milliseconds.”
During rotation, 10 ms at 2 rad/s is 12 pixels. It matters whenever the platform moves quickly.
“If the reprojection error of the calibration is low, the calibration is good.”
A low RMS can hide bias if the target views did not cover the image corners or the tilt range. Check coverage and parameter uncertainty.
“The estimator will correct any calibration error.”
It can absorb a small error into biases at the cost of accuracy and consistency; large errors make it diverge.
“ROS timestamps are exposure times.”
Most drivers stamp on arrival unless the hardware supports otherwise; the difference is the latency of the transport.
Engineering takeaways
- Intrinsic, extrinsic and temporal calibration each have distinct signatures when wrong.
- Time offset error is about f·ω·Δt pixels: 10 ms at 2 rad/s is 12 px with a 600 px focal length.
- Extrinsic and temporal calibration need rich motion; rotate about all axes and accelerate along all.
- Hardware synchronisation and stamping at the exposure time remove most timing problems.
- Check calibration quality by parameter uncertainty, residuals across the image, and the behaviour of the estimated biases.
References and further reading
Primary papers and authoritative documentation.
- Zhang, Z. (2000). A flexible new technique for camera calibration. IEEE Transactions on Pattern Analysis and Machine Intelligence 22(11).
- Furgale, P., Rehder, J. and Siegwart, R. (2013). Unified temporal and spatial calibration for multi-sensor systems. IEEE/RSJ IROS.
- Furgale, P., Barfoot, T. D. and Sibley, G. (2012). Continuous-time batch estimation using temporal basis functions. IEEE ICRA.
- Qin, T. and Shen, S. (2018). Online temporal calibration for monocular visual-inertial systems. IEEE/RSJ IROS.
- Hartley, R. and Zisserman, A. (2004). Multiple View Geometry in Computer Vision, 2nd ed. Cambridge University Press.
- Rehder, J., Nikolic, J., Schneider, T., Hinzmann, T. and Siegwart, R. (2016). Extending Kalibr: Calibrating the extrinsics of multiple IMUs and of individual axes. IEEE ICRA.
Knowledge check
Three conceptual questions. Write an answer, then reveal the explanation. Your answers stay in your browser.
Question 1
A camera with f = 800 px and a gyroscope are offset by 5 ms while the robot turns at 1.5 rad/s. What pixel error results?
Explanation
The attitude mismatch is ω Δt = 1.5 × 0.005 = 0.0075 rad, which is a shift of f × 0.0075 = 800 × 0.0075 = 6 pixels. This is large compared with sub-pixel tracking noise.
Question 2
The estimated accelerometer bias in a VIO run is small while the robot drives straight and grows whenever it turns. What calibration is likely wrong?
Explanation
A bias should not depend on the manoeuvre. A bias that grows when turning points to a wrong lever arm (extrinsic translation between the IMU and camera), because the centripetal acceleration ω² r is misattributed to the accelerometer.
Question 3
Why is a hardware trigger better than stamping images when the driver receives them?
Explanation
The driver stamp includes the variable latency of exposure, readout, transfer and scheduling, which can be several to tens of milliseconds and not constant. A hardware trigger or a shared clock stamps at exposure and removes this variable error, so the camera and IMU times are consistent.
What’s next
With calibrated sensors and consistent clocks, the final lesson of the module catalogues what still goes wrong in visual SLAM and how to detect and handle it.
Related content
Nothing below is required to finish this lesson.
- BeforeM6-T7: Visual-Inertial SLAM
Compare filter-based (MSCKF) and optimisation-based (VINS-Mono, OKVIS, Kimera-VIO) visual-inertial SLAM.
- LabM6-L4: Diagnose Camera–IMU Synchronization Errors
Estimate the camera-IMU time offset from angular-velocity signals and see what an uncorrected offset does.
Get notified when the next lesson and new labs are released.
One email per new lesson or lab.