Robotics StackExchange | Archived questions

Sonar data of hector_gazebo_plugin can't update.

Hi, I added the sonar sensor plugin in my urdf like this:

<gazebo reference="head">
        <sensor type="ray" name="sonar">
          <always_on>true</always_on>
          <update_rate>0.1</update_rate>
          <pose>0 0 0 0 0 0</pose>
          <visualize>false</visualize>
          <ray>
            <scan>
              <horizontal>
                <samples>2</samples>
                <resolution>1</resolution>
                <min_angle>-4.71</min_angle>
                <max_angle>1.570796</max_angle>
              </horizontal>
              <vertical>
                <samples>2</samples>
                <resolution>1</resolution>
                <min_angle>-0.01</min_angle>
                <max_angle> 0.01</max_angle>
              </vertical>
            </scan>
            <range>
              <min>0.1</min>
              <max>0.5</max>
              <resolution>0.01</resolution>
            </range>
          </ray>
          <plugin name="gazebo_sonar_controller" filename="libhector_gazebo_ros_sonar.so">
            <gaussianNoise>0.005</gaussianNoise>
            <topicName>sonar/scan</topicName>
            <frameId>head</frameId>
          </plugin>
        </sensor>
      </gazebo>

It published the sonar/scan rostopic successfully, and I can see the range in rviz. But the range measurement is always 0.5 ( the max), no matter what I place in front of the sensor.

X512DA-X512DA:~$ rostopic echo /sonar/scan/range
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---
0.5
---

What am I doing wrong? Thank you!
Update: I tried this, removed my collision and inertial, but it makes no sense.

Asked by ZMang on 2021-08-26 03:07:43 UTC

Comments

Answers