feat: BridgeROS2 now have configurable QoS#140
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdds per-topic ROS 2 subscription QoS: parses optional YAML Changes
Sequence Diagram(s)sequenceDiagram
participant Config as Config YAML
participant Bridge as BridgeROS2
participant QoS as QoS Builder
participant RCL as rclcpp / ROS2 middleware
Config->>Bridge: supply topic entries (may include `qos:`)
Bridge->>QoS: parse and validate per-topic `qos` block
QoS-->>Bridge: return constructed `rclcpp::QoS`
Bridge->>RCL: create_subscription(topic, callback, rcl_qos)
RCL-->>Bridge: subscription handle
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@mola_bridge_ros2/src/BridgeROS2.cpp`:
- Around line 113-129: The code silently treats unknown qos.history values as
"keep_last" and passes possibly invalid depth to rclcpp::QoS::KeepLast; update
validation so that after reading qosCfg["history"] and qosCfg["depth"] you
explicitly check that history is one of "keep_all" or "keep_last" and if
history=="keep_last" ensure depth is present and >0 (otherwise log an error and
abort/throw), then construct rclcpp::QoS using rclcpp::KeepAll() only for
"keep_all" or rclcpp::KeepLast(depth) for a validated depth; reference the
variables qosCfg, history, depth and the rclcpp::QoS construction
(KeepAll/KeepLast) when making the change.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5be6897f-ac17-437e-9cad-efe24cfc7cad
📒 Files selected for processing (2)
docs/source/mola_ros2_configurations.rstmola_bridge_ros2/src/BridgeROS2.cpp
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
mola_bridge_ros2/src/BridgeROS2.cpp (1)
2105-2117:⚠️ Potential issue | 🟡 MinorSkip disabled subscribe entries before parsing
qos.Line 2109 builds and validates QoS before the empty-topic fast path. That means a disabled slot like
${TOPIC|}can still abort startup if its optionalqos:block is malformed or env-expanded to an invalid value, even though the subscription is intentionally skipped. MovebuildSubscriptionQoS(topic)below thetopic_name.empty()check.Suggested patch
- const rclcpp::QoS qos = buildSubscriptionQoS(topic); - // Skip entries with empty topic name (allows optional subscribe slots // controlled via env vars, e.g. ${ODOM1_TOPIC|}): if (topic_name.empty()) { MRPT_LOG_DEBUG_STREAM( "Skipping subscribe entry with empty topic name (label='" << output_sensor_label << "')"); continue; } + + const rclcpp::QoS qos = buildSubscriptionQoS(topic);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@mola_bridge_ros2/src/BridgeROS2.cpp` around lines 2105 - 2117, The QoS is being constructed before checking for an empty topic name, so malformed or env-expanded qos blocks can abort startup for intentionally disabled slots; move the call to buildSubscriptionQoS(topic) so it occurs after the empty-topic check (i.e., after the if (topic_name.empty()) { ... continue; } block) to ensure disabled subscribe entries (identified by topic_name and output_sensor_label) are skipped without parsing their qos.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@mola_bridge_ros2/src/BridgeROS2.cpp`:
- Around line 2105-2117: The QoS is being constructed before checking for an
empty topic name, so malformed or env-expanded qos blocks can abort startup for
intentionally disabled slots; move the call to buildSubscriptionQoS(topic) so it
occurs after the empty-topic check (i.e., after the if (topic_name.empty()) {
... continue; } block) to ensure disabled subscribe entries (identified by
topic_name and output_sensor_label) are skipped without parsing their qos.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1612ff00-f7bf-4e0f-a350-373fc71eca9c
📒 Files selected for processing (1)
mola_bridge_ros2/src/BridgeROS2.cpp
496cc1d to
7cf57ce
Compare
Summary by CodeRabbit
New Features
Documentation