Can't get sonar data with rostopic echo

asked 2017-11-28 07:05:34 -0500

moshimojo gravatar image

updated 2017-12-07 11:15:43 -0500

I've added a sonar sensor on my custom robot model, and i also added the plugin for the sonar in my xacro file like this:

  <gazebo reference="sonar1">
<sensor name='sonar_sensor' type='ray'>
  <plugin filename="" name="gazebo_ros_sonar1_controller">


In Topic Visualization window inside gazebo gui i see the topic


and i can view the data with the

gz topic -e /gazebo/default/robot/link_name/sonar_sensor/scan

but i want to see the sonar data via

rostopic echo /sensor/sonar0

which is the topicName inside the plugin. So i followed evarobot tutorials and subscribed on that topic. The problem is that when i run

rosrun evarobot_sonar_subs sonar_listener

and then

rostopic echo /sensor/sonar0

i get the message

WARNING: no messages received and simulated time is active. Is /clock being published?

Do i miss something? Thanks in advance!

edit retag flag offensive close merge delete


Does running "rostopic list" displays anything related to sonar0? anything in the logs? Running roslaunch with the option output:=screen gives any hint?

Jose Luis Rivero gravatar imageJose Luis Rivero ( 2017-11-29 04:59:37 -0500 )edit

Rostopic list displays the topic normally when i rosrun the evarobot file. Roslaunch with that option doesn't give me anything. I also changed the name of the topic through the evarobot cpp file to "/gazebo/default/robot/link_name/sonar_sensor/scan" but nothing changed and i see that also in the rostopic list. But now i'm not able to change it back to sonar0 even if i change the cpp file and build it again.

moshimojo gravatar imagemoshimojo ( 2017-11-29 09:18:46 -0500 )edit

So gazebo itself seems to work well but the plugin seems to have some problems. It is part of hector repository, if I'm not wron. You could try getting help into their issue tracker

Jose Luis Rivero gravatar imageJose Luis Rivero ( 2017-12-07 13:15:57 -0500 )edit

ok thank you!

moshimojo gravatar imagemoshimojo ( 2017-12-08 10:31:16 -0500 )edit