Gazebo Crashes if IMU Plugin Added

Hello @staff,

Whenever I attempt to add the IMU plugin to my_gurdy Quiz, Gazebo crashes. Otherwise, everything is working fine including the controllers.

Here is the script that I used for the IMU Plugin:

<gazebo reference= "base_link">
<gravity>true</gravity>
<sensor name="imu_sensor1" type="imu">
<always_on>true</always_on>
      <update_rate>50</update_rate>
      <visualize>true</visualize>
      <topic>__default_topic__</topic>
    <plugin name="gazebo_ros_imu_controller" filename="libgazebo_ros_imu.so">
      <robotNamespace>/gurdy</robotNamespace>
      <topicName>imu/data</topicName>
      <serviceName>imu/service</serviceName>
      <bodyName>base_link</bodyName>
      <gaussianNoise>0</gaussianNoise>
      <rpyOffsets>0 0 0</rpyOffsets>
      <updateRate>10.0</updateRate>
      <alwaysOn>true</alwaysOn>
      <gaussianNoise>0</gaussianNoise>
    </plugin>

  </sensor>
</gazebo>

Please let me know that what is wrong in these lines that makes Gazebo crash.

Also, I would like to add that when I use this plugin as is given in the quiz problem description (i.e. without ) , it doesn’t crash, however, I don’t see IMU topic publishing in rostopic list .

Regards,
Kashish Dhal

You should place this code:

<gazebo>

        <plugin name="gazebo_ros_imu_controller" filename="libgazebo_ros_imu.so">

          <robotNamespace>/gurdy</robotNamespace>

          <topicName>imu/data</topicName>

          <serviceName>imu/service</serviceName>

          <bodyName>base_link</bodyName>

          <gaussianNoise>0</gaussianNoise>

          <rpyOffsets>0 0 0</rpyOffsets>

          <updateRate>10.0</updateRate>

          <alwaysOn>true</alwaysOn>

          <gaussianNoise>0</gaussianNoise>

        </plugin>

    </gazebo>
2 Likes

Hello @duckfrost,

Yes, this works!

The issue is now resolved but I would still like to know why gazebo crashes with the code I wrote earlier (it’s the standard code used for IMU)?

Please let me know. I am asking because it will help me debug the code later if I encounter the same problem in future while working on my projects.

Cheers,
Kashish Dhal

One of the things is taht you were decaring the gazebo sensor as you declare it in SDFs, which is different form the way they are declared in URDFs or XACROS.

1 Like

Thanks @duckfrost, got it!