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.

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.

@user136160 thanks this is a great solution seeing as f=ma so f/m=a and will be much less computationally expensive

how do you then make this more like a real IMU by adding lag and noise?

your psuedo-code would be useful for your imu…any chance of sharing

alsoi IsaacSim now has an IMU sensor - anyone know if this can be ported into IsaacGym so we dont have to download the whole omniverse…my lower spec computers cant handle Omniverse so restricte to 1 computer (that is higher spec) vs 3 that can currently run IsaacGym

@user136160 I did exactly as you suggested with the anymal example making it use a force sensor as a perfect IMU - see below and screenshot for the angular acceleration vectors of the base

My pythone code is here. adds an IMU tensor to the GPU pipeline

anymal_terrain.py (38.3 KB)

AnymalTerrain.yaml (4.1 KB)

AnymalTerrainPPO.yaml (1.8 KB)

Can anyone suggest how to make the IMU more realistic by adding some lag, bias, noise etc?

Interesting idea, thanks @sujitvasanth for the code (although I didn’t see that you divided by the mass)

We see that in order to get the gravitational acceleration in free-fall, we need to divide with the **total mass** of the robot, and not the rigid-body’s mass.

Another unknown is related to internal forces - what fore readings do we get on the fake IMU when there are interactions between links of the same asset.

1 Like

when m is constant f is proprtional to a

if we are using the imu in a reward function there is no need to use the mass in the calculation

but I can see times when you might need accurate acceleration values…

Many thanks for your interesting ideas and the codes you provided @user136160 @sujitvasanth

I got another question:

We now use the force sensor to get the linear acceleration.But what if I want the angular acceleration of the actor(rigid body,topology unchanged).

Maybe I can use the equation “T=r X F”,T is the torque ,r is the distance from the contact point to the mass center,and F is the contact force

But it’s hard to get r using isaacgym API

…

not sure. perhaps tell more about the use case?

Hi Mr Peng, please can you explain the use case for needing the torque at a given distance? we could try and work out a solution…