ros-perception / image_common

Common code for working with images in ROS
http://www.ros.org/wiki/image_common
129 stars 223 forks source link

image_transport republish broken on Foxy? #171

Open KenYN opened 4 years ago

KenYN commented 4 years ago

I have the latest version installed, and I do the following:

$ ros2 topic list
/bar
/foo
/parameter_events
/rosout

OK, a couple of left-over topics (how do I flush everything out?) but otherwise OK

$ ros2 run image_transport republish compressed --ros-args --remap in:=/woo -- --ros-args --remap out:=/bazzle -- &
[1] 1661358
$ ros2 topic list
/bar
/bazzle
/foo
/in/compressed
/out/compressed
/parameter_events
/rosout

Oops, I expect to see:

$ ros2 run image_transport republish compressed --ros-args --remap in:=/woo -- --ros-args --remap out:=/bazzle -- &
[1] 1661358
$ ros2 topic list
/bar
/bazzle
/bazzle/compressed
/foo
/woo
/woo/compressed
/parameter_events
/rosout

It looks to me like the remapping has not been applied. I see the same problem with image_transport::create_subscription() and using ComposableNode(..., remappings=[]). remappings works fine, however, when using rclcpp::Node::create_subscription().

KenYN commented 4 years ago

It would seem to be related to this issue:

https://github.com/ros2/rclcpp/issues/985

GertVen commented 2 years ago

Sorry to bring up an old question, but does anybody have a solution for the remapping, or is the "out/" the correct way ? When creating an image transport I also get a bunch of "out/*" topics, for example:

ros2 run image_transport republish raw --ros-args --remap in:=/a/image_raw --remap out:=/a/image_comp ros2 run image_transport republish raw --ros-args --remap in:=/b/image_raw --remap out:=/b/image_comp

Passes out: /a/image_raw /a/image_comp /b/image_raw /b/image_comp /out/compressed /out/compressed_depth /out/theora

I am using ROS2 Galactic

If the data above is correct, what would be the best way to differentiate between two different input streams, for example a front and a rear camera.

Thanks!

Purg commented 2 years ago

I think I have an "answer", or at least some sort of working usage. When you only pass the ros2 run image_transport republish raw, you are saying to "read in raw, republish all plugins" (thus all of compressed/depth/theora). It seems like the republish tool wants a --remap for every applicable out, e.g. --remap out/compressed:=target/compressed --remap out/compressedDepth:=target/compressedDepth [etc.]. If the original intention is to not have to be this verbose, it doesn't seem to work that way anymore.

In my particular use-case, I just want the compressed republish, so I've landed on:

ros2 run image_transport republish raw compressed --ros-args --remap in:=/target --remap out/compressed:=/target/compressed`

And wind up with the topics:

/target
/target/compressed
dcconner commented 2 years ago

This issue also breaks image_transport camera_pub/sub with std::string info_topic = getCameraInfoTopic(image_topic);

I was hoping that https://github.com/ros-perception/image_common/pull/188 would fix, but testing with that change does not address the issue

abourbou commented 1 year ago

I think I have an "answer", or at least some sort of working usage. When you only pass the ros2 run image_transport republish raw, you are saying to "read in raw, republish all plugins" (thus all of compressed/depth/theora). It seems like the republish tool wants a --remap for every applicable out, e.g. --remap out/compressed:=target/compressed --remap out/compressedDepth:=target/compressedDepth [etc.]. If the original intention is to not have to be this verbose, it doesn't seem to work that way anymore.

In my particular use-case, I just want the compressed republish, so I've landed on:

ros2 run image_transport republish raw compressed --ros-args --remap in:=/target --remap out/compressed:=/target/compressed`

And wind up with the topics:

/target
/target/compressed

Thank you the problem of topic is indeed resolved if you put the exact name_space you want to change depending on compression. If using raw input in:=target and if you are using compressed input : in/compressed:=target/compressed. This is also true for out.