Skip to content

feat: BridgeROS2 now have configurable QoS#140

Merged
jlblancoc merged 2 commits intodevelopfrom
feat/bridge-ros2-qos
Apr 28, 2026
Merged

feat: BridgeROS2 now have configurable QoS#140
jlblancoc merged 2 commits intodevelopfrom
feat/bridge-ros2-qos

Conversation

@jlblancoc
Copy link
Copy Markdown
Member

@jlblancoc jlblancoc commented Apr 28, 2026

Summary by CodeRabbit

  • New Features

    • Per-topic QoS for sensor subscriptions, allowing independent reliability and queue-depth settings for LiDAR and IMU.
    • Subscriptions now honor per-topic QoS instead of a single global profile.
    • Invalid QoS values are reported as configuration errors to catch misconfigurations early.
  • Documentation

    • Added guidance on defaults, launch/environment settings, and when to override QoS.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 28, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 02067df8-b35c-412a-96f9-518169ee3581

📥 Commits

Reviewing files that changed from the base of the PR and between 496cc1d and 7cf57ce.

📒 Files selected for processing (1)
  • mola_bridge_ros2/src/BridgeROS2.cpp
✅ Files skipped from review due to trivial changes (1)
  • mola_bridge_ros2/src/BridgeROS2.cpp

📝 Walkthrough

Walkthrough

Adds per-topic ROS 2 subscription QoS: parses optional YAML qos blocks (reliability, history, depth, durability), validates and defaults values, and applies the constructed rclcpp::QoS when creating sensor subscriptions; docs updated to expose launch args/env and operational notes.

Changes

Cohort / File(s) Summary
Documentation
docs/source/mola_ros2_configurations.rst
Documented new sensor subscription QoS axis: default reliability/queue depth for LiDAR/IMU, exposed launch arguments and environment variables, and guidance on when to override defaults.
ROS2 Bridge Implementation
mola_bridge_ros2/src/BridgeROS2.cpp
Introduced per-topic QoS parsing and builder: reads optional qos: YAML block (reliability, history, depth, durability), maps to rclcpp::QoS with defaults (best_effort, keep_last, depth=50, volatile), validates enums and depth rules, and uses the resulting QoS when creating each subscription; invalid values throw exceptions.

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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐇 I nibble configs, tidy and spry,
QoS carrots stacked up high,
Per-topic hops with validated cheer,
Subscriptions settle, calm and near,
Onward I bound—latency clear.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: BridgeROS2 now have configurable QoS' directly summarizes the main change: adding configurable QoS settings to BridgeROS2, which is the core feature implemented across both documentation and code.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/bridge-ros2-qos

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@jlblancoc jlblancoc enabled auto-merge April 28, 2026 10:05
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 3ef86b4 and 35794cf.

📒 Files selected for processing (2)
  • docs/source/mola_ros2_configurations.rst
  • mola_bridge_ros2/src/BridgeROS2.cpp

Comment thread mola_bridge_ros2/src/BridgeROS2.cpp
@jlblancoc jlblancoc disabled auto-merge April 28, 2026 10:07
@jlblancoc jlblancoc enabled auto-merge April 28, 2026 10:08
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 | 🟡 Minor

Skip 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 optional qos: block is malformed or env-expanded to an invalid value, even though the subscription is intentionally skipped. Move buildSubscriptionQoS(topic) below the topic_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

📥 Commits

Reviewing files that changed from the base of the PR and between 35794cf and 496cc1d.

📒 Files selected for processing (1)
  • mola_bridge_ros2/src/BridgeROS2.cpp

@jlblancoc jlblancoc force-pushed the feat/bridge-ros2-qos branch from 496cc1d to 7cf57ce Compare April 28, 2026 10:13
@jlblancoc jlblancoc merged commit b21bfe0 into develop Apr 28, 2026
27 of 28 checks passed
@jlblancoc jlblancoc deleted the feat/bridge-ros2-qos branch April 28, 2026 10:24
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