Ask Your Question
4

[ROS2] rviz2 and rqt do not shown published image

asked 2020-08-13 00:36:31 -0500

lmiller gravatar image

updated 2020-08-13 05:24:09 -0500

Hi,

I have created a Gazebo world with a camera and the image is publishing to a topic of type sensor_msgs/msg/Image. I opened rviz2 and rqt to see the published image. But both tools shown a empty image.

RViz2

RQT

When I run the ros2 topic echo command I see that image data is published.

To test it you can use the gazebo_ros_camera_demo.world from the gazebo_plugin package.

Is this a bug of rviz and rqt or is there a missing setting?


EDIT:

QoS are the the same by default. I ran the command ros2 topic info -v /demo_cam/camera1/image_raw and got following output:

Type: sensor_msgs/msg/Image

Publisher count: 1

Node name: camera_controller
Node namespace: /demo_cam
Topic type: sensor_msgs/msg/Image
Endpoint type: PUBLISHER
GID: 01.0f.0d.01.ba.44.00.00.01.00.00.00.00.00.12.03.00.00.00.00.00.00.00.00
QoS profile:
  Reliability: RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT
  Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
  Liveliness lease duration: 2147483651294967295 nanoseconds

Subscription count: 1

Node name: rviz
Node namespace: /
Topic type: sensor_msgs/msg/Image
Endpoint type: SUBSCRIPTION
GID: 01.0f.0d.01.99.45.00.00.01.00.00.00.00.00.26.04.00.00.00.00.00.00.00.00
QoS profile:
  Reliability: RMW_QOS_POLICY_RELIABILITY_RELIABLE
  Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE
  Lifespan: 2147483651294967295 nanoseconds
  Deadline: 2147483651294967295 nanoseconds
  Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC
  Liveliness lease duration: 2147483651294967295 nanoseconds
edit retag flag offensive close merge delete

Comments

I tried to reproduce your problem in eloquent and experienced the same issue in rviz. However, rqt works out of the box for me. Looks like rviz requires the tf transform from your fixed frame to camera_link to be available. Try setting your fixed frame to camera_link or providing a tf transform.

Another common issue in this context are mismatching Quality of Service settings. However, it works fine with the default settings in my case. (not sure whether rqt's default QoS settings changed in foxy)

Phgo gravatar image Phgo  ( 2020-08-13 04:36:03 -0500 )edit

Thanks for your reply. I have edited my question with the QoS. I also tried to set the fixed frame in RViz to camera_link but I dont get it working

lmiller gravatar image lmiller  ( 2020-08-13 05:26:08 -0500 )edit

@lmiller you wrote in your edit, that the QoS settings are the same but your log output shows that your publisher is reliability BEST_EFFORT, while the subscriber is set to RELIABLE. This is not a compatible configuration (see here). Have you tried changing your rviz subscriber to best effort in the topic section?

Phgo gravatar image Phgo  ( 2020-08-13 06:09:52 -0500 )edit
1

@Phgo Oh I didnt see that. I set the reliability QoS to Best Effort in RViz & the world frame to camera_link and now it works in RViz.

lmiller gravatar image lmiller  ( 2020-08-13 06:21:48 -0500 )edit

@lmiller as far as I know is not yet possible to change the QoS in rqt GUI (The issue addressing this is still open) Do you need any further help on this or does this answer your question?

Phgo gravatar image Phgo  ( 2020-08-13 06:48:49 -0500 )edit

@Phgo Thanks this answered my question

lmiller gravatar image lmiller  ( 2020-08-13 06:56:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2020-08-13 07:47:06 -0500

lmiller gravatar image

As @Phgo answered in the comments the QoS were mismatched. Also the frame in RViz was not set correctly.

The image plugin in RQT has no option to set the QoS (see in that issue)

edit flag offensive delete link more

Comments

Is there a reason why the fixed frame needs to be the camera link? Does that mean I would have to open another RViz instance jut to view my robot model / localization instancesfrom my base link?

808brick gravatar image 808brick  ( 2021-03-30 17:35:34 -0500 )edit

If you have a TF from your fixed frame to your camera_link, then No there is no reason. In my Case i had not any TF to my camera_link

lmiller gravatar image lmiller  ( 2021-03-31 00:09:00 -0500 )edit

Hmm, it seems it does not count "revolute" joints. I am able to view images using the link I joined to the camera using "fixed", but then that link is joined via revolute joint to my base, and I am not able to view using the base as my frame.

808brick gravatar image 808brick  ( 2021-03-31 03:50:17 -0500 )edit

Please open a new question if it doesnt work for you. So other people can join the discussion and may help you. Dont forget to post all relevant stuff like ROS distro, Code, etc...

lmiller gravatar image lmiller  ( 2021-03-31 03:56:46 -0500 )edit

Understood. Apologies for getting off topic.

808brick gravatar image 808brick  ( 2021-03-31 03:57:51 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

3 followers

Stats

Asked: 2020-08-13 00:36:31 -0500

Seen: 2,290 times

Last updated: Aug 13 '20