The Camera Path: Image Coverage, Close-Ups, and Clearance From the Robot's Own Body
The camera path is the list of poses at which the robot stops and the camera takes one picture of the target. In the case study it was planned five times. Each re-plan fixed something the previous path had been blind to. The general advice on calibration recordings is on Calibration Targets and Calibration Sequences; this page is what a robot adds.
Five paths
Section titled “Five paths”| Path | Planned for | What was wrong with it |
|---|---|---|
| 1: 70 poses | Filling bins of angle from the lens axis, distance drawn evenly from 0.18 to 0.65 m | The target was small in the picture: a median of 12 % of the image circle. Focal length and distance were poorly separated |
| 2: 58 poses | Close-ups favoured (0.2 to 0.6 m, most near the short end), the target tilted 15 to 60 degrees, poses pruned and ordered for a short run | On rendered images the focal-length error fell from 0.70 to 0.015 px while the run went from 122 s to 57 s. On the real camera the edge of the lens stayed nearly empty: 14 to 22 corners per 5 degree band beyond 80 degrees |
| 3: 114 poses | A measured model of what the detector finds: how far the target may be tilted to the line of sight, by angle from the axis | Edge corners from 19 to 36 per band up to 263 to 283. This is the path in production for the 190 degree lens |
| 4: path 3 plus 24 far and near edge views | More edge data at other distances | It hit the robot. See below |
| 5: 60 poses for a 136 degree lens | Chosen from what a real take detected | The same error as a 159-pose path, in 2 minutes instead of 3 minutes 25 s |
What makes a good path
Section titled “What makes a good path”Count coverage in the image. Each lens’s image is divided into a grid of 16 x 10 cells and the corners planned into each cell are counted. A path can fill every bin of angle and leave whole regions of the image empty.
Close and tilted. mrcal’s study of calibration choreography concludes: “Closeups are extremely important (up to some practical limits)” and “Tilted views are good”. In our experience, that held exactly: the second path was both shorter and more accurate than the first. A flat target cannot fill a 190 degree lens at any distance (an 800 mm target spans 127 degrees from 0.2 m), so the edge of the image is reached by pointing the camera away from the target, not by moving closer.
Plan for what will be detected. A tag seen at a grazing angle does not decode, and less tilt is tolerated toward the edge of the lens. The limit used was measured from the first recordings: the target may be tilted to the line of sight by 55 degrees at the image centre, 35 degrees at 70 degrees from the axis and 15 degrees at 95.
Order for time. The poses are ordered as a travelling-salesman tour on joint move time, choosing between the arm’s alternative solutions for each pose so the wrist does not flip between neighbours. At full speed the arm of the cell spends about one second per pose including the stop.
Leave room for the cable. The last joint stays within plus or minus 180 degrees and the camera sits level at its zero.
The crash
Section titled “The crash”Path 4 kept the 114 poses that had run many times and added 24 views. Every check that existed passed. One second into the move between the second and third new pose the controller reported an overloaded wrist axis and the person at the cell hit the emergency stop. The camera’s cable support had hit the robot’s own arm. The camera survived; the robot kept a few scratches.
The collision check tested the arm and the camera against the target, its stand and the floor. It never tested the camera against the robot that carried it, and the cable support was not in the model at all. The extra rule for the new poses, “every joint within the range the proven poses use”, says nothing about combinations of joints: a far view of the target folds the wrist back onto the arm.
Measured afterwards against the maker’s CAD model of the arm:
| Smallest distance from the camera body to the robot | |
|---|---|
| The 114 proven poses | 106 mm (median 260 mm) |
| Six of the 24 new poses | 0 to 3 mm |
| One more | 37 mm |
The script written in a hurry to measure this was wrong as well. It left the robot’s parts in one frame and the camera in another and reported 172 mm at the pose of the crash. A link that came out 741 mm from the camera gave it away.
The rule since
Section titled “The rule since”No pose goes on the robot until all of this holds, for every pose and along every move, sampled about every degree of joint travel:
- the camera body, and a box 40 mm larger all round that stands for cable, plug and support, are checked against every link of the robot (from the maker’s CAD), the target, the stand and the floor;
- no distance is smaller than the smallest the already-proven path has for the same pair;
- a person has looked at the closest approaches in the viewer;
- the first run is slow, and the station enforces that: see Production station.
The proven path’s own minima, which every later path had to keep: camera to robot 106 mm, cable box to robot 59 mm, camera to forearm 70 mm, camera to target 202 mm. A variant with a larger case lost 7 of the 114 poses to the forearm rule.
In our experience, “no closer than a path that has already run” is a better limit than any number chosen at a desk, because it carries everything the model does not know.
A narrower lens needs fewer poses, not more
Section titled “A narrower lens needs fewer poses, not more”A later variant had a lens of about 136 degrees. On the path for the 190 degree lens the outer part of its image was thinly covered, so 45 poses were planned for its edges and added: 159 poses. The calibration passed with the same error as before. Watching it, the person responsible for the cell said that in some poses the target was barely in the picture, and that no camera should take longer than the widest one.
Both were right. Of the 159 poses only 117 gave a still with the target in it. A selection tool then matched each still of that take to its pose, kept the poses whose still had at least 60 corners, and picked among them for corners per image cell:
| Path for the 136 degree lens | Poses | Run | Mean error, left / right | Image cells with 10 or more corners, of 160 |
|---|---|---|---|---|
| The 190 degree lens’s path | 114 | 2 min 30 s | 0.325 / 0.331 px | 108 / 103 |
| That path plus 45 edge poses | 159 | 3 min 25 s | 0.333 / 0.360 px | 144 / 145 |
| 60 poses selected from the real take | 60 | 2 min 0 s | 0.331 / 0.347 px | 135 / 139 |
In our experience, selecting from one real take beats planning from a model, because the take contains what the detector really found. The skipped poses make new moves between the remaining ones; those moves went through the clearance rule like any other.
The prompt
Section titled “The prompt”- Inputs: the cell model from Cell model and viewer, with its collision distances.
- How to check: run a separate check of the written file, poses and moves, that fails on any margin; step through the path in the viewer and look at the closest approaches and at what each lens sees; compare the planned coverage with the corners a first slow run really finds.
Plan the camera path for the calibration cell in this directory: the list of robot poses at whichthe camera stops and takes a picture of the board. The model of the cell is already here (`cell/`:kinematics, the board, the lenses, the collision distances for a pose and along a move) with aviewer. Read it first and use it; do not write a second kinematics or a second collision model.
Why the path matters: the calibration can only be as good as the pictures. The lens is a fisheye, soits edge is where the model is hardest to pin down and where a careless path leaves no data.
What a good path has:1. Coverage of the IMAGE, per lens: divide each lens's image into a grid ([16 x 10] cells) and aim for at least [25] board corners in every cell that the lens can physically fill, corners and edges included. Count coverage by angle from the axis too (5 degree rings out to the lens limit).2. Close-ups and tilt: most poses close to the board ([0.2 to 0.6 m] from the lens to the board's centre, more of them near the short end) and the board tilted [15 to 60] degrees to the view (the angle between the board's normal and the line from its centre to the camera), not head-on. Poses that exist to fill the edge of the image may tilt further: the edge is reached by pointing the camera away from the board, and coverage of the edge comes before the tilt rule. Close, tilted views are what separate focal length from distance; a path of distant head-on views fits well and is wrong.3. Both lenses on the board together in at least [20] poses, for the stereo geometry.4. A realistic idea of what will be detected: a tag seen at a grazing angle is not detected. Use the limit in `inputs.yaml` (largest angle between the board's normal and the line of sight at which tags still decode, lower toward the lens edge), and a minimum tag size in pixels. Plan to what will be detected, not to what is geometrically in view.5. No more poses than needed: stop adding poses when a new one adds almost nothing, and never exceed [114] poses. If you stop at the limit, say what the last pose still added.
Safety, checked for every pose AND along every move between poses (sample each move about everydegree of joint travel; the robot moves in straight lines in joint space):- the camera body at least [100] mm from the robot's base, turret, upper arm and elbow and [60] mm from the forearm (the camera is bolted just beyond it); the cable box at least [50] mm and [20] mm from the same; both at least [150] mm from the board, the stand, the floor and what the robot stands on. Once a path has run on the real arm, replace these numbers by that path's own smallest distances: nothing new may come closer than something that has already run;- every joint inside its limits with [5] degrees to spare, joint 6 inside +-[170] degrees (the camera cable), and joint 5 more than [5] degrees from zero (the wrist singularity);- reject a pose rather than shave a margin. A pose that would be useful but is too close is not useful. Check the margins per link (the limits differ by link), and the arm's own links against the board, the stand and each other.
Order the poses to make the run short (nearest-neighbour then 2-opt on joint-space move time isenough), choosing between inverse-kinematics solutions so the wrist does not flip betweenneighbours. The path starts and ends at the home pose in `inputs.yaml`.
Write:- `plan/plan_camera_path.py` (runs from the directory root, a fixed random seed, finishes in a few minutes);- `out/camera_waypoints.json`: a list of poses, each a list of 6 joint angles in degrees in the model's convention, in run order, without home;- `out/camera_path_report.md`: number of poses; per lens the count of grid cells with at least 10 and at least 25 planned corners out of those reachable, and the emptiest cells; corners per 5 degree ring; poses with both lenses on the board; the closest approach of camera and cable box to the robot, the board and the stand, with the pose or move where it happens; estimated run time at [60] % of the datasheet joint speeds with an acceleration of [400] degrees per second squared (a move is a trapezoid in speed, limited by the slowest joint) and [0.3] s stopped per pose;- rebuild `viewer.html` with the path.
Then check your own work: run the collision function over the written file (poses and moves) in aseparate script, `tests/check_path.py`, that fails if any margin is broken, and print its result.Say plainly which targets were not met and why.How this prompt was tested
Section titled “How this prompt was tested”A fresh AI session got an earlier wording of this prompt in the directory of a cell model that another fresh session had built (see Cell model and viewer). It had no access to our planner or our paths. Its path was then scored with the clearance checker every real path passes and with a coverage counter that uses a calibrated lens of the real camera and the measured detection limits. Our own 114-pose path, the one in production, was scored the same way.
| Its path | Our proven path | |
|---|---|---|
| Poses | 114 | 114 |
| Image cells with 10 or more predicted corners, left / right, of 160 | 134 / 136 | 133 / 132 |
| Image cells with 25 or more | 110 / 116 | 114 / 114 |
| Predicted corners at 80 to 95 degrees | 260 / 253 | 242 / 233 |
| Poses with both lenses on at least six whole tags | 113 | 109 |
| Median distance to the corners seen | 0.50 m | 0.58 m |
| Camera to robot, smallest, poses and moves | 148 mm | 106 mm |
| Camera to forearm | 76 mm | 70 mm |
| Cable box to robot / to forearm | 99 / 31 mm | 59 / 25 mm |
| Camera to the target | 230 mm | 202 mm |
| Joint 5 from zero, smallest | 10 degrees | 4 degrees |
| Run time at 60 % speed with 0.3 s per stop, by our estimate | 99 s | 100 s |
Planned cold in 40 seconds of computing, it equals the path that took us three re-plans and a set of real recordings, with more clearance everywhere. Its own separate check passed, and ours agrees with every distance it reported to within 4 mm.
What it could not have known without the first recordings is in the prompt’s inputs: the measured limit on how far a tag may be tilted before it stops decoding. With that table the planner aims at what will be detected. Without it this would have been our first path again.
It reported its misses plainly: the four corner cells of the image stay nearly empty, 45 of the 114 poses tilt the target beyond 60 degrees because the edge cannot be reached otherwise, and its own run-time figure ignored acceleration. The prompt above now resolves the tilt rule against the edge, and asks for acceleration in the estimate. A path like this still goes through the rule above before it runs: the viewer, a person, and a slow first run.
Sources
Section titled “Sources”- mrcal: a tour of the choreography — Kogan, NASA/JPL, software documentation; close-ups, tilt, and how many views.
- Kalibr wiki: calibration targets — ETH Zurich ASL; the AprilGrid.