Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support QoS override parameters in depth_image_proc/register #1043

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

skalldri
Copy link
Contributor

Hi! This is my first PR to ROS2. Please let me know if there are steps I'm missing or additional things you'd like me to check.

This PR adds support to the depth_image_proc - register node for setting External QoS Configuration on topic subscriptions.

Why?

Sensors are often published with the SENSOR_DATA profile, which cannot be read by subscribers expecting the default QoS profile, as the default profile specifies a reliability == reliable requirement. The SENSOR_DATA profile uses reliability == best_effort, making these publishers and subscribers incompatible.

Because depth_image_proc - register does not provide a way to modify the expected QoS of the topic subscriptions, it cannot subscribe to topics published by other nodes which use the SENSOR_DATA profile.

ROS2's solution to this common problem is to allow External QoS Configuration through the parameter system. While depth_image_proc - register supports External QoS Configuration on published topics, it does not support it on subscribed topics.

This PR adds support for External QoS configuration on subscribed topics.

How?

  • Add the same qos_overriding_options = rclcpp::QosOverridingOptions::with_default_policies() option to all topic subscriptions that is also used on the topic publishers

Testing

  • Compiled on latest pull of ROS2 Rolling
$ colcon build --packages-up-to depth_image_proc
Starting >>> tracetools_image_pipeline
Finished <<< tracetools_image_pipeline [0.22s]
Starting >>> image_proc
Finished <<< image_proc [0.58s]
Starting >>> depth_image_proc
Finished <<< depth_image_proc [20.3s]

Summary: 3 packages finished [21.3s]
  • Compiled and live-tested on ROS2 Jazzy (jazzy branch of my fork). This is the same change that was applied to rolling
  • Recompiled depth_image_proc and launched with QoS remapping arguments using a launch file (on an in-progress robot project):
    Node(
            package='depth_image_proc', 
            executable='register_node', 
            name='depth_register',
            parameters=[
                {'qos_overrides./loomo/realsense/color/image_color/camera_info.subscription.reliability': 'best_effort'},
                {'qos_overrides./loomo/realsense/depth/image_depth/camera_info.subscription.reliability': 'best_effort'},
                {'qos_overrides./loomo/realsense/depth/image_depth.subscription.reliability': 'best_effort'},
            ],
            remappings={
                # in
                ('rgb/camera_info', '/loomo/realsense/color/image_color/camera_info'),
                ('depth/camera_info', '/loomo/realsense/depth/image_depth/camera_info'), 
                ('depth/image_rect', '/loomo/realsense/depth/image_depth'),
                # out
                ('depth_registered/camera_info', '/loomo_synthetic/realsense/depth_registered/image_depth/camera_info'),
                ('depth_registered/image_rect', '/loomo_synthetic/realsense/depth_registered/image_depth')
            },
        ),

Checked for the presence of new parameters in rqt_gui:
image

  • Observed that new QoS Parameters for subscribed topics are present and are being set by the launch parameters
  • Observed that depth_image_proc - register is now accepting messages from topics publishing with the SENSOR_DATA QoS profile with QoS overrides applied

Copy link
Contributor

@ahcorde ahcorde left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution. Hopefully this is the first contribution and there will be much more!

Linters are failing https://build.ros2.org/job/Rpr__image_pipeline__ubuntu_noble_amd64/60/

Do you mind to take a look?

@mikeferguson
Copy link
Member

Thanks for the contribution! Looks like the only issue is the linting - should be easy to fix up - the recommended change for line length is on this page: https://build.ros2.org/job/Rpr__image_pipeline__ubuntu_noble_amd64/60/testReport/junit/depth_image_proc/uncrustify/src_register_cpp/

Searching for SubscriptionOptions in the codebase, I find that we only have that for like 3 nodes... so I think I actually missed doing like half of the work in #847 - I got the publishers setup with QoS Overrides, but missed it for the Subscribers, whoops.

@skalldri
Copy link
Contributor Author

Thank you both for taking a look. I absolutely will fixup the linting! Unfortunately my region got hit by a very bad storm last night and I currently have no power or internet, so I will fix the linting issues once power and Internet is restored in a few days.

@skalldri
Copy link
Contributor Author

My latest commit should resolve the lint issues! colcon test now passes locally:

$ colcon test --packages-up-to depth_image_proc
Starting >>> tracetools_image_pipeline
Finished <<< tracetools_image_pipeline [1.25s]          
Starting >>> image_proc
Finished <<< image_proc [7.66s]          
Starting >>> depth_image_proc
Finished <<< depth_image_proc [2.80s]           

Summary: 3 packages finished [11.9s]

@ahcorde ahcorde merged commit 0dd99bf into ros-perception:rolling Nov 25, 2024
4 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented Nov 25, 2024

https://github.com/Mergifyio backport jazzy

Copy link

mergify bot commented Nov 25, 2024

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Nov 25, 2024
This PR adds support to the `depth_image_proc` - `register` node for
setting External QoS Configuration on topic _subscriptions_.

(cherry picked from commit 0dd99bf)

# Conflicts:
#	depth_image_proc/src/register.cpp
ahcorde added a commit that referenced this pull request Nov 26, 2024
…#1043) (#1044)

This PR adds support to the `depth_image_proc` - `register` node for
setting External QoS Configuration on topic _subscriptions_.

Signed-off-by: Alejandro Hernández Cordero <[email protected]>
Co-authored-by: Stuart Alldritt <[email protected]>
Co-authored-by: Alejandro Hernández Cordero <[email protected]>
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.

3 participants