Ask Your Question

Viewing p2os sonar in RViz

asked 2015-04-07 14:37:47 -0500

updated 2015-04-07 15:31:39 -0500

I would like to get the sonar sensors for my Pioneer P3-DX robot up and running. I am utilizing ROS Hydro on Ubuntu 12.04 on both a base laptop and a PC on the P3-DX.

I've gone into p2os/p2os_driver/src/ and changed the parameter use_sonar to true in order to get the sonar sensors firing and the p2os_msgs/SonarArray messages published to the /sonar topic.

However, because p2os_msgs/SonarArray is not a standard sensor_msg, I am unable to view the sonar data in RViz or use it for navigation.

Any thoughts?

Thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-07 17:28:27 -0500

First, I would suggest setting the use_sonar parameter using a ROS launch file rather than changing and recompiling the p2os_driver code, so that you can more easily modify the parameter setting in the future, or (perhaps more usefully) you can have multiple launch files for various application configurations, perhaps some that use the sonars and some that do not.

But in regards to the main question, there are many ways to do this. For example, you could convert the sonar readings to a point cloud. But that doesn't really capture what a sonar is doing. To get a nice visualization in rviz that more accurately represents the (large) sensitivity cone of each sonar, you could the sensor_msgs/Range datatype, which you can visualize in rviz.

I have not done this myself yet, but I believe you need to define the coordinate frame of each sonar, using something like static_transform_publisher to define static offsets relative the the frame of the robot. Then for each message you receive on the /sonar topic, you would send out a bunch of sensor_msg/Range messages, one for each sonar.

All that being said, I don't have access to a Pioneer anymore, so I haven't tried any of this myself. Perhaps one of the Pioneer users will have a better idea.

edit flag offensive delete link more


Yep. That is what I figured I would have to do and was hoping for an easier way. Taking a look at this question, I was hoping someone already had a solution.

sealguy77 gravatar image sealguy77  ( 2015-04-08 10:55:46 -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

1 follower


Asked: 2015-04-07 14:37:47 -0500

Seen: 692 times

Last updated: Apr 07 '15