ros-simulation / gazebo_ros_pkgs

Wrappers, tools and additional API's for using ROS with Gazebo
http://wiki.ros.org/gazebo_ros_pkgs
776 stars 772 forks source link

wrong imu linear_acceleration.z with libgazebo_ros_imu_sensor.so plugin. #1366

Open panecho opened 2 years ago

panecho commented 2 years ago

Issue: plot result showed as following picture, left is in gazebo, and right is ros topic in ros rqt.<pub topic at 200HZ> image

my imu sdf file:

<?xml version="1.0" ?>
<sdf version="1.6">
  <model name="imu_ros">
    <link name="link">
      <gravity>1</gravity>
      <inertial>
        <mass>0.1</mass>
      </inertial>
      <visual name="visual">
        <geometry>
          <box>
            <size>0.1 0.1 0.1</size>
          </box>
        </geometry>
      </visual>
      <collision name="collision">
        <geometry>
          <box>
            <size>0.1 0.1 0.1</size>
          </box>
        </geometry>
      </collision>
      <sensor name="imu" type="imu">
        <always_on>1</always_on>
        <update_rate> 200 </update_rate>
        <visualize>true</visualize>
        <topic>imu_raw</topic>
        <plugin name="imu_plugin" filename="libgazebo_ros_imu_sensor.so">
          <topicName>/imu_raw</topicName>
          <frameName>imu_link</frameName>
          <updateRateHZ>200</updateRateHZ>
          <gaussianNoise>0.0</gaussianNoise>
          <xyzOffset>0 0 0</xyzOffset>
          <rpyOffset>0 0 0</rpyOffset>
        </plugin>
      </sensor>
    </link>
  </model>
</sdf>
KhalidOwlWalid commented 2 years ago

By any chance, what are you currently working on?

https://github.com/ros-simulation/gazebo_ros_pkgs/issues/1363

I am having the same issue. Do you mind trying this out and see if this also happens to you?

panecho commented 2 years ago

By any chance, what are you currently working on?

1363

I am having the same issue. Do you mind trying this out and see if this also happens to you?

Actually, I didn't figure it out. But I got some info which may help you from my weekly debug. 1> Do not use gazebo_ros_pkg for imu simulation, imu simulation without ros api seem to more stable. 2> Try different physics engine install of ode, imu data seem more stable. By the way, all engine got noise data for imu simulation in motion sittuation. Good luck.

KhalidOwlWalid commented 2 years ago

Thanks for the suggestion but I have a few question. :)

By trying different physics engine, are you implying that I should try physics engine other than gazebo?

1> Do not use gazebo_ros_pkg for imu simulation, imu simulation without ros api seem to more stable.

I've read the source code of the IMU for and as far as I am concern, here is where they are calculating the IMU sensor data.. By imu simulation without ros api seem to be more stable , are you implying that the plugin uses ROS API? Cause as far as I am concern, I dont think that they are using any ROSS API in the plugin.

panecho commented 2 years ago

when you lauch gazebo by roslaunch gazebo_ros empty_world.launch for ros support, it will load a system plugin which I named ros api, see here which affect the imu data athought i agree with the imu implementation you mentioned,, actually I also review this code before.

for different physics engine mean launch gazebo by gaebo -e ode | bullet | simbody | dart, add imu, you will find different imu performance with different physics engine.

robilnovice commented 1 year ago

did you try changing real time update and max step size accordingly to 10000, 0.0001 ?

In my simulation if I change it to 500 hz I get wrong imu readings

EmmanuelMess commented 3 weeks ago

Adding noise helps with this. ~0.5 gaussian noise.