Skip to content

dotbot swarm: add over-the-air LH2 calibration (collect/push)#271

Merged
geonnave merged 5 commits into
DotBots:developfrom
geonnave:lh2-ota-collect
Jun 4, 2026
Merged

dotbot swarm: add over-the-air LH2 calibration (collect/push)#271
geonnave merged 5 commits into
DotBots:developfrom
geonnave:lh2-ota-collect

Conversation

@geonnave

@geonnave geonnave commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add dotbot swarm lh2-calibration collect to calibrate a single DotBot over the air (no serial cable): walks the four arena corners, triggers a raw-count capture per corner via swarmit, solves the homography, and saves the calibration under ~/.dotbot/.
  • Add dotbot swarm lh2-calibration push <path> to send a saved calibration to the bot over the air. Thin forward to swarmit's calibrate-lh2, which picks the payload format (legacy .out or calibration-*.toml) by extension.
  • collect takes an optional --tag <label> (e.g. office-2x2m): a filename-safe slug of it is added to the saved filename and recorded under [metadata], so calibrations stay self-describing per arena.
  • Serial-cable (single DK) calibration and the C-header apply export stay under dotbot run lh2-calibration.

The homography solve lives here (dotbot.calibration); the transport lives in swarmit. So collect runs natively and push reuses swarmit's command. Transport selection (running server vs in-process controller) is swarmit's auto-detection, so there is no flag to choose it.

Dependency

Runtime needs the swarmit ota-lh2-capture branch, which adds request_lh2_capture, the LH2_CALIB_TAG log payload, and the bootloader / net-core capture trigger. Merge swarmit first. The unit tests here drive a fake client, so this PR's CI is green without it.

Docs

Intentionally not in this PR yet. The CLI-reference / guide / README sweep lands after review, before merge.

Test plan

  • dotbot swarm lh2-calibration collect --device <addr> -d <mm> against a bot in READY: all four corners capture, a TOML is saved.
  • --tag office-2x2m appears in the filename and in [metadata].tag.
  • dotbot swarm lh2-calibration push <toml> sends, and the bot reports a position in dotbot swarm status.
  • --push one-shot path on collect sends without a separate push.
  • dotbot run lh2-calibration still offers serial collect + apply (no collect-ota).

@geonnave

geonnave commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Tested on hardware - it works!! Merge after #270.

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.23529% with 71 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.35%. Comparing base (09a1c33) to head (6c8db27).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
dotbot/cli/swarm_lh2.py 24.13% 66 Missing ⚠️
dotbot/cli/swarm.py 0.00% 4 Missing ⚠️
dotbot/tests/test_calibration_ota.py 98.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #271      +/-   ##
===========================================
- Coverage    83.74%   83.35%   -0.40%     
===========================================
  Files          116      118       +2     
  Lines        10793    10963     +170     
  Branches       570      570              
===========================================
+ Hits          9039     9138      +99     
- Misses        1751     1822      +71     
  Partials         3        3              
Files with missing lines Coverage Δ
dotbot/cli/calibrate.py 87.17% <ø> (ø)
dotbot/tests/test_calibration_lighthouse2.py 100.00% <100.00%> (ø)
dotbot/tests/test_calibration_ota.py 98.00% <98.00%> (ø)
dotbot/cli/swarm.py 66.66% <0.00%> (-15.69%) ⬇️
dotbot/cli/swarm_lh2.py 24.13% <24.13%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

geonnave added 2 commits June 4, 2026 12:03
The OTA capture transport (request_lh2_capture / send_lh2_calibration)
lands in swarmit 0.8.0rc3; rc2 lacks those symbols, so it is the true
floor for `dotbot swarm lh2-calibration`.

AI-assisted: Claude Opus 4.8
The module uses `from __future__ import annotations`, so the
"CaptureSession" string annotation is unnecessary; pyupgrade rewrites
it to a bare name. Unblocks the check env.

AI-assisted: Claude Opus 4.8
@geonnave

geonnave commented Jun 4, 2026

Copy link
Copy Markdown
Contributor Author

Validated on hardware end to end, all works.
Does not include docs, as we will merge this and then rebase #270 on this, and update docs there.

@geonnave geonnave merged commit 20421ed into DotBots:develop Jun 4, 2026
14 checks passed
@geonnave geonnave deleted the lh2-ota-collect branch June 4, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant