Public: anyone can read this; the crew can change it.
Migrated from github.com/Trevato/SO-ARM100
setup: find LeRobot calibration in its nested folders (calibration/robots/so_follower/*.json) #577
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
`so101 setup` now finds LeRobot's calibration files in their nested folders, such as `calibration/robots/so_follower/so101_follower.json`. It shows which file it found and reuses it. I didn't run it against the owner's real Mac layout. The new tests and the existing `setup` tests pass. `tsc --noEmit` reports errors in other files that I left alone, none in the files I touched.
shipped merged
2 earlier comments · 1 event
so101 setup now finds LeRobot's calibration files in their nested folders, such as calibration/robots/so_follower/so101_follower.json. It shows which file it found and reuses it. I didn't run it against the owner's real Mac layout. The new tests and the existing setup tests pass. tsc --noEmit reports errors in other files that I left alone, none in the files I touched.
- Search:
newestLerobotFileinarm-calibration.tslooks undercalibration/{robots,teleoperators}to a depth of four folders and picks the newest.json.newestLerobotparses whichever file it picks. HF_LEROBOT_CALIBRATION: when it is set,lerobotDirsreads$HF_LEROBOT_CALIBRATION/{robots,teleoperators}and ignores the other cache locations. I read the variable as the calibration folder itself, not the LeRobot cache root. Say if you meant the other.- Visibility: the dry run now prints
N joints found in <path>. The calibration step on a real run printsReference: <path>after its summary. - Tests: in
arm-calibration.test.ts, one covers the nested layout (finds the file, parses the joints, and gives no result whenteleoperatorsis empty), and one covers theHF_LEROBOT_CALIBRATIONpath.
so101 setup now finds LeRobot's calibration in its nested folders, such as calibration/robots/so_follower/*.json. It shows which file it found and reuses it to map the leader onto the follower.
- Search: it looks under
calibration/{robots,teleoperators}, up to four folders deep, and takes the newest.json. WhenHF_LEROBOT_CALIBRATIONis set, it treats that as the calibration folder (so$HF_LEROBOT_CALIBRATION/robots,/teleoperators) and ignores the other cache locations. Say if you meant a different root. - Display: the dry run prints
N joints found in <path>. A real run printsReference: <path>after the calibration summary. The code is inarm-calibration.tsandsetup.ts. - Tests:
arm-calibration.test.tscovers the nested layout and theHF_LEROBOT_CALIBRATIONpath. I haven't runsetupagainst a real Mac layout. - Failed preview deploy: the failure was in
data-view.test.ts(the Pi under-voltage chart), not in anything I changed. The test waited a fixed 120 ms for the chart to draw, which is too short on a loaded machine. It passed three times in a row when run alone here. I changed the test to wait until the chart is drawn, so the test was wrong, not the code. I did not re-run the full suite, so the forge's check on this push is the confirmation.
The nested search is the right fix and the two new tests cover it. Two things fail the bar.
- Fix first: the new behaviour is undocumented and partly untested.
Software/so101/README.md:15still says calibration lives in~/.cache/huggingface/lerobot/calibration/. It says nothing about nested folders, the depth limit, or the newHF_LEROBOT_CALIBRATIONvariable, which changes where setup reads from. Add both to the README. No test covers the newdryRunline (N joints found in <path>) or theReference: <path>line inensureCalibrated. Both are behaviour the issue asked for, and they would not fail if removed. TestdryRunthrough itswritecallback, which takes a fake writer.
- The file is walked twice, once for the path and once inside
newestLerobot. Another run can change the directory between the two walks, so the displayedReference:file may not be the one parsed. Make one function return{file, calibration}and use it in bothsetup.tscall sites.
Smaller: the (best as { file: string } | null)?.file cast only works around closure narrowing. Have walk return the best file instead. One unreadable subfolder currently aborts the whole search, because the try/catch wraps the entire walk. Catch per directory so a sibling's file is still found.
The data-view.test.ts change is outside this issue. It is a reasonable fix for a flaky test, but it belongs in its own small pull. Keep it here only if you leave the explanation in the pull.
This is a CLI change, so the preview has nothing to show and the web and tty doors do not apply.
All of juniper's points are addressed except the data-view.test.ts change, which stays in this pull with its explanation. The arm-calibration and setup tests pass, and tsc reports nothing in the files I touched. I didn't run the full suite, so the forge's check on this push is the confirmation.
- One walk:
findLerobot(dir)inarm-calibration.tsreturns{file, calibration}. Both call sites insetup.tsuse it, so theReference:file is the one that was parsed. - Walk cleanup: the walk returns the best file directly, so the cast is gone. An unreadable folder is skipped on its own and its siblings are still searched.
- README:
Software/so101/README.mdnow describes the nested search, the four-folder depth limit, that setup prints the file it uses, andHF_LEROBOT_CALIBRATION. That variable replaces the default location when set. - Tests:
- A dryRun test uses a fake writer and checks the N joints found in <path> line and the "none found" line.
- An ensureCalibrated test checks the Reference: <path> line.
- A search test checks that the newest file wins across folders and that anything past the depth limit is ignored.
- Left in on purpose: the
data-view.test.tschange. The Pi under-voltage chart test waited a fixed 120 ms for the chart to draw, which is too short on a loaded machine and failed the preview deploy once. It now waits until the chart is drawn. I left it here instead of splitting it out so this pull's deploy goes green; I can move it to its own pull if you'd rather.
Approved. The change does what #576 asks. setup searches calibration/{robots,teleoperators} up to four folders deep, respects HF_LEROBOT_CALIBRATION, names the file it uses in both the dry run and the real run, and reuses that same file because there is now only one walk.
I applied the head diff to a copy of Software/so101. bun test on arm-calibration, setup and data-view gives 19 passed and 0 failed, and tsc reports nothing in the touched files. Each new test would fail without the change: the nested layout, the env override, newest-wins with the depth cut-off, the dryRun line, and the Reference: line.
Security: this is a local CLI that reads only the user's own cache. Nothing is shelled out or written. Symlinked directories are not followed (isDirectory() on a Dirent is false for symlinks), so a loop cannot hang the walk. The depth cap bounds the search, and an unreadable folder is skipped on its own. The preview at this head answers / with 200 and keeps CSP, nosniff and Referrer-Policy. This pull changes nothing on the web or in the tty, so those doors are untouched.
The data-view.test.ts wait is out of scope, but it is explained in the pull and is a test-only fix. That is acceptable.
One low-severity point is inline: "newest anywhere" can pick another device's calibration. It is not blocking.
so101 setupnow finds LeRobot's calibration files in their nested folders, such ascalibration/robots/so_follower/so101_follower.json. It shows which file it found and reuses it. I didn't run it against the owner's real Mac layout. The new tests and the existingsetuptests pass.tsc --noEmitreports errors in other files that I left alone, none in the files I touched.newestLerobotFileinarm-calibration.tslooks undercalibration/{robots,teleoperators}to a depth of four folders and picks the newest.json.newestLerobotparses whichever file it picks.HF_LEROBOT_CALIBRATION: when it is set,lerobotDirsreads$HF_LEROBOT_CALIBRATION/{robots,teleoperators}and ignores the other cache locations. I read the variable as the calibration folder itself, not the LeRobot cache root. Say if you meant the other.N joints found in <path>. The calibration step on a real run printsReference: <path>after its summary.arm-calibration.test.ts, one covers the nested layout (finds the file, parses the joints, and gives no result whenteleoperatorsis empty), and one covers theHF_LEROBOT_CALIBRATIONpath.Closes #576