LKSeng / rviz_rotatable_image_plugin

RViz plugin to rotate sensor_msgs::Image for visualisation purposes.
BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

No Mixing Rule #1

Closed LKSeng closed 1 year ago

LKSeng commented 1 year ago

It was observed, experimentally, that the rviz_rotatable_image_plugin::ImageRotated sometimes show no image if used with rviz::Image, amongst other effects such as displaying images from the wrong topic. One may also see Tried to advertise a service that is already advertised in this node [/rviz_1683192315335198017/compressed/set_parameters] on each ImageRotated instance being enabled stdout.

Workaround: Replace all rviz::Image plugins with rviz_rotatable_image_plugin::ImageRotated if even one ImageRotated is needed...

This is likely due to that fact that this library extensively uses the original rviz::Image plugin.

Steps to reproduce No Image:

  1. Start an image publishing node, say usb_cam with a physical web cam.
  2. Start RViz.
  3. Add a Image plugin subscribed to the usb_cam image topic
  4. Add a ImageRotated plugin subscribed to the usb_cam image topic
  5. You should see both plugins displaying the image properly. Now disable the Image plugin. Now ImageRotated shows "No Image".
  6. Enable Image again. ImageRotated camera image returns.
  7. Disable ImageRotated. Image remains unaffected.

Corollary; the reverse is also true:

  1. Start an image publishing node, say usb_cam with a physical web cam.
  2. Start RViz.
  3. Add a ImageRotated plugin subscribed to the usb_cam image topic
  4. Add a Image plugin subscribed to the usb_cam image topic
  5. You should see both plugins displaying the image properly. Now disable the ImageRotated plugin. Now Image shows "No Image".
  6. Enable ImageRotated again. Image camera image returns.
  7. Disable Image. ImageRotated remains unaffected.
LKSeng commented 1 year ago

In fact, if rviz_rotatable_image_plugin::ImageRotated was opened first, followed by a rviz::Image, a rotation on rviz_rotatable_image_plugin also applies the same rotation to rviz::Image... either way, the no mixing rule applies until further notice.

LKSeng commented 1 year ago

The issue was due to an object in rviz::Image and rviz_rotatable_plugin::ImageRotated identifying themselves with the same name. By giving ImageRotated a different string, similar to namespacing, this apparent coupling is avoided.