Gazebo Simulation with Sonar Sensor Data on ROS

Hi everyone,

I am hoping to set up basic obstacle detection and avoidance with my drone, and I would like to test my code on the simulator. I would be using sonar rangefinders and see from the rangefinders tutorial that we can easily add this to a drone model or just use something like the typhoon that already has this.

I am able to successfully run the simulation and see the blue projection of the simulated sonar. However, I am not able to see any data published on ROS via mavros. On line 37 of the sonar’s sdf file (src/Firmware/Tools/sitl_gazebo/models/sonar/model.sdf), I can see that the published topic name should be “range_down”. This does not show up under the listed topics being published when running the mavros connection to the simulation.

I also continuously receive this message on the terminal tab of the running simulation:
[Wrn] [] Conversion of sensor type[sonar] not suppported.

I read on the bottom of this forum post that the distance data would only be available through mavlink, but not ROS. Is this true?

I would greatly appreciate if anyone could help me solve this issue. I feel that debugging my code on the simulator is definitely the right strategy for developing an autonomous robot, but all these roadblocks make me feel the costs outweigh the benefits.

Thank you!

Hi Alvinosaur, I also have this issue right now and I’m curious whether you have tackled it. The only thing I got from the QGroundControl analyze widget is the distance sensor output. Besides, the blue projection of the sonar is afront of the drone (typhoon for example), but the distance is to the ground? Then what’s the point of the blue projection? I want to setup obstacle detection too and hence I think the “distance” should be the distance to the object in front of the drone.