Skip to content

duck-sim: make first-run setup and status failures actionable - #442

Open
Amidwestnoob wants to merge 2 commits into
pollen-robotics:mainfrom
Amidwestnoob:fix/duck-sim-setup
Open

Amidwestnoob wants to merge 2 commits into
pollen-robotics:mainfrom
Amidwestnoob:fix/duck-sim-setup

Conversation

@Amidwestnoob

Copy link
Copy Markdown

A fresh scripts/duck-sim run can miss a sibling microduck_rl checkout or fail deep in Cargo with an old compiler. With the simulator stopped, status could print a Python traceback and report success, while simlog either failed in tail or followed a stale log indefinitely.

The script now uses a nonempty DUCK_SIM_RL override, then the sibling checkout, then the historical home-directory fallback. It checks the active Rust compiler against the workspace MSRV before teardown, preserves toolchain errors, and explains how to select an updated compiler. Status preserves failed health/body probes; stopped logs return their last 50 lines and exit 1, while live logs still follow. The simulation guide documents these behaviors.

Validation:

  • python3 scripts/tests/duck_sim_setup.py: 39 passing tests covering discovery precedence, paths with spaces, missing prerequisites, compiler versions/failures, live/stopped status and logs, and isolated shutdown. The same harness reports 23 assertion failures against the original base, including the stale-log hang.
  • bash -n, sh -n, shellcheck --shell=sh scripts/duck-sim, and workspace formatting pass.
  • Real CPU-only headless smoke on the final commit, with sibling discovery and no DUCK_SIM_RL: stand, drive 0.30, status, live log follow, down, and post-down status/logs. The body moved 0.946 m in eight seconds, remained upright, and reported 50 Hz with zero missed ticks. All five simulator processes stopped.

The existing 0.15 m/s drive default produced little displacement in a separate run; this change leaves that default unchanged. Container, camera, and hardware operation were not exercised.

Three setup failures a fresh checkout hits, each now named with its fix:

- An older rustc than the workspace's rust-version failed deep in the
  dependency graph ("tof@0.17.8 requires rustc 1.89"). duck-sim now
  checks rustc against rust-version before building and says how to
  update.
- DUCK_SIM_RL defaulted to ~/Pollen/microduck_rl while the docs say to
  clone the two repos side by side. A sibling ../microduck_rl is now
  found on its own (~/Pollen stays the fallback), and the error names
  both the sibling path and DUCK_SIM_RL.
- With the sim down, `status` printed a ConnectionRefusedError
  traceback and exited 0, and `simlog` failed in tail. Both now say the
  sim is not running and exit non-zero; simlog after `down` shows the
  last lines of the old log instead of following it.

docs/robot/simulation.md gets a short before-the-first-run note.
Validate the active compiler before teardown, retain rustup diagnostics, and report failed health/body probes. Cover first-run discovery, compiler boundaries, log behavior and isolated shutdown with entry-point regressions.

Assisted-by: GPT-6 Astra

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