tu-darmstadt-ros-pkg / hector_gazebo

hector_gazebo provides packages related to the simulation of robots using gazebo (gazebo plugins, world files etc.).
http://www.ros.org/wiki/hector_gazebo
181 stars 155 forks source link

Inconsistent initial orientation between melodic/gazebo9 and noetic/gazebo11 #99

Open lkm1321 opened 1 year ago

lkm1321 commented 1 year ago

Hi,

I am finding that the initial orientation of the IMU is inconsistent between melodic/gazebo9 and noetic/gazebo11 by 90 degrees. Without any motion applied to the robot/IMU, melodic/gazebo9 outputs initial orientation (x, y, z, w) = (0, 0, 0, 1), and noetic/gazebo11 (x, y, z, w) = (0, 0, -0.707, 0.707)

We are using the following snippet:

  <gazebo>
    <plugin name="imu_controller" filename="libhector_gazebo_ros_imu.so">
      <robotNamespace>$(arg robot_namespace)</robotNamespace>
      <updateRate>40.0</updateRate>
      <bodyName>imu_enu</bodyName>
      <frameId>imu_enu</frameId>      
      <topicName>an_device/Imu</topicName>
      <accelDrift>0.005 0.005 0.005</accelDrift>
      <accelGaussianNoise>0.005 0.005 0.005</accelGaussianNoise>
      <rateDrift>0.005 0.005 0.005 </rateDrift>
      <rateGaussianNoise>0.005 0.005 0.005 </rateGaussianNoise>
      <headingDrift>0.005</headingDrift>
      <headingGaussianNoise>0.005</headingGaussianNoise>
    </plugin>
  </gazebo>
Martin-Oehler commented 1 year ago

Hello,

I did not check the behavior in melodic/gazebo9, but at least in noetic/gazebo11.11.0, the IMU is working as expected:

TF output (generated with libgazebo_ros_p3d.so)

$ rosrun tf2_tools echo.py world imu_link
At time 17.2, (current time 17.23)
- Translation: [0.107, 0.051, 0.330]
- Rotation: in Quaternion [-0.000, -0.000, 0.014, 1.000]
            in RPY (radian) [-0.000, -0.000, 0.029]
            in RPY (degree) [-0.000, -0.001, 1.639]

IMU output

orientation: 
  x: 8.324221710185843e-06
  y: -2.39617195970217e-06
  z: 0.013792436408627104
  w: 0.9999048797875124
lkm1321 commented 1 year ago

Thanks for getting back to me. To confirm:

  1. Is world in ENU?
  2. With rpyOffset = 0, 0, 0, should the orientation match between the IMU readings and the link specified in bodyName? In this case, melodic/gazebo9 may be in fault. Can test and report back
lkm1321 commented 1 year ago

Thought I'd add more background to 2: our URDF model does have an offset of 90 degrees yaw between base_link and IMU

Martin-Oehler commented 1 year ago

Is world in ENU?

Yes.

Thought I'd add more background to 2: our URDF model does have an offset of 90 degrees yaw between base_link and IMU

This means, the IMU is mounted with an offset, so the values in gazebo11 are probably correct and gazebo9 ignores the mounting offset.