# Bug in the IMU sensor?

Hey all,

I think the IMU sensor has a minor bug, the units within the IMU are not coherent. The acceleration over x and y are given in cm/s/s, but the acceleration over z is in m/s/s. I feel like what is happening is that the acceleration is given in cm/s/s on all 3 axes and the gravity is added in m/s/s.

Here are some reading I get on my 2D robot using the following:

``````    def publishIMUMessage(self):
print(data)
self.imu_msg.angular_velocity.x = data[0][4]
self.imu_msg.angular_velocity.y = data[0][5]
self.imu_msg.angular_velocity.z = data[0][6]
self.imu_msg.linear_acceleration.x = data[0][1]
self.imu_msg.linear_acceleration.y = data[0][2]
self.imu_msg.linear_acceleration.z = data[0][3]
self.imu_pub.publish(self.imu_msg)
``````

While moving: (Itâ€™s a boat it is not accelerating at 54G)

``````#[(time, acc_x, acc_y, acc_z, gyro_x, gyro_y, gyro_z)]
[(511.20264, 55.390423, -2.7953837, 7.194916, 0.00062335, -0.00899086, 0.00814641)]
[(511.2193, 55.03003, -2.775628, 7.9078984, 0.00102016, -0.01097006, 0.00804718)]
``````

At rest:

``````#[(time, acc_x, acc_y, acc_z, gyro_x, gyro_y, gyro_z)]
[(527.7486, 0.05149575, -0.51203895, 9.797922, -2.0156001e-05, 2.3386765e-05, -0.00152975)]
[(527.76526, 0.04947602, -0.50816506, 9.795961, -1.8294593e-05, 1.8335544e-05, -0.0015141)]
``````

Thanks,

Best,

Antoine

Hi Antoine,
Can you double check your current stage units? Notice in the IMU sensor example we multiply the sensor readings per the current stageâ€™s meter per unit.

self.meters_per_unit = UsdGeom.GetStageMetersPerUnit(omni.usd.get_context().get_stage())
(â€¦)
(â€¦)

The default meters per unit is 0.01, though you can change this in the Preferences window. If you are creating the scene/stage programmatically you can also set it with

UsdGeom.SetStageMetersPerUnit(omni.usd.get_context().get_stage(),METERS_PER_UNIT)

I have not touched the units, so they should be in cm.
And here is my physics block:

Yes I considered dividing by 100 but then the gravity reading would be wrongâ€¦

Right, I believe the IMU sensor readings should be outputted in meters nevertheless. So either something wrong with the sensor implementation on our side or with the way the Physics scene is setup. Weâ€™ll double check this internally and get back to you

1 Like

@antoine.richard, this has been fixed internally and will be available in an upcoming hotfix release. Thanks for letting us know.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.