Raw accelerometer, gyroscope, magnetometer

Hi,
MuJoCo has simulated Accelerometer, Gyroscope and Magnetometer. I would like to simulate the same IMU like is in real robots.

Thanks.
Have a nice day.

There are some functions in torch_jit_utils that get you part of the way to your goal. The ‘compute_rot’ function will get you linear and angular velocity in the local frame. The angular velocity is basically the gyro reading. You need to differentiate the linear velocity to get acceleration. The ‘compute_heading_and_up’ function can help you get a vector that could be similar to the signal from a magnetometer. You might want to add noise or a low pass filter to these to simulate some of the effects an IMU might experience. I’m probably missing something from this approach, I’m currently trying to implement an IMU simulated device for one of my projects.

1 Like

Thanks.

I believe that one day it will be a standard feature in Isaac Gym…

I was able to get what I think is a reasonable approximation of an accelerometer by using a rigid body force sensor and dividing that by that rigid body’s mass, and then adding a gravity vector in the world frame to the acceleration in the local frame using the vector transform feature of the gymapi. The gyro readings are available from the rigid body states. No need to differentiate since the sim can give you the total forces acting on a body which will be proportional to it’s acceleration.