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

How to display sonar readings in Rviz

asked 2011-06-06 02:11:04 -0600

ringo42 gravatar image

I have a custom robot and have a URDF model of it set up in rviz. I have several Sonars and Sharp IR sensors mounted on it. I'm working my way toward using the navigation tools, how do I show my sensor readings in Rviz? Or am I heading in the wrong direction?

edit retag flag offensive close merge delete


So I've requested a new plugin in RVIZ! Hopefully this will be resolved soon. :)
Chad Rockey gravatar image Chad Rockey  ( 2011-06-07 15:03:46 -0600 )edit

4 Answers

Sort by ยป oldest newest most voted

answered 2011-06-06 07:30:06 -0600

Chad Rockey gravatar image

updated 2018-06-14 18:02:57 -0600

Officially merged as sensor_msgs/Range with RVIZ Plugin:

Old answer:

Hi, in order to display sonars in RVIZ, you could modify the nxt_rviz_plugin on your own or use the one we've already modified. Our repository is ( and the relevant package is range_rviz_plugin. An example view of this plugin is available here on my youtube.

If you download the range_rviz_plugin and then rosmake range_rviz_plugin, it will be available in RVIZ under "Plugins -> Manage" and then make sure it's selected. It should then be available in the normal way "Add" -> "New Display", etc.

The way we've designed the plugin to work, you should publish sensor_msgs/Range messages on a common topic for each division you care about. For instance, I read all of my sonars in serial order to minimize read errors and publish each of these on /sonars. The way I tell the sonars apart is through the transform frame_ids, and I rely on tf to transform the range data for my other nodes. I have 6 sonars, so I set Buffer Length to 6 so that each of my sonars is always visible.

I would recommend you publish your sonars on one topic and then at least one other topic for your IR rangers.

edit flag offensive delete link more


The github link is not active, can you repost the link please

Kartik Paigwar gravatar image Kartik Paigwar  ( 2018-06-14 05:15:46 -0600 )edit

I updated the answer, but look here:

Chad Rockey gravatar image Chad Rockey  ( 2018-06-14 18:03:08 -0600 )edit

answered 2011-07-15 05:25:17 -0600

hersh gravatar image

I have just now committed a "Range" display to rviz. It is currently in trunk. In a few days we'll probably have a debian in ros-unstable, and when Electric releases, this should be included.

Thanks to Chad Rockey and Melonee Wise for the range display code.

edit flag offensive delete link more

answered 2011-06-06 04:05:47 -0600

Wim gravatar image

The NXT stack contains a plugin to display sonar messages in rviz. The sonar readings get displayed as a cone. See this page for more details.

edit flag offensive delete link more

answered 2011-06-06 03:03:48 -0600

David Lu gravatar image

The B21r also has sonar and IR sensors. The IR is not currently published, but the sonar is published via a point cloud.

B21r documentation


edit flag offensive delete link more

Question Tools

1 follower


Asked: 2011-06-06 02:11:04 -0600

Seen: 4,032 times

Last updated: Jun 14 '18