image_transport_plugins icon indicating copy to clipboard operation
image_transport_plugins copied to clipboard

[ROS2] compressed_subscriber may create an unintelligible parameter for `mode_param_name`

Open jfinken opened this issue 3 years ago • 1 comments

  • ros2 branch, currently at commit 7ca907277eda51ec2fbb71409bda33d1395d6127
  • See line 79 and line 80 of compressed_subscriber.cpp

What happens if the namespace of a subscriber node (node->get_effective_namespace()) has nothing to do with the base_topic to which it is subscribing?

More specifically, if the namespace from base_topic does not equal node->get_effective_namespace() then mode_param_name may be unintelligible.

Example:

base_topic: /ab_sync_out_ns/camera/sync/image
node->get_effective_namespace(): /efgh_viz_ns/
ns_len: 13
base_topic.substr(ns_len): ns/camera/sync/image
mode_param_name: ns.camera.sync.image.mode

I suspect the code wants to create the value: camera.sync.image.mode.

Thoughts?

jfinken avatar Aug 03 '21 17:08 jfinken

Nice catch, I think you're correct in your assessment. There's no guarantee that the topic name has inherited the node namespace. We should probably instead check if the topic prefix matches the node namespace to decide if we should remove the prefix.

It would be nice to see a simple test case demonstrating the issue.

Pull requests welcome :)

jacobperron avatar Jan 06 '22 19:01 jacobperron