Feature/comm plate scan revisit v2#2
Conversation
There was a problem hiding this comment.
Pull request overview
This PR revisits the comm-based parking/plate-scan workflow by moving plate scanning and scan-state gating into the comm stack, adding runtime enable/disable control for heavier perception/planning nodes, and updating the tmux setup to launch the new plate reader node.
Changes:
- Add scan-state gating topics (
*/enabled) to idle perception/occupancy/planner work when not needed, and introduce a scan FSM + mission event logging incomm_node. - Add a
commplate reader node entrypoint and wire it into the runtime workflow (tmux + CommNode gating via/plate_reader/enabledand/plate_reader/ready). - Remove the legacy
parking_enforcementpackage (mission, costmap, stereo depth, launch files, docs) in favor of the consolidatedcommapproach.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.sh | Adds a new tmux pane for comm plate_reader_node and shifts bag recording to a new pane. |
| ros2_ws/src/perception/perception/depth_node.py | Adds an enable gate (/perception/depth_enabled) to stop stereo compute when disabled. |
| ros2_ws/src/comm/setup.py | Registers plate_reader_node as a new comm console script. |
| ros2_ws/src/comm/package.xml | Adds runtime exec dependencies for comm nodes. |
| ros2_ws/src/comm/comm/plate_reader_node.py | Refactors plate reader to be comm-local with new /plate_reader/ready signaling and hardcoded config. |
| ros2_ws/src/comm/comm/occupancy_node.py | Adds an enable gate (/occupancy_node/enabled) to stop occupancy compute when disabled. |
| ros2_ws/src/comm/comm/local_planner_node.py | Adds an enable gate (/local_planner/enabled) to stop planning when disabled. |
| ros2_ws/src/comm/comm/comm_node.py | Introduces scan FSM (transit/descend/scan/ascend), stack gating, freshness interlocks, and JSON mission logging. |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/setup.py | Deleted (removes legacy parking_enforcement packaging). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/setup.cfg | Deleted (removes legacy parking_enforcement packaging config). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/README.md | Deleted (removes legacy parking_enforcement documentation). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/stereo_depth_node.py | Deleted (removes legacy stereo depth implementation). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/parking_revisit_node.py | Deleted (removes legacy revisit mission node). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/parking_mission_node.py | Deleted (removes legacy first-pass mission node). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/mission_utils.py | Deleted (removes legacy mission utilities). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/local_costmap_node.py | Deleted (removes legacy local costmap node). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/parking_enforcement/config.py | Deleted (removes legacy shared config). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/package.xml | Deleted (removes legacy package manifest). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/launch/parking_revisit.launch.py | Deleted (removes legacy revisit launch). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/launch/parking_first_pass.launch.py | Deleted (removes legacy first-pass launch). |
| ros2_ws/src/parking_enforcement_package/parking_enforcement/launch/parking_demo.launch.py | Deleted (removes legacy demo launch alias). |
Comments suppressed due to low confidence (5)
ros2_ws/src/comm/comm/plate_reader_node.py:13
- This module imports
tensorrt/pycudaunconditionally. On machines without the Jetson/TensorRT runtime (including dev/CI), the node will crash at import time. Prefer a guarded import with a clear runtime error and a clean shutdown (or amodels_ready=Falsedegraded mode) so the rest of the stack can still run.
ros2_ws/src/comm/comm/plate_reader_node.py:133 - Engine deserialization / context creation can fail (missing file, incompatible engine, CUDA init issues), but initialization is not wrapped in try/except and will crash the node. Catch exceptions during model load, log a helpful error (including the engine path), and ensure
/plate_reader/readystays false so the mission FSM can handle the failure gracefully.
ros2_ws/src/comm/comm/plate_reader_node.py:54 TRTModel.__init__assumesdeserialize_cuda_engine()andcreate_execution_context()succeed; if either returnsNone, later code will fail with a less actionable exception. Add explicit checks and raise a clear error when the engine/context cannot be created.
ros2_ws/src/comm/comm/plate_reader_node.py:192- There is trailing whitespace on the blank line after
current_plate = plate_text, which will failament_flake8(W293). Remove the whitespace-only line to keep the linter passing.
ros2_ws/src/comm/comm/plate_reader_node.py:168 - The node always makes an
overlay = frame.copy()and draws rectangles/text, but the debug image publisher is removed and the overlay is never published. This adds avoidable per-frame CPU cost during scanning; either remove the overlay work or gate it behind a parameter / a debug publisher subscription check.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@copilot want you to do this "comm_node.py — home_pose initialization Before — guard always False, home never setself.home_pose = PoseStamped() Afterself.home_pose = None |
…ate reader, so there is no chance of missing edge condition
removing comment lol Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Agent-Logs-Url: https://github.com/piroo8/capstone2026/sessions/1891e6fb-796b-48eb-89c6-1a7503600428 Co-authored-by: piroo8 <68925426+piroo8@users.noreply.github.com>
d641c27 to
186b617
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 21 out of 23 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (3)
ros2_ws/src/comm/comm/plate_reader_node.py:13
plate_reader_node.pynow imports TensorRT/PyCUDA at module import time with no fallback. On systems without these Jetson-specific dependencies (or in CI), this will raiseImportErrorbefore the node can even start, making the package harder to develop/test. Consider restoring a guarded import (try/except) and having the node log a clear error and stay idle (publishingready=False) when TRT/PyCUDA aren't available.
ros2_ws/src/comm/comm/plate_reader_node.py:54TRTModel.__init__no longer checks whetherdeserialize_cuda_engine()orcreate_execution_context()returnedNone. If engine deserialization fails (corrupt/unsupported engine, wrong TensorRT version), the code will error later with a less actionable exception (e.g., iterating overNone). Add explicit validation and raise aRuntimeErrorwith the engine path so failures are diagnosable.
ros2_ws/src/comm/comm/plate_reader_node.py:192- There is trailing whitespace on the blank line after
current_plate = plate_text(visible before theif len(plate_text) == REQUIRED_PLATE_LEN:block). This will typically be flagged byament_flake8asW293/W291and fail the linter tests. Remove the whitespace (or the blank line).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return | ||
|
|
||
| # Navigate to waypoint at transit altitude | ||
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.current_wp_index, TRANSIT_ALT) |
There was a problem hiding this comment.
dist, xy_dist, dz, yaw = ... assigns xy_dist and dz but they are never used in _update_transit. With ament_flake8 enabled for this package, this is likely to raise F841 (assigned to but never used). Use _ placeholders for unused return values or use the values in logic/logging.
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.current_wp_index, TRANSIT_ALT) | |
| dist, _, _, yaw = self.update_waypoint_navigation(self.current_wp_index, TRANSIT_ALT) |
| # Navigate to scan altitude, holding orientation from transit phase | ||
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.scan_wp_index, SCAN_ALT, self.scan_hold_orientation) | ||
|
|
||
| if abs(dz) < ASCEND_DESCEND_TOL: # Reached scan altitude |
There was a problem hiding this comment.
dist, xy_dist, dz, yaw = ... assigns dist, xy_dist, and yaw but only dz is used in _update_descend. This will likely trigger ament_flake8/pyflakes F841 unused-variable errors. Consider unpacking into _ for the values you don't use.
| self._set_plate_reader_enabled(True) | ||
|
|
||
| # Navigate to hold position at scan altitude | ||
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.scan_wp_index, SCAN_ALT, self.scan_hold_orientation) |
There was a problem hiding this comment.
dist, xy_dist, dz, yaw = ... assigns dist, xy_dist, dz, and yaw but none of them are used in _update_scan (the function only uses timing/confirmed_plate). This is likely to fail ament_flake8 with F841 unused-variable errors. Use _ placeholders or remove the unpacking if the values aren't needed.
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.scan_wp_index, SCAN_ALT, self.scan_hold_orientation) | |
| self.update_waypoint_navigation(self.scan_wp_index, SCAN_ALT, self.scan_hold_orientation) |
| # Navigate to transit altitude, holding orientation from transit phase | ||
| dist, xy_dist, dz, yaw = self.update_waypoint_navigation(self.scan_wp_index, TRANSIT_ALT, self.scan_hold_orientation) | ||
|
|
||
| if abs(dz) < ASCEND_DESCEND_TOL: # Reached transit altitude | ||
| if not self.waiting_for_stack_ready: |
There was a problem hiding this comment.
dist, xy_dist, dz, yaw = ... assigns dist, xy_dist, and yaw but only dz is used in _update_ascend. With ament_flake8, this commonly triggers F841 unused-variable errors. Use _ placeholders for unused values (or log them if useful).
curious draft pull request