Skip to content

Support remote update of lighthouse calibration#127

Open
geonnave wants to merge 7 commits intoDotBots:mainfrom
geonnave:remote-lh-calibration
Open

Support remote update of lighthouse calibration#127
geonnave wants to merge 7 commits intoDotBots:mainfrom
geonnave:remote-lh-calibration

Conversation

@geonnave
Copy link
Copy Markdown
Contributor

@geonnave geonnave commented Mar 3, 2026

The plan:

  1. swarmit -c ../swarmit-argus.toml -n A001 calibrate ~/.dotbot/calibration.out
  2. the device receives it and stores on flash
  3. once it's done, the device needs to be rebooted for the new calibration to apply

Regarding the transfer, my approach is to send the homography matrices one by one, the packets will be like this:

  • count: the total count of homography matrices
  • index: the index of the current homography matrix
  • homography: the actual matrix data with 9 int32_t items

The calibration is stateless on the device side: every time it receives a calibration packet, it writes count to the flash config area, as well as the the homography matrix (at the correct ìndexas indicated in the packet). This means that the samecount` will be written several times (one for each packet), but there is no harm on that.


Update: this now works! Remains to be tested with a real lighthouse though.

How to test the remote calibration update:

swarmit -c ../swarmit-argus.toml calibrate-lh2 <calibration file>

I also used these snippets to generate some dummy calibration files:

python3 -c "import struct; m=[[1,1,1],[111000,9,-111000],[1,999000,-1]]; \
  open('calib111.bin','wb').\
  write(bytes([1]) + b''.join(struct.pack('<i',v) for r in m for v in r))"
# generates a matrix like [[1,1,1],[111000,9,-111000],[1,999000,-1]]
python3 -c "import struct; mats=[[[k,k,k],[k,k,k],[k,k,k]] for k in (1,2,3,4)]; \
  open('calib1234.bin','wb').\
  write(bytes([len(mats)]) + b''.join(struct.pack('<i',v) for m in mats for r in m for v in r))"
# generates 4 matrices like [[k,k,k],[k,k,k],[k,k,k]]

@geonnave geonnave changed the title Support remote calibration of Lighthouse homography matrices Support remote update of lighthouse calibration Mar 3, 2026
@geonnave geonnave force-pushed the remote-lh-calibration branch 2 times, most recently from 62f5f3d to 3fd577d Compare March 5, 2026 14:20
@geonnave geonnave force-pushed the remote-lh-calibration branch from 3fd577d to 0e74cc9 Compare March 5, 2026 14:21
@geonnave geonnave marked this pull request as ready for review March 5, 2026 16:59
@geonnave
Copy link
Copy Markdown
Contributor Author

With the busy days of IETF meeting, visit and talk at HKUST-GZ, adjusting the Mari paper, contributing to OpenSwarm deliverables... I could not advance this PR. I think this is really important as @AmyMcMahon2 has a demo for early/mid April, however I will not be able to work on it next week as I will be on PTO. @aabadie if you have some time, could you please take a look? All the plumbing is here and the principle works, the only missing part is finding out why the device reboots/crashes when I write to the flash.

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