Robotics StackExchange | Archived questions

How can I visualise the ultrasonic sensor in Gazebo?

I want to add a gazebo plugin which is called 'sonar'. Here is my code that I took from the source:

<gazebo reference="ultrasonic">
      <sensor type="ray" name="sonar">
          <pose>0.25 0 0 0 0 0</pose>
          <visualize>true</visualize>
          <update_rate>5</update_rate>
          <ray>
            <scan>
              <horizontal>
                <samples>5</samples>
                <resolution>1.0</resolution>
                <min_angle>-0.25</min_angle>
                <max_angle>0.25</max_angle>
              </horizontal>
              <vertical>
                <samples>5</samples>
                <resolution>1</resolution>
                <min_angle>-0.25</min_angle>
                <max_angle>0.25</max_angle>
              </vertical>
            </scan>
            <range>
              <min>0.01</min>
              <max>0.75</max>
              <resolution>0.01</resolution>
            </range>
          </ray>
          <plugin filename="libgazebo_ros_range.so" name="gazebo_ros_range">
            <gaussianNoise>0.005</gaussianNoise>
            <alwaysOn>true</alwaysOn>
            <updateRate>5</updateRate>
            <topicName>/genius/sonar</topicName>
            <frameName>ultrasonic</frameName>
            <fov>0.5</fov>
            <radiation>ultrasound</radiation>
          </plugin>
        </sensor>
      </gazebo>

I have added visualize to be true but in a gazebo simulation I can't see the cone shaped array from the sonar. What am i doing wrong here? Btw, I have added links and joints in my main xacro file, so the fault isn't there.

Asked by stevemartinov on 2018-09-19 03:24:00 UTC

Comments

Answers