A Robot Calibration Cell, From Nothing: The Case Study
This section is a record of one build. A stereo camera with a built-in IMU had to be calibrated in production: mount a camera, press a button, get its calibration. We started with a datasheet, a six-axis robot arm, a printed target and no software, and gave an AI coding assistant one step at a time. Five days later the cell had calibrated eleven cameras of four variants.
Every number on these pages was measured on that cell unless a source is given. Where a sentence states something we saw rather than something a source says, it opens with “In our experience,” as everywhere on this site. The pages keep the mistakes in, because the mistakes are where the method came from.
What was built
Section titled “What was built”| Part | What it does | Page |
|---|---|---|
| Gates | The limits a calibration must meet, written before any result existed | Gates |
| Camera definition | Every fact about the camera with its source, and a check of the datasheet against itself | Camera definition |
| Cell model and viewer | Robot, target, camera and lenses in one frame, with a 3D viewer to approve motions in | Cell model and viewer |
| Camera path | The poses the robot stops at: image coverage, close-ups, and clearance from the robot’s own body | Camera path |
| Robot programs | Program files, start and stop from the computer, and a check of which program really ran | Robot programs |
| Recording and stills | One video per camera; the still frames picked by the camera’s own gyroscope | Recording and stills |
| The solve | Corner refinement, a lens model with decentering terms, held-out images, a target that is not flat | The solve |
| Camera to IMU | The swing path, the time offset and why it moves with exposure, the IMU’s position | Camera to IMU |
| Production station | One button for a technician, and the checks that do not depend on anyone watching | Production station |
| Troubleshooting | Symptom, cause, fix: every fault we met | Troubleshooting |
| All prompts | Every prompt on one page | Prompts |
The camera, the robot, the target
Section titled “The camera, the robot, the target”- Camera: two global-shutter sensors of 1920 x 1200 pixels and one IMU on one board, a fisheye lens of about 190 degrees per sensor, 60 mm between the lenses, both images side by side in one 60 frames-per-second stream, 600 IMU samples per second carried inside the H.264 video. Later variants had a longer lens of about 136 degrees and a larger case.
- Robot: a six-axis arm with 5 kg payload and 871 mm reach (BORUNTE BRTIRUS0805A), programmed through files imported at its pendant and started over the network.
- Target: a Kalibr AprilGrid, 6 x 6 tags of 88 mm, on an 800 mm plate, standing 0.96 m in front of the robot.
The five days
Section titled “The five days”| Day | What happened | Result |
|---|---|---|
| 1 | Gates, camera definition, cell model, path planner, synthetic images with known truth, robot program writer | The whole chain ran on rendered images before any hardware moved: projection within 0.02 px of the truth, baseline within 0.006 mm |
| 2 | Joint directions checked on the real arm, target placed, first real frames | Three of six joints turned the other way from the model; one of the three could not have been guessed from the datasheet |
| 3 | First real calibrations; the edge of the lens would not meet the gate; own solver and corner refinement | Held-out error at 80 to 96 degrees from 1 to 2 px down to 0.3 px |
| 4 | Cell lights; a new path hit the robot’s own body; five cameras; the one-button station | Exposure from 7 ms to 1.5 ms; a clearance rule that every later path had to pass |
| 5 | Three more camera variants; the robot ran the wrong program unnoticed; a path cut from 159 poses to 60 | A run of 2 minutes with the same error as the long one |
The numbers at the end
Section titled “The numbers at the end”In our experience, with this cell, a camera takes about 2 to 3 minutes on the robot and 3 to 5 minutes of processing on a 32-thread desktop computer with no GPU, and the next camera can be mounted while the last one is solved.
| Measure | Value |
|---|---|
| Cameras calibrated | 11, of four variants |
| Mean error on held-out images, per lens | 0.20 to 0.46 px on nine cameras; 0.8 to 1.0 px on two |
| Mean error at 80 to 96 degrees off axis (190 degree lens), held-out | 0.23 to 0.44 px on the cameras that met the gate; 0.5 to 1.3 px on those that did not |
| Baseline, design 60 mm | 59.6 to 60.4 mm |
| Baseline uncertainty from a bootstrap over stills | about 0.06 mm |
| Camera path | 114 poses for the 190 degree lens; 60 for the 136 degree lens |
| IMU to camera time offset | minus 0.4 to minus 2.0 ms at 1.5 ms exposure; minus 3.9 ms at 7 ms exposure on the first camera |
Three failures on the real robot
Section titled “Three failures on the real robot”Each of these passed every check that existed at the time. Each one became a check.
- The camera’s cable support hit the robot. A path extended with far views of the target folded the wrist back onto the arm. The collision check compared the camera with the target, the stand and the floor, and never with the robot that carried it. Six of the 24 new poses had 0 to 3 mm of clearance. See Camera path.
- The robot ran two other programs and the station reported a clean run. An older program package was still loaded with two programs enabled. Nothing failed; the pictures simply were not the ones planned. It was found in the joint log. See Robot programs.
- A first run of a new path was started at half speed while nobody on the engineering side was answering. The rule “first run slow” was an agreement between people. The station now refuses. See Production station.
What we would tell someone starting
Section titled “What we would tell someone starting”- Write the gates first. The edge-of-lens gate drove work that a centre-only number would have hidden: the re-planned path, the corner refinement, the second solver.
- Run the whole chain on synthetic images before the robot moves. It found two crashes in the calibration tool and one misreading of the target’s tag layout while nothing could break.
- Check the tool against the robot’s own body, including the cable, on every pose and every move, and run a new path slowly the first time.
- Data before solver. Short exposure, still frames picked by the gyroscope, corners that are verified or dropped. The lens model mattered less than any of these.
- Judge on images the fit never saw, by angle from the axis, and put a bootstrap error bar on the baseline.
- Make the station check what people forget: that it is recording, at the right frame rate, with the exposure locked, the right program, at a safe speed.
Working with an AI assistant on real hardware
Section titled “Working with an AI assistant on real hardware”The engineering on this cell was done by an AI coding assistant, one step at a time, with a person at the robot. In our experience, these habits mattered more than any single prompt:
- One step, one prompt, one check. Every prompt ends with a check the person runs. A step is done when the check passes, not when the assistant says so.
- Ask what it is guessing. The most useful part of many answers was the list of what the assistant did not know: the meaning of a field in a file format, the size of a cable, which way a joint counts.
- Believe the artefact, not the status. “Recording” on the screen was not a recording. A run that ended cleanly was not the right program. A value on the screen was minutes old. Each time the fix was to look at the thing itself: the file growing, the joint log, the time stamp.
- Numbers before motion. The assistant states the robot’s speed, read at that moment, before anything starts. It once started a run at full speed that was meant to be slow, and warned afterwards.
- No explanation without evidence. A USB stick that the robot could not read was first explained with a confident guess, which the computer’s own log then contradicted. The honest answer was “cause unknown, a second stick works”.
- Test a new check on every old recording before trusting it. The first version of the which-program-ran check failed every known-good run. It never reached the station because it was run over all earlier logs first.
- Keep the log, mistakes included. This section was written from a running log that records every wrong turn with its numbers. Without it the troubleshooting page would be a list of opinions.
- Rules belong in the machine. Whatever was agreed between people and mattered for safety was broken within a day, by people acting in good faith. The station enforces those rules now.
How the prompts were tested
Section titled “How the prompts were tested”Each prompt in this section was given to a fresh AI session that had none of our code, in an empty directory with only the inputs the prompt names. What it built was then checked with tools that had already proved themselves on the real cell: the clearance checker that every robot path passes, real corner data from a calibrated camera, real joint logs, and synthetic recordings with known truth. Each page says what came back.
Sources
Section titled “Sources”- Kalibr — ETH Zurich ASL, software; the AprilGrid target and the camera and camera-IMU calibration used as the cross-check.
- TartanCalib: Iterative Wide-Angle Lens Calibration using Adaptive SubPixel Refinement of AprilTags — Duisterhof, Hu, Teng, Kaess and Scherer, 2022.
- mrcal — Kogan, NASA/JPL, software and documentation; close-ups, projection differences in pixels.
- A Generic Camera Model and Calibration Method for Conventional, Wide-Angle, and Fish-Eye Lenses — Kannala and Brandt, IEEE TPAMI 2006.