Conversation
There was a problem hiding this comment.
Pull request overview
Refactors/introduces an Apollo chassis auto-test tool with a curses-based CLI runner, tiered L1/L2/L3 test suites, command heartbeat + safety monitoring, and basic data recording/plotting.
Changes:
- Add CLI entrypoint (
cli.py) that registers and runs tiered chassis test cases with a curses UI. - Implement core runtime components: 100Hz command heartbeat + safety monitor, curses UI handler, and a CSV/plot data recorder.
- Add L1/L2/L3 test case modules plus shared utilities and YAML-based configuration.
Reviewed changes
Copilot reviewed 11 out of 14 changed files in this pull request and generated 32 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/tools/whl-can/auto_test/cli.py | Curses-wrapped CLI runner, argument parsing, and test registration. |
| modules/tools/whl-can/auto_test/core/runner.py | TestRunner orchestration, heartbeat publishing, safety monitor, and sequencing. |
| modules/tools/whl-can/auto_test/core/ui.py | Thread-aware curses UI abstraction (header/footer/logging + input). |
| modules/tools/whl-can/auto_test/core/reporter.py | High-frequency recording, CSV persistence, and matplotlib plotting. |
| modules/tools/whl-can/auto_test/util.py | Common result helpers and base ControlCommand construction. |
| modules/tools/whl-can/auto_test/tests/l1_static.py | L1 static/functional test cases. |
| modules/tools/whl-can/auto_test/tests/l2_dynamic_low.py | L2 low-speed dynamic test cases. |
| modules/tools/whl-can/auto_test/tests/l3_dynamic_high.py | L3 high-dynamic test cases. |
| modules/tools/whl-can/auto_test/config/manager.py | YAML config loader with defaults. |
| modules/tools/whl-can/auto_test/config/default.yaml | Default topics/limits/thresholds configuration. |
| modules/tools/whl-can/auto_test/README.md | Basic usage instructions. |
| modules/tools/whl-can/auto_test/core/init.py | Package marker. |
| modules/tools/whl-can/auto_test/config/init.py | Package marker. |
| modules/tools/whl-can/auto_test/tests/init.py | Package marker. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def cleanup(self): | ||
| self.heartbeat.stop() | ||
| self.estop_triggered.set() | ||
| if hasattr(self, "safety_thread"): | ||
| self.safety_thread.join(timeout=1.0) | ||
| cyber.shutdown() |
There was a problem hiding this comment.
cleanup() stops the heartbeat thread but does not join() it before calling cyber.shutdown(). Since stop() only flips a flag, the heartbeat can still be mid-iteration and write at least one more command concurrently with shutdown. Consider joining the heartbeat thread (with a small timeout) before shutting down Cyber RT to avoid races/spurious exceptions on exit.
| def start(self): | ||
| self.ui.draw_header("Apollo Chassis Auto-Tester", self.run_level) | ||
| self.heartbeat.start() | ||
| # Start safety monitoring thread | ||
| self.safety_thread = threading.Thread(target=self._safety_monitor, daemon=True) | ||
| self.safety_thread.start() | ||
|
|
There was a problem hiding this comment.
The safety-monitor thread starts before the blocking ui.wait_for_enter() call, and both call stdscr.getch() concurrently. This can consume the Enter key in _safety_monitor() and leave wait_for_enter() blocked indefinitely (or cause inconsistent nodelay state). Consider pausing input polling in _safety_monitor until after the initial Enter prompt, or centralizing input handling so only one thread reads from curses.
| def wait_for_condition( | ||
| self, condition_fn: Callable[[], bool], timeout_sec: float, desc: str | ||
| ) -> bool: | ||
| start = time.time() |
There was a problem hiding this comment.
Call to a non-callable of builtin-class module.
| self, condition_fn: Callable[[], bool], timeout_sec: float, desc: str | ||
| ) -> bool: | ||
| start = time.time() | ||
| while time.time() - start < timeout_sec: |
There was a problem hiding this comment.
Call to a non-callable of builtin-class module.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
refractor auto test tool, Design docs