Calibration & Time Synchronization

Two sensors on one robot never share a spot or a clock. Stamp a LiDAR 10 ms late and, at 30 m/s, its points land 30 cm behind the car the camera sees. At rest the same error is zero.

Drag the speed and pick how the rig keeps its clocks. Watch the warm LiDAR points slide off the blue camera box. Then we build it piece by piece: each sensor's own numbers, the mount, the time offset, the sync hardware, and the motion that makes it all measurable.

You need a rotation as a 3 by 3 matrix and a little arithmetic. We build the rest from zero.

Lesson 15 of 22 in Sensor Fusion: Classical to Modern. It follows INS/GNSS Coupling and leads to Visual-Inertial Odometry.

Paint LiDAR onto the camera

12 m/s

Illustrative: gap = speed × offset. 10 ms stands for an unsynced driver delay (illustrative). 0.5 ms is the size of the online estimate's error in Qin and Shen's simulations (RMSE 0.36 to 0.68 ms). 1 µs stands for PTP, which IEEE 1588 rates in the sub-microsecond range.

Chapter 0

The Filter That Was Fine

See how a wrong mount or a late clock grows with motion and hides at rest

You build a camera and IMU filter. The equations check out and you tuned the noise. On the robot, the estimate drifts whenever the robot turns fast. When it stops, the drift stops. You check the filter again. It is fine.

Every lesson so far assumed that two readings arrive in one frame and on one clock. Real sensors give neither. Each one sits at its own place on the robot and keeps its own clock. Two unknowns decide whether fusion works:

  1. Extrinsics. Where sensor B sits relative to sensor A: a rotation R and a translation t, six numbers.
  2. Time offset td. How late one sensor's timestamps are against the other's, in milliseconds.

Calibration is the job of finding them. Each sensor also has private numbers, its intrinsics, which Chapter 1 covers.

Spin the rig

The rig carries an IMU and a camera. Set a mount error and a clock error, then turn the rig faster. Both errors are lines through zero.

1.00 rad/s
2.0 cm
5.0 ms

Illustrative: exact small-error formulas. Phantom velocity is turn rate times mount error. Image error is focal length (500 px) times turn rate times clock offset, for a feature near the image centre.

How big is the error? Call the speed of the thing you measure v, and the time offset t-d. A reading stamped t-d late shows the world as it was t-d earlier. So it is off by the distance moved in that time.

Say it aloud

e equals v times t-d.

e
e the error: metres for a car, pixels for a feature in the image.
v
v the speed of what you measure: m/s for a car, px/s for a feature.
td
t-d the time offset: how late the stamp is, in seconds.
In plain words

Multiply the speed v by the offset t-d. That is how far the world moved between the real instant and the stamp.

With numbers

A car passes at v = 30 m/s and the LiDAR stamps run t-d = 10 ms late: e = 30 × 0.010 = 0.30 m. A camera with a 500 px focal length turns at 1 rad/s, so a feature near the centre moves at about 500 px/s. With t-d = 5 ms, e = 2.5 px. At rest v = 0, so e = 0.

A wrong mount acts the same way. Say you believe the camera sits on the IMU, but it sits 2 cm away. A turn moves the camera on a circle, at a speed the filter never predicted.

phantom speed = turn rate × mount error = 1 rad/s × 0.02 m = 0.02 m/s

The idea of the lesson. Both errors grow with motion and vanish at rest. A rig that passes every bench test fails in the field, and the filter blames noise.
Failure: tuning the wrong knob. Symptom: residuals grow when the robot moves fast and shrink at rest. Measure: plot the residual size against speed. Fix: calibrate the mount and the clock; do not inflate the noise covariances.

The road

  1. Intrinsics: each sensor's own numbers, from pixels and counts to units.
  2. Extrinsics: move a point from one sensor's axes to another's.
  3. Hand-eye: read the mount from motion with AX = XB.
  4. The lag: slide one rate signal against the other and read the peak.
  5. In the state: Kalibr and VINS estimate the offset with everything else.
  6. Sync hardware: trigger, PPS and PTP remove the offset before software runs.
  7. Observability: the motion that makes each unknown measurable.
  8. Showcase: run a whole calibration session and test it at speed.
  9. Read the symptom: name the fault from how the residual moves.
  10. Field guide: the numbers, the checklist, the code.
Your camera and IMU filter drifts when the rig turns fast. You stop the rig and the residuals fall to almost nothing. What is the most likely cause?

Chapter 1

Each Sensor's Own Numbers

Turn raw pixels and counts into units before you place one sensor against another

Intrinsic calibration maps one sensor's raw output to physical units. It never mentions another sensor. Do it first, because every later step assumes clean units.

A camera's intrinsics say how a ray becomes a pixel. Take a point in front of the camera at sideways position X, height Y and depth Z, in camera axes. Divide by the depth to get the normalised coordinates x = X/Z and y = Y/Z. Call r² = x² + y² the squared distance from the image centre. Real lenses bend rays more near the edge; the radial distortion coefficient k-1 says how much.

Say it aloud

u equals c-x plus f-x times x times, one plus k-one r squared.

u
u the pixel column where the point lands, in px.
cx
c-x the principal point: the column where the optical axis meets the image, near the centre.
fx
f-x the focal length, measured in pixels.
x
x the normalised coordinate: sideways position X divided by depth Z.
k1
k-one the radial distortion coefficient. Negative is barrel distortion: the edges pull in.
r²
r squared x squared plus y squared: how far out from the centre the ray is.
In plain words

Divide the sideways position by the depth to get x. Bend it by one plus k-one r squared. Scale by the focal length f-x and shift by the principal point c-x. The row v follows the same rule with f-y, c-y and y.

With numbers

With made-up numbers: f-x = 500 px and c-x = 320 px. A point at the corner of a 640 by 480 image has x = 0.64 and y = 0.48, so r² = 0.64. With k-one = −0.2 the bend is 1 − 0.128 = 0.872, and u = 320 + 500 × 0.64 × 0.872 = 599 px. Ignore the distortion and you expect 640 px: 41 px off in u, 51 px off along the radius.

Bend a grid through a lens

The dashed grid is what a perfect pinhole would see. Blue is what the lens records. Drag k-one, then switch on the correction.

−0.20

Illustrative: a 640 by 480 camera, focal length 500 px, centre (320, 240), one radial term. Real models add k-two, k-three and two tangential terms.

Zhang's method (2000) finds the focal length, centre and distortion from photos of a flat checkerboard in a few poses, at least two. It starts from a closed-form answer, then refines it by maximum likelihood.

The IMU has private errors too, one set per axis. A bias b is an offset at rest. A scale factor error s puts the reading off by a fraction. Misalignment means the axes are not exactly square. For one axis, call the true rate x and the reading m.

m = (1 + s) · x + b  ·  s = 0.005: a 360°/s spin reads 361.8°/s, 1.8°/s too much

Lesson 13 removed the turn-on bias by averaging at rest. A scale factor needs motion of a known size, such as a rate table or a measured full turn.

Failure: a mount fit on top of bad intrinsics. Symptom: residuals small in the image centre and large at the edges, in a ring. Measure: reprojection error against distance from the centre. Fix: recalibrate the distortion with target views that fill the corners.
Your camera's focal length and lens distortion are slightly wrong. Which kind of calibration is at fault?

Chapter 2

Where One Sensor Sits From Another

Move a point from one sensor's axes to another's, and see which error matters near and far

Extrinsic calibration finds the rigid transform between two sensors: how sensor A's axes turn relative to sensor B's, and where A's origin sits in B's axes. A car's LiDAR and camera are the clear case. To paint a LiDAR point onto the image, you move it into camera axes, then project it with the intrinsics of Chapter 1.

Call a point in sensor A's axes p-A, and the same point in sensor B's axes p-B. Call the rotation from A's axes to B's axes R, a 3 by 3 matrix. Call the position of A's origin in B's axes t.

Say it aloud

p-B equals R times p-A, plus t.

pB
p-B the point in sensor B's axes (the camera), in metres.
R
R the rotation from A's axes to B's axes: three angles packed in a 3 by 3 matrix.
pA
p-A the same point in sensor A's axes (the LiDAR).
t
t the translation: where A's origin sits in B's axes, three distances in metres.
In plain words

Turn the point p-A with R so it uses B's axes. Then shift it by t. Six numbers fix R and t: three angles and three distances.

With numbers

With made-up numbers: p-A = (1.0, 0.5, 20.0) m, R a 1° turn about the vertical axis, t = (0.10, −0.05, 0.02) m. Then p-B = (1.449, 0.450, 20.000) m. Leave out the 1° and the point projects 8.8 px too far left with a 500 px focal length.

Overlay LiDAR on a pole

The blue bar is the pole in a zoomed camera view. Warm dots are LiDAR returns from the pole, moved with your mount. Add a rotation or a translation error, then move the pole near and far.

0.50°
5.0 cm
2.0 m

Illustrative: focal length 500 px, both errors sideways and in the same direction. Exact projection, so the two shifts add.

The two errors behave differently. A rotation error shifts every point by about f × tan(angle) pixels at any depth. A translation error shifts a point at depth Z by f × error / Z, so it fades with distance.

0.5°: 500 × tan 0.5° = 4.4 px at every depth  ·  5 cm: 500 × 0.05 / 2 = 12.5 px at 2 m, 1.3 px at 20 m

So check the rotation on far targets and the translation on near ones. For a camera and an IMU, the translation is the lever arm. It sets the phantom speed of Chapter 0.

Failure: an overlay that is right only far away. Symptom: LiDAR points sit on distant poles but slide off near ones. Measure: pixel error against depth; a 1/Z shape points at the translation. Fix: re-estimate t with near targets in view.
LiDAR points land on far poles but miss near ones by several pixels. Which part of the extrinsic is most likely wrong?

Chapter 3

AX = XB: Read the Mount From Motion

Compare how two bolted sensors each see one motion, and solve for the bolt

A ruler cannot measure millimetres and fractions of a degree inside a robot. But a bolt holds the two sensors together, so they move as one. Each reports the same motion in its own axes, and that is enough to recover the bolt.

Write every pose and motion as a rigid transform: a rotation plus a translation. Call sensor A's motion between two instants A. Call the same motion, as sensor B reports it, B. Call the unknown pose of B in A's axes X.

Now go from B at the end back to A at the start. Move with A, then step across to B. Or step across first, then move with B. Both routes reach the same place.

Say it aloud

A times X equals X times B.

A
A sensor A's motion between two instants, from its own data, such as an arm's encoders.
X
X the unknown extrinsic: the pose of sensor B in A's axes. It never changes.
X
X the same extrinsic on the right-hand side.
B
B the same motion in sensor B's axes, such as a camera tracking a target.
·
times chain two rigid transforms into one.
In plain words

Chain A with X, and chain X with B. The two chains must match for every motion. Record several motions and find the one X that makes all of them match best.

With numbers

Rotations only: let R-X be a 90° turn about z. A turn about A's axis (1, 0, 0) shows in B about (0, −1, 0). Check: R-X turns (0, −1, 0) into (1, 0, 0), so the axes match through the mount.

Split each transform into a rotation R and a translation t, and the equation splits in two. Call the turn axis of A's motion α (alpha) and of B's β (beta), each as long as its angle. I is the identity matrix.

rotation: RA RX = RX RB, so α = RX β

translation: (RA − I) tX = RX tB − tA

Solve the rotation first: find the R-X that best lines up every α with its β. The translation line is then linear in t-X: stack it over all motions and solve. Tsai and Lenz (1989) gave this rotation-first split; Park and Martin (1994) gave a closed-form least-squares rotation.

Fit the mount from motions

Each press records one motion seen by both sensors. Top: the fitted mount's rotation error; bottom: its translation error. Add varied turns, then reset and try turns about z.

Illustrative toy: true mount 90° about z and (5, −2, 10) cm. Each motion turns 0.5 to 1 rad, with 0.01 rad and 2 mm of noise per sensor.

Over 200 seeded runs of this toy, the median rotation error is 1.1° after 5 varied motions and 0.33° after 40; the translation error falls from 6.4 mm to 1.4 mm. With turns about z only, the error stays near 90°.

Failure: one axis only. Symptom: the fitted mount changes a lot between sessions. Measure: the spread or covariance of R-X. Fix: turn about at least two axes that are not parallel.

The Code Lab solves the rotation the Tsai and Lenz way: one linear constraint per motion, skew(α + β) x = β − α, then x back to R-X.

In AX = XB, what are A, B and X, and why must the equation hold?

Chapter 4

Find the Lag by Sliding

Slide one sensor's rate signal against the other's and read the lag at the peak

Every reading carries a timestamp, and the stamp is not the instant the sensor sampled. Triggering, transfer and a separate clock all add delay. Qin and Shen (2018) define the time offset t-d by t-IMU = t-cam + t-d: the amount to add to the camera stamps so that the two streams agree.

Both sensors see the same rotation. The gyro measures the turn rate directly. The camera gives it too: track features between frames and work out how far the camera turned. Compare the size of the rate, not its direction, so the unknown mount rotation does not matter. If the camera stamps are late, its curve is the gyro's curve shifted to the right.

Slide the camera curve

Warm is the gyro's turn rate, blue is the camera's. Drag the shift until the curves line up and the pink score peaks. Then make the motion gentle.

0 ms

Illustrative toy: 20 s of motion, gyro at 200 Hz, camera rate at 30 Hz, true offset 25 ms, small noise on both. The score is the normalised correlation. Gentle motion is the same path at one tenth of the speed.

Call the gyro's rate size g, the camera's rate size h, the camera stamps t-k, and a trial shift tau. Score each shift by how well the curves agree, and keep the best.

Say it aloud

t-d-hat equals the tau that makes largest the sum over k of g at t-k minus tau, times h at t-k.

t̂d
t-d-hat the estimated time offset, in seconds. The hat marks an estimate.
argmaxτ
the tau that makes largest try every trial shift tau and keep the one with the biggest score.
Σk
the sum over k add one term for each camera stamp.
g(tk − τ)
g at t-k minus tau the gyro's rate size, read tau seconds before camera stamp t-k, by interpolation.
h(tk)
h at t-k the camera's rate size at its stamp t-k.
In plain words

For a trial shift tau, read the gyro curve g tau earlier than each camera stamp t-k. Multiply by the camera value h and add the products. The shift with the biggest total lines the curves up. That shift is t-d-hat.

With numbers

With made-up numbers: g = 0, 1, 3, 1, 0, one sample every 10 ms, and h is the same curve one sample late: 0, 0, 1, 3, 1. Shift 0 scores 6. Shift 10 ms scores 0×0 + 1×1 + 3×3 + 1×1 = 11. Shift 20 ms scores 6. The peak says t-d-hat = 10 ms.

In practice, subtract each curve's mean first and divide by their sizes, so the score runs from −1 to 1. Over 100 seeded runs of this toy, the mean is 25.0 ms and the spread 0.6 ms. At one tenth of the motion the spread grows to 7.8 ms. Motion is the signal.

Failure: a peak with no motion. Symptom: the estimate jumps by tens of milliseconds between runs. Measure: the sharpness of the peak; a flat score means the data hold no information. Fix: record lively motion whose turn rate keeps changing.

The Code Lab scores shifts by the sum of squared differences and keeps the smallest. For curves of fixed size this picks the same shift, because (a − b)² = a² − 2ab + b², and only the product term depends on the shift.

Why does the lag search give a sharper, more precise answer when the rig moves faster?

Chapter 5

Put the Offset in the Estimator

Let a batch fit or a running filter estimate the offset with everything else

The slide finds one number from a special recording. Two well-known tools go further. They estimate the offset inside the same fit that estimates the motion and the mount.

Kalibr (Furgale, Rehder and Siegwart, 2013) is a batch method. It writes the rig's trajectory as a B-spline: a smooth curve built from a few control points, which you can read at any instant. Kalibr compares each measurement with the curve at its own stamp plus the offset. Changing the offset only moves where the curve is read. So the offset becomes one more unknown in a maximum-likelihood fit, next to the extrinsics. The curve idea comes from Furgale, Barfoot and Sibley (2012).

The online method in VINS-Mono (Qin and Shen, 2018) runs while the robot moves. Over a few milliseconds a feature moves at nearly constant speed across the image. So a late stamp is the same as a small slide of the feature along its own velocity. Call a feature's measured pixel position z, its velocity in the image V, and the offset t-d.

Say it aloud

z of t-d equals z plus t-d times V.

z(td)
z of t-d the feature position moved onto the IMU's clock, in px.
z
z the feature position measured at the camera stamp, in px.
td
t-d the time offset, in seconds. The estimator treats it as a state.
V
V the feature's velocity in the image, in px/s, from its positions in two frames.
In plain words

Measure how fast the feature moves in the image, V. Multiply by the offset t-d and add it to the measured position z. The estimator adjusts t-d, like any other state, until camera and IMU agree.

With numbers

V = 200 px/s and t-d = 10 ms: the feature slides 2 px. Qin and Shen simulated an IMU at 100 Hz and a camera at 10 Hz, 100 trials per offset. True offsets of 5, 15 and 30 ms came out as 5.12, 15.06 and 30.17 ms, with RMSE 0.36 to 0.68 ms.

Watch the offset settle

The estimator starts from 0 ms with a wide purple band. The dashed line is the true offset, 10 ms. Run it with rich motion, then with slow motion.

Illustrative: a one-state recursive least-squares filter. Each camera frame, 30 a second, gives 4 features with 0.5 px noise. Rich motion moves features at about 60 px/s, slow motion at about 1 px/s, as on a hovering drone. Prior: 0 ms with a standard deviation of 20 ms.

Rich motion pins the offset to under 1 ms within about a second. Slow motion leaves the band wide: a 1 px/s feature slides only 0.01 px for a 10 ms offset, far below the 0.5 px noise.

Failure: an offset that wanders. Symptom: t-d drifts while the robot hovers or drives straight. Measure: the offset's variance in the filter; it should shrink only when the robot moves. Fix: seed it from an offline calibration, and slow or freeze its update when the motion is weak.
How does VINS-Mono's online method make the time offset something the estimator can correct?

Chapter 6

Remove the Offset in Hardware

Trigger, pulse and exchange timestamps so the offset is near zero before software runs

Estimation removes a constant offset. It cannot remove jitter, a delay that changes from sample to sample. A software stamp, taken when the data reaches the computer, carries the whole driver and bus delay, and that delay varies. The cure is to stamp the data at the sensor, against one shared clock. Three tools do it:

  1. Hardware trigger. One electrical line starts the camera exposure and marks the IMU sample on the same edge.
  2. PPS. A GNSS receiver's pulse-per-second line marks the start of each second. A timing receiver such as the u-blox NEO-M8T lists 20 ns or better under open sky. Sensors and computers lock their clocks to that edge.
  3. PTP. The Precision Time Protocol, IEEE 1588, has devices on a network swap stamped messages and solve for their clock offset. The standard targets the sub-microsecond range.

PTP rests on four timestamps. The master sends a message at t-1 on its own clock, and the slave receives it at t-2 on the slave's clock. The slave replies at t-3, and the master receives the reply at t-4. Assume the trip takes the same time each way. Call the slave clock minus the master clock theta.

Say it aloud

theta equals, t-two minus t-one, minus, t-four minus t-three, all over two.

θ
theta the clock offset: the slave clock minus the master clock, in microseconds.
t2 − t1
t-two minus t-one the outbound trip as the two clocks see it: the path delay plus theta.
t4 − t3
t-four minus t-three the return trip as the two clocks see it: the path delay minus theta.
/ 2
over two the difference holds theta twice, so halve it.
In plain words

The outbound gap t-two minus t-one is delay plus offset. The return gap t-four minus t-three is delay minus offset. Subtract the second from the first: the delay cancels and two thetas remain. Halve it.

With numbers

With made-up numbers: t-1 = 0, t-2 = 150, t-3 = 300 and t-4 = 250 µs. The outbound gap is 150 and the return gap is −50. Theta = (150 + 50) / 2 = 100 µs, and the one-way delay is (150 − 50) / 2 = 50 µs.

Swap four timestamps

The left line is the master's clock, the right line the slave's. Pink arrows are the two messages. Set the true clock offset, then make the path slower one way than the other.

100 µs
0 µs

Illustrative: a mean one-way delay of 50 µs and a 150 µs pause before the reply. Asymmetry makes the outbound trip longer and the return shorter by half the amount each.

If the path takes 60 µs out and 40 µs back, the estimate is off by (60 − 40) / 2 = 10 µs. Half of any asymmetry lands in theta, and nothing in the four stamps can reveal it. That is why PTP networks use switches that stamp packets in hardware.

A camera adds one more delay: the exposure. Qin and Shen found the estimated offset grows with exposure time at a slope of about 0.5, because the best instant to stamp an image is mid-exposure. With a 20 ms exposure, that is 10 ms of offset.

Failure: synced clocks, late stamps. Symptom: PTP reports microseconds, yet camera residuals still grow with speed. Measure: estimate t-d from motion anyway, as in Chapter 4. Fix: stamp at the sensor and at mid-exposure; a shared clock does not help a stamp taken in the driver.
A PTP exchange reads t-1 = 0, t-2 = 150, t-3 = 300, t-4 = 250 µs. What is the slave's clock offset?

Chapter 7

You Cannot Calibrate What You Do Not Move

Match each unknown to the motion that reveals it, and read the spread, not only the answer

A parameter is observable when changing it would change the data. If no measurement would notice the change, the data cannot tell you its value. The solver still prints a number, filled by noise or by your first guess.

For the offset, the information comes from motion. A late stamp slides each feature by the offset times its velocity (Chapter 5). If features barely move, the slide hides inside the pixel noise. Call the pixel noise sigma-z, the typical feature speed V, and the number of feature measurements N.

Say it aloud

sigma-t-d equals sigma-z over, V times the square root of N.

σtd
sigma-t-d the spread of the offset estimate: one standard deviation, in seconds.
σz
sigma-z the pixel noise of one feature measurement, in px.
V
V the typical feature speed in the image, in px/s (strictly, the root mean square).
√N
the square root of N N is the number of feature measurements; averaging N of them shrinks the spread by root N.
In plain words

Divide the pixel noise sigma-z by the feature speed V: that is the offset one measurement can resolve. Average N measurements and the spread shrinks by the square root of N.

With numbers

sigma-z = 0.5 px and N = 1,000, so root N = 31.6. At V = 100 px/s, sigma-t-d = 0.5 / (100 × 31.6) = 0.16 ms. At V = 5 px/s it is 3.2 ms. A seeded simulation of the first case gives 0.157 ms.

Every unknown has a motion that reveals it, and a motion that hides it:

MotionWhat stays hiddenWhy
Stillthe offset and the mount rotationnothing changes, so there is nothing to compare
Glide on a railthe mount rotation, and the offsetno turns; at constant speed a time shift looks like a fixed position shift
Turns about one axisthe mount's turn about that axisboth sensors agree on that axis whatever the mount (Chapter 3)
Full motionnothingturns about all three axes, moves along all three, at changing speed

Excite the unknowns

Each purple bar is the spread of one unknown, on a log scale. The green line is good enough. Pick a motion and record for 60 s.

Illustrative information model. Each second adds one turn of 0.8 rad; its axis pair informs the two mount angles across that axis (0.014 rad of combined noise). When the motion changes speed, each second also adds 30 frames of 20 features at 150 px/s with 0.5 px noise. Prior: 5° and 20 ms. Good enough: 0.2° and 0.5 ms.

Failure: confident garbage. Symptom: the calibration converged, and the system works on some days and fails on others. Measure: the standard deviation of every calibrated parameter, not only its value. Fix: recalibrate with full motion: turn about all axes, move along all axes, change speed.
You calibrate a camera and IMU by sliding the rig smoothly along a rail. The solver converges and reports a mount rotation. Should you trust it?

Chapter 8

Showcase: Run a Calibration Session

Pick the motion, the length and the stamps, then read the report card and the speed test

Here is a camera and IMU session in miniature. The toy rig hides a mount, 90° about z and (5, −2, 10) cm, and a time offset of 25 ms. You choose how to move it, for how long, and where the stamps come from.

Run a session. The toy fits the mount with the least-squares fit of Chapter 3 and finds the offset with the slide of Chapter 4. The report card shows each error against a target: under 1° for rotation, under 1 cm for translation, under 1 ms for the offset.

Then it validates. It turns the rig faster and faster, applies the calibrated values, and plots the image error left over. A flat line means the calibration holds at speed. A line that climbs with speed means a leftover offset. A line that starts high means a leftover mount error.

Calibrate a camera and IMU

Top: the three errors against their targets. Bottom: leftover image error against turn rate. Start with the rail, then try one axis, then full motion, then shorten it.

60 s

Illustrative toy: one motion every 2 s for the mount fit (same noise as Chapter 3) and a gyro at 200 Hz with a camera at 30 Hz for the lag search. Driver stamps add 4 ms of random jitter per frame. Validation residual: f × tan(rotation error), plus f × turn rate × offset error, plus the lever-arm term over 0.1 s for features at 3 m. f = 500 px, noise 0.3 px.

With full motion for 60 s and stamps at the sensor, every bar lands under its target and the validation line stays flat. The rail leaves both the rotation and the offset unknown. One axis finds the offset but not the mount's turn about z. Switch to driver stamps: the offset still comes out right on average, but the speed test fans out, because jitter changes every frame.

Failure: validated slow, deployed fast. Symptom: the calibration passes on the bench and fails on the road. Measure: the residual at the top speed the robot will see. Fix: always run the speed test up to the deployed speed.
After calibration, the validation residual is near zero at rest and climbs in a straight line with turn rate. What is left over?

Chapter 9

Read the Symptom

Name the calibration fault from how the residual changes with speed and with time

Every calibration fault looks like a filter that is a bit off. Their shapes differ. Plot the residual against speed, and against time, and each fault shows its own fingerprint.

Diagnose a rig

Each choice plants one fault in a 10-minute log. Dots are residuals, the line is the trend. Switch the axis between turn rate and time.

Illustrative faults: a 5 ms offset, a 0.3° mount rotation, or a mount that creeps 0.4° as the rig warms. The lever arm is 3 cm, seen as phantom speed over 0.1 s for features 1 to 4 m away. Focal length 500 px, 0.3 px noise.

A time offset gives a line through zero. Its slope gives the offset back:

1.5 px at 0.6 rad/s and 3.0 px at 1.2 rad/s: slope 2.5 px per rad/s, so t-d = 2.5 / 500 px = 5 ms

FingerprintCauseFix
Zero at rest, a straight line with speedtime offsetestimate t-d (Chapter 4), stamp at the sensor
A constant offset at every speedmount rotationrefit with turns about several axes
Grows with turn rate, larger for near featureslever arm (mount translation)refit t-X with near targets and turns
Fine when cold, worse with time or heatthermal or mechanical driftonline calibration, a stiffer mount
A huge variance on one parametertoo little excitationrecalibrate with full motion
Random, centred, flat with speedreal sensor noisethe only case where you tune the noise covariances
Failure: hiding calibration in the noise model. Symptom: you raise the measurement noise until the filter stops complaining. Measure: residual against speed; a trend means structure, not noise. Fix: find the offset or mount error; covariance tuning only hides it.
Rig A shows a constant pixel offset at every speed. Rig B shows almost no error at rest and an error that grows in a line with speed. What is wrong with each?

Chapter 10

Field Guide

Keep the equations, the numbers, the checklist and the code in one place

Fusion assumes one frame and one clock, and calibration earns that assumption. Intrinsics turn each sensor's raw output into units. Extrinsics place one sensor in the other's axes, read from motion through AX = XB. You find the time offset by sliding rate signals, estimate it as a state, or remove it with hardware stamps. None of it works without the motion that makes it observable.

QuantityFormulaNumbers from this page
Error from an offsete = v · td30 m/s, 10 ms: 30 cm; 500 px/s, 5 ms: 2.5 px
Lever-arm speedturn rate × mount error1 rad/s, 2 cm: 2 cm/s
Pinhole with distortionu = cx + fx x (1 + k1 r²)corner, k-one −0.2: 599 px, not 640
Extrinsic transformpB = R pA + t1° left out: 8.8 px at 20 m
Hand-eyeA X = X Btoy: 1.1° after 5 motions, 0.33° after 40
Lag searcht̂d = argmaxτ Σ g(tk − τ) h(tk)toy: 25.0 ms, spread 0.6 ms
Offset as a statez(td) = z + td V200 px/s, 10 ms: 2 px
PTP offsetθ = ((t2 − t1) − (t4 − t3)) / 2100 µs; 20 µs asymmetry: 10 µs error
Offset spreadσtd = σz / (V √N)0.16 ms at 100 px/s; 3.2 ms at 5 px/s

Checklist

  1. Calibrate each sensor's intrinsics first, with targets that fill the image corners.
  2. Stamp at the sensor: hardware trigger, PPS or PTP. Stamp images at mid-exposure.
  3. Record full motion: turns about all three axes, moves along all three, at changing speed.
  4. Fit the mount (rotation first, then translation) and the offset, together if your tool allows.
  5. Read the standard deviation of every parameter, not only its value.
  6. Validate on held-out data and at the top deployed speed.
  7. Run online refinement around the offline seed if the mount or clock can drift.
pythonimport numpy as np

def estimate_td(t_imu, gyro_rate, t_cam, cam_rate, taus):
    # slide the gyro curve; keep the shift with the best normalised correlation
    b = cam_rate - cam_rate.mean()
    def score(tau):
        a = np.interp(t_cam - tau, t_imu, gyro_rate); a = a - a.mean()
        return a @ b / np.sqrt((a @ a) * (b @ b))
    return taus[np.argmax([score(t) for t in taus])]   # t_IMU = t_cam + t_d

def fit_mount(alphas, betas, RAs, tAs, tBs):
    # rotation: least-squares R with alpha_i = R beta_i (Park and Martin; SVD form)
    M = sum(np.outer(b, a) for a, b in zip(alphas, betas))
    U, S, Vt = np.linalg.svd(M)
    D = np.diag([1, 1, np.sign(np.linalg.det(Vt.T @ U.T))])
    R = Vt.T @ D @ U.T
    # translation: stack (R_A - I) t_X = R t_B - t_A and solve by least squares
    C = np.vstack([RA - np.eye(3) for RA in RAs])
    d = np.hstack([R @ tB - tA for tA, tB in zip(tAs, tBs)])
    t, *_ = np.linalg.lstsq(C, d, rcond=None)
    return R, t, S   # a tiny last value in S means a degenerate (one-axis) data set

Where calibration runs

SystemWhat it needsHow teams find it
Visual-inertial odometrycamera intrinsics, camera to IMU mount, t-da Kalibr-style batch run, then online refinement
Self-driving sensor rigsevery LiDAR, camera and radar mount; one clocktargets or scene edges; PTP or PPS with hardware stamps
Headsetscamera to IMU mounts and offsetsfactory calibration, then online tracking of flex and heat
Robot arms with camerascamera to gripper mounthand-eye AX = XB at setup, again after a bump

Keep going

References

The takeaway. A filter fuses what it is told: where each sensor is and when it spoke. Find the mount from motion, find the clock from motion, stamp at the sensor, and move enough that every unknown shows.
A teammate says the VIO filter works on the old rig, so it will work on the new one. What does this lesson say?

Now press Present or Teach and derive the seven equations from memory, from the error of an offset to the offset spread. Then go back to the car and say why the gap vanishes at rest.

Credit

Lesson 15 of 22 in Sensor Fusion: Classical to Modern on Engineermaxxing. The methods follow the papers above. Every toy number on this page carries the word illustrative.

Sensor Fusion: Classical to Modern · Lesson 15: Calibration & Time Synchronization
Previous: INS/GNSS Coupling · Next: Visual-Inertial Odometry · Back to Gleams