Skip to content

feat: refractor auto test tool#156

Open
daohu527 wants to merge 8 commits intomainfrom
155-feature-add-chassis-auto-test-tool
Open

feat: refractor auto test tool#156
daohu527 wants to merge 8 commits intomainfrom
155-feature-add-chassis-auto-test-tool

Conversation

@daohu527
Copy link
Contributor

refractor auto test tool, Design docs

Copilot AI review requested due to automatic review settings February 11, 2026 03:15
@daohu527 daohu527 linked an issue Feb 11, 2026 that may be closed by this pull request
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +234 to +239
def cleanup(self):
self.heartbeat.stop()
self.estop_triggered.set()
if hasattr(self, "safety_thread"):
self.safety_thread.join(timeout=1.0)
cyber.shutdown()
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +82
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()

Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
def wait_for_condition(
self, condition_fn: Callable[[], bool], timeout_sec: float, desc: str
) -> bool:
start = time.time()
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot uses AI. Check for mistakes.
self, condition_fn: Callable[[], bool], timeout_sec: float, desc: str
) -> bool:
start = time.time()
while time.time() - start < timeout_sec:
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot uses AI. Check for mistakes.
daohu527 and others added 7 commits February 11, 2026 14:55
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>
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.

[Feature]: Add chassis auto test tool

2 participants