Skip to content

feat(bus): add Fleet and StopGuard for multi-bus group ops - #10

Draft
dougcalobrisi wants to merge 1 commit into
mainfrom
worktree-per-wheel-bus
Draft

dougcalobrisi wants to merge 1 commit into
mainfrom
worktree-per-wheel-bus

Conversation

@dougcalobrisi

Copy link
Copy Markdown
Owner

Summary

  • Fleet — group operations across several physical buses. safe_stop_all / set_mode_all run on every bus concurrently (one scoped thread per bus), so an adapter-per-wheel machine stops in step in nominally ~300 ms instead of bus after bus (~1.2 s, decelerating out of step). A bus whose thread can't spawn runs inline alongside the others; nothing is skipped.
  • StopGuard — the crate now ships the drop-to-stop guard (m0601::StopGuard / fleet.stop_guard()). Replaces the three hand-rolled copies in the two examples and m0601-quad.
  • four_wheel_one_per_bus example — four_wheel_minimal with one adapter per wheel: thread per bus, per-bus budget assertion, shared cancel flag so one failed wheel brings the others out of their loops within a cycle.
  • Tests in m0601/tests/fleet.rs (frame-for-frame parity with single-bus ops, validation before send, error aggregation, guard behaviour, concurrency bound). Docs and CHANGELOG updated.

Timing figures are the crate's own pacing arithmetic; several USB-serial adapters on one host are unmeasured and the docs say so.

Test plan

  • cargo clippy --workspace --all-targets -- -D warnings clean
  • cargo test --workspace — 268 passed (incl. doctests)
  • Hardware run of four_wheel_one_per_bus with four adapters (not available to me)

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ecch8hgo8KJfKHfKZ89Ng6

Fleet runs safe_stop_all / set_mode_all on several physical buses
concurrently (one scoped thread per bus), so an adapter-per-wheel machine
stops in step in ~300 ms instead of bus after bus. StopGuard is the
drop-to-stop guard every example and the rover app used to hand-roll.

Adds the four_wheel_one_per_bus example (thread per bus, shared cancel
flag), tests/fleet.rs, and docs for both.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ecch8hgo8KJfKHfKZ89Ng6
@dougcalobrisi

Copy link
Copy Markdown
Owner Author

Moving to draft: awaiting a run on real hardware. The timing claims (per-bus budget, in-step stop across buses) are pacing arithmetic until four_wheel_one_per_bus has been run with one adapter per wheel and tick.elapsed() logged per wheel. The current bench has two USB-serial adapters, not four.

@dougcalobrisi
dougcalobrisi marked this pull request as draft August 23, 2026 18:25

This branch has not been deployed

No deployments
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