ros-perception / image_transport_plugins

A set of plugins for publishing and subscribing to sensor_msgs/Image topics in representations other than raw pixel data.
BSD 3-Clause "New" or "Revised" License
55 stars 120 forks source link

[ROS2] How to deactivate image_transport plugins in ros2 #160

Closed yangwild closed 5 months ago

yangwild commented 7 months ago

Hello, I am currently working with the image_transport package for publishing image topics. Among the available plugins, the latest image_transport_plugins package includes three formats: image_transport/compressed, image_transport/compressedDepth, and image_transport/theora. I am interested in exclusively retaining the image_transport/compressed format and disabling the others.

While I am aware that uninstalling the corresponding plugins can disable the undesired output formats, I am wondering if it is possible to achieve this goal by modifying the launch file parameters. Is there a way to configure the launch file to specify which image transport plugins are active or deactivated?

Thank you for your assistance.

Best regards

bmegli commented 7 months ago

In ROS1 there is param for that, you may check if it is stll available in ROS2

<!-- Use image_transport Publisher plugin blacklisting to avoid publishing MJPEG  -->
   <rosparam param="/rgb/image_raw/disable_pub_plugins">[image_transport/compressed]</rosparam>

Some real example use:

bmegli commented 7 months ago

ROS1 mechanic in code (noetic)

https://github.com/ros-perception/image_common/blob/cd57529952b65d5180ff27780a0370ab7504e64d/image_transport/src/publisher.cpp#L114C11-L114C11

bmegli commented 7 months ago

ROS2, checking as far as Iron this is not implemented

https://github.com/ros-perception/image_common/blob/a32e834234af161c19d9a2b1cc03991dd6af53e7/image_transport/src/publisher.cpp#L115

The code is commented out which suggests that person originally porting code had no idea how to directly map this mechanic to ROS2

bmegli commented 7 months ago

ROS2 Rolling

It looks like mechanic is back with reversed logic (allowlist) and parameter naming.

https://github.com/ros-perception/image_common/blob/c86efc37c0d0ba640bb5a4787f23319ebc15513d/image_transport/src/publisher.cpp#L126

bmegli commented 7 months ago

See also this

But also note that ROS2 Rolling is developer's rolling version, so it is probably not available yet apart from Rolling

ijnek commented 5 months ago

Closing this, as @bmegli has answered.