Re-zero SO-101 cell BC2-2126 after 4 servo swaps with a re-bolted mount: recover zero offsets, mount pose and gear play from a powered touch-off log on a jig plate on its pins, the session notes and 6 wrist stills
harbor run -t reactive-labs/rezero-bc2-2126harbor download reactive-labs/rezero-bc2-2126BC2-2126 went through its gearbox service: four servos were swapped for refurbished ones (shoulder_pan, shoulder_lift, elbow_flex and wrist_roll). The zero offsets of the replaced servos are lost. The arm was unbolted from its mount during the repair and went back on a little off its old position. Before the cell goes back to production, its unit file has to match the arm again, so that jobs planned in simulation land where they should.
The cell, the simulator and the unit file format are described in /app/CELL_SHEET.md. What is known from the unit file before the repair:
| servo | zero offset (rad) |
|---|---|
wrist_flex (not replaced) |
-0.00749 |
The technician's records are in /app/data/:
touchoff.csv: 8 touch-off records on jig plate JP-1 (220 x 180 x 6 mm, 5 x 4 divots on a 40 mm grid). The plate sat with its centre at (0.200, 0.000) m on the table, turned +0.000 rad about +z from square to the world axes. In plate coordinates (origin at the plate centre, x along its 220 mm side) divot Dij is at x = -0.080 + 0.040 i, y = -0.060 + 0.040 j (m); a seated tip (site gripperframe) sits 1.0 mm below the plate top, at z = 0.0050 m. With the servos powered, the technician jogged the arm from the pendant until the tip seated in the divot, then saved a record: goal_* (the goal position the pendant last wrote to each servo), all in the reading frame. last_jog gives the direction of the last jog of each arm joint, shoulder_pan to wrist_roll: + means the joint's last move was towards higher readings. The technician typed the divot labels by hand. On this jig a seated tip repeats to about 0.40 mm (one standard deviation along each axis).session_log.txt: the technician's notes from the session.wrist/: 6 wrist-camera stills (160 x 120) looking at the same plate, with the present positions logged when each still was taken (wrist/readings.csv). The divots are the dark dots; the magenta square marks the plate's (+x, +y) corner.Write the unit file to /app/out/unit.json:
{"joint_offset": [pan, lift, elbow, wrist_flex, wrist_roll, 0.0],
"base": [x, y, 0.0, yaw],
"backlash": [pan, lift, elbow, wrist_flex, wrist_roll, 0.0]}
Units are radians and metres, with the meanings and conventions of the cell sheet (reading = true angle + offset; backlash is the gear play of each joint, 0 for a joint without play). A key left out takes its drawing value, and other keys are ignored. The wrist_roll servo is new and its gear play was measured on the bench as nil, so its backlash is 0.
The file is checked in two ways against what this unit actually does:
Four measures, each a mean over its set: readings position error (full marks at 1.25 mm or less, zero at 4.0 mm), readings orientation error (full at 0.4 deg, zero at 1.2 deg), goals position error (full at 1.25 mm, zero at 4.0 mm) and goals orientation error (full at 0.4 deg, zero at 1.2 deg). Each scores 1 at full marks and 0 at its zero value, linear in between. The reward is the mean of the four.