Day 19: rat race after the numbers
It worked. I put a red cap on the bench about seventy centimeters in front of the camera, and the arm turned to face it. No hands on the keyboard, nothing scripted — the camera saw a thing, worked out where it was, and the joint moved! With an amazing refresh rate of twenty-six times a second — faster than I ever expected. Victory?
Two caps, two distances. I had assumed one number covered both.
That is the thing this whole project has been circling since the beginning. See something, know where it is, move toward it. It took five months and it lasted about four seconds before I noticed it was pointing at the wrong place.
Wrong by six degrees
The cap was seventy-three centimeters away and about a centimeter to one side. The arm swung seven degrees.
Seven degrees at that distance is roughly a hand’s width past the thing you meant to point at. It had found the cap, understood the cap, and then confidently indicated a spot next to the cap.
Which brings me to the item that’s been sitting on my list for weeks, phrased with what I now recognize as misplaced confidence:
Calibrate the controller gain.
There was a single number in there deciding how hard to turn for a given sideways offset. I’d left it at a placeholder because calibrating it properly needed the camera-to-arm geometry, and until this week I didn’t have that. Now I did. Time to find the right value.
There isn’t one
Here’s the thing I hadn’t thought through.
Somebody is standing right next to you and takes one step to the left. To keep pointing at them, you swing your arm a long way. Now they’re across a field and they take the same one step left. You barely move.
Same step. Completely different angle. The amount you turn depends on how far away they are, and it always has.
My single number had no idea how far away anything was. It took “one centimeter to the left” and turned the same amount whether the thing was at arm’s length or across the room.
So I measured it. Same direction from the camera, two distances:
| Distance | Correct angle | What my number gave |
|---|---|---|
| 74 cm | 12.5° | 7.2° |
| 40 cm | 15.7° | 3.8° |
Read those columns downward. As the thing gets closer, the correct angle gets bigger — obviously, it’s more off to the side from where you’re standing. And my number gets smaller.
They don’t just disagree. They move in opposite directions. No system to it at all, at first glance. I had spent weeks intending to calibrate a parameter that cannot be calibrated.
The fix was to delete it
The correct angle is the angle to the thing. That’s it. It’s the same trigonometry you’d use to work out the bearing of a ship, and it’s exact at any distance and any angle, and it has no tuning parameter because there’s nothing to tune.
My team had, some weeks back, insisted on logging both numbers side by side every time the arm moved — the one being used, and the exact angle for comparison. At the time this struck me as belt-and-braces. The comment they left said the choice should be decided on data rather than preference.
The data decided it in about four minutes.
Deleted the parameter, replaced the arithmetic with the actual angle, and it now points at things. Twelve and a half degrees when the answer is twelve and a half degrees, and the joint gets there to within a fifth of a degree.
The other thing, which is permanent
Before all that, I had the cap sitting on top of the arm itself, thinking that would be a convenient target. The camera refused to see it.
Not the color — it found the red immediately, every frame. It just couldn’t work out how far away it was. Depth simply returns nothing.
The camera can’t range anything closer than about twenty-five centimeters. The arm lives at fifteen. So the robot is permanently unable to judge the distance to its own limb — it can see it perfectly, in full color, and has no idea how far away it is.
I keep trying to decide whether that’s a problem or just an unusually literal metaphor. Either way it’s not fixable by tuning, so it goes in the same file as the camera being aimed six degrees off: written down, worked around, left alone.
Where that leaves it
The robot sees a thing and points at it, correctly, at whatever distance the thing happens to be.
What it hasn’t done is follow something that’s actually moving. Every measurement so far has been against a cap sitting perfectly still on a bench, which is not a demanding opponent. I don’t yet know how far behind a moving target it lags, or whether it hunts around once it gets there.
That’s the real test, and it needs a moving target. I have two hands and one of them is usually free.