Repository navigation
Store and share lighthouse configs, and write them to a swarm - #39
Merged
Merged
Conversation
Lighthouse configurations can now be stored like swarms: locally as <config>, or shared on the server as <org>/<config>, with the same revisions, sync, pull/push and offline copies. New lh config commands: list, save (the Crazyflie's), import, export, delete, move, pull and push. display, write and check take a stored configuration by ID; write and check without one use the configuration the selected swarm names. A swarm can name the lighthouse config it flies in (`lighthouse:` in the swarm file, set with swarm config lighthouse); a shared swarm needs a shared one. swarm lh check compares every Crazyflie with it (exit code 60 when some differ) and swarm lh write writes it to those that don't have it, refusing Crazyflies whose firmware supports too few base stations before writing anything. Adding Crazyflies to such a swarm says how to give it to them. Swarms and lighthouse configs share one implementation of local files and shared copies (modules/documents.rs, which replaces swarm/shared.rs). The copies of shared swarms move from synced/<server>/<org>/ to synced/<server>/swarms/<org>/; existing copies are moved on first use. When an organization gets a new ID on the server, the copies of both kinds move to it, and swarms naming its lighthouse configs follow. Lighthouse config IDs complete in bash, zsh and PowerShell.
…ixes lh config delete and move list the swarms that fly in the configuration: the local swarms and, for a shared configuration, the shared swarms the server lists (this computer's copies when it can't be reached). delete asks with the list shown, and both say how to give those swarms another configuration; a shared swarm can't follow one moved to this computer. lh config write and check without a configuration read stdin only when something is piped in. When stdin is empty, as for a command in a script or a cron job, they use the selected swarm's configuration, as in a terminal, instead of failing on an empty file. swarm lh write says which base stations a Crazyflie took another calibration for when the configuration it reads back differs from the one written. With sync on, lists of shared swarms and lighthouse configs show the server's revision, not that of this computer's copy, unless the copy has changes that aren't pushed. Stored configurations are named with "changes not pushed" when that is so. auth, settings sync and settings show mention lighthouse configs next to swarms, and settings show prints the lighthouse config folder.
The same name as cfcli lh and swarm lh. The field in the swarm file stays lighthouse:.
swarm config lh without a configuration lets the user pick one, starting at the one the swarm names, and shows it when not interactive. lh config write without one lets the user pick from all the stored configurations, starting at the selected swarm's; without a terminal it still writes the selected swarm's. A local swarm can only name a lighthouse config on this computer, and a shared swarm only one in its organization, which everyone who uses the swarm can read. The list for swarm config lh shows those, and lh config move says which swarms can't follow a configuration to its new ID.
evoggy
force-pushed
the
evoggy/lh-sharing
branch
from
October 8, 2026 20:45
51e4192 to
3fef02c
Compare
swarm config move and import copied the swarm's lighthouse config along, so a swarm moved to another organization, or between this computer and the server, named one it can't (and the server refuses a shared swarm naming another organization's config). The link is dropped when the new ID can't name it, and cfcli says so and how to name another one.
Files from the Crazyflie client have no name, and the name could only be given when storing one (save/import --name). The new command shows it, or sets it for a local or shared configuration, like swarm config name; the ID stays the same, and a shared one gets a new revision.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #38. Lighthouse configurations can now be stored like swarms: locally as
<config>, or shared on the server cfcli signs in to (cfcli auth login) as<org>/<config>. Shared configurations work like shared swarms: revisions, sync on/off,pull/push, and copies on this computer when the server can't be reached.lh configlist,save(the Crazyflie's configuration),import,export(a file cfclient opens),delete,move,pullandpush.display,writeandchecktake a stored configuration by ID, a file (-i), or YAML piped in.writelists all stored configurations to pick from, starting at the selected swarm's. Without a terminal it writes the selected swarm's.checkalways uses the selected swarm's.saveandimportonto an existing ID show what changes for each base station and ask first.deleteandmovelist the swarms that fly in the configuration.nameshows or changes the name a configuration is shown with; the ID stays the same.Swarms
lighthouse:in the swarm file, set withswarm config lh.swarm config lhwithout a configuration lists the ones the swarm can name. When not interactive, it shows the current one.swarm lh checkcompares every Crazyflie with that configuration and exits with 60 when some differ.swarm lh writewrites it to the Crazyflies that don't have it, then reads it back. Crazyflies whose firmware supports too few base stations are refused before anything is written.swarm config addsays how to give the swarm's configuration to the new Crazyflies.Shared code
modules/documents.rs, which replacesswarm/shared.rs.synced/<server>/<org>/tosynced/<server>/swarms/<org>/. Existing copies are moved on first use.Docs:
docs/lighthouse.md,docs/swarm.md,docs/settings.md,docs/auth.mdand the README. Lighthouse config IDs complete in bash, zsh and PowerShell.The second commit has the fixes from reviewing and testing the first. The third renames
swarm config lighthousetoswarm config lh, likecfcli lhandswarm lh; the field in the swarm file stayslighthouse:. The fourth adds the lists to pick from and the rule for which configurations a swarm can name. The fifth drops a swarm's lighthouse config whenswarm config moveorimportgives the swarm an ID that can't name it, and says so. The sixth addslh config nameto show or change a lighthouse config's name, likeswarm config name.Testing
pull/pushand a push conflictdelete/moveswarm listsswarm lh check→write→check, and a secondwriteskipped as up to datelh config save,lh config write <id>lh config checkwith a stored configuration, a file, a pipe and an empty stdinswarm lh write(no base stations in view). That message is covered by a unit test.