Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lkm1321 opened this issue May 18, 2023 · 4 comments

Comments

@lkm1321
Copy link

lkm1321 commented May 18, 2023

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
Copy link
Member

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
Copy link
Author

lkm1321 commented May 19, 2023

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
Copy link
Author

lkm1321 commented May 19, 2023

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants