ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

PointCloud2 visualisation in rviz2

asked 2021-01-26 09:54:28 -0500

g.bardaro gravatar image

updated 2021-01-26 11:55:23 -0500


Apparently the problem is not about visualisation or rviz. I tried to implement a minimal subscriber that receives point cloud messages and just print a notification and it doesn't work. The callback is never called. However, if I use ros2 echo I can subscribe and receive messages. I can confirm that the nodes are connected in the graph, so it is not a topic name issue.

image description

Am I missing something?


Hi all,

I am finally migrating from ROS1 to ROS2 and, currently, I am trying to implement nodes to process depth images and point clouds.

I have a node that reads depth images from a folder and publishes them as messages paired with the corresponding camera calibration message. These depth messages are feed to depth_image_proc::PointCloudXyzNode, which correctly publish them as point clouds.

This is the output I get from echoing the topic:

    sec: 1611675769
    nanosec: 545850714
  frame_id: camera_depth_optical_frame
height: 480
width: 640
fields: '<sequence type: sensor_msgs/msg/PointField, length: 3>'
is_bigendian: false
point_step: 16
row_step: 10240
data: '<sequence type: uint8, length: 4915200>'
is_dense: false

From here the message seems fine and well-formed. However, when I try to see in rviz2 I get nothing. At first I thought it was a problem with tf, so I tried to publish a dummy transformation between map and camera_depth_optical_frame, but nothing appears.

This is what I get in rviz2:

image description

No matter what it keeps saying: "Showing [0] points from [0] messages"

Any idea of what could be the problem?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-01-27 08:30:45 -0500

g.bardaro gravatar image

To expand on the solution provided in the previous answer.

depth_image_proc::PointCloudXyzNode publisher has a "sensor data" QoS profile, which means it has a "best effort" reliability policy. This policy is incompatible with the default QoS profile that uses "reliable" as its reliability policy.

ros2 topic echo was still working because it defaults to "sensor data" as a QoS profile when no profile is provided.

To whoever may run in this same issue, you can check the profile of every publisher and subscriber on a topic by using ros2 topic info -v [topic_name].

Maybe a warning of some sort should be included somewhere to notify if two nodes are using incompatible QoS profiles?

edit flag offensive delete link more

answered 2021-01-26 11:54:05 -0500

soldierofhell gravatar image

Maybe try change Topic - > Reliability?

edit flag offensive delete link more


Sorry, I answered your comment saying that this change did nothing, but this is actually the solution. I was in a rush and did not change the fixed frame in the Global options.

g.bardaro gravatar image g.bardaro  ( 2021-01-27 08:10:51 -0500 )edit

Hello, I am having the error mentioned but for Velodyne LiDAR. Can you please share what you add for 'fixed frame' under 'Global options' and how did you figure out what was to be added.

Thank you!

Haritha gravatar image Haritha  ( 2021-11-07 12:28:04 -0500 )edit

Question Tools



Asked: 2021-01-26 09:54:28 -0500

Seen: 4,067 times

Last updated: Jan 27 '21