Problems about contact sensor

Hi, Can I calculate 3-dimension force by contact raw data from get_body_contact_raw_data ?

I want to calculate 3-dimension force maybe from impulse, normal and time.

What unit of impulse here?

What time represents here (it always returns a constant value) ?

The unit for impulse will depend on the units used in your simulation, by default this should be MKS units, I’ll double check on that. What is the value of the time returned that you are seeing? I believe this is the time step for the frame where the event takes place, and impulse / time = force.

Update: I was wrong, the ‘time’ parameter is supposed to be a clock time from the beginning of the simulation. If you aren’t seeing it change, it might be a bug. We will look into it.

–Mike

Hi, yes, you can calculate the contact force from the Raw data. The force will be given by F = I / dt, where I is the impulse in the Raw data.

Bear in mind that the Impulse is already a vector, that may be a different direction from the contact normal (which is also provided in the raw data).

You can obtain the timestep from the physics step update callback that you use to work on your environment, as in this minimal example on how to set up the physics step update:

import omni.physx as _physx

sub = _physx.get_physx_interface().subscribe_physics_step_events(_on_update)

def _on_update(timestep):
   do_stuff()

For simplicity, we are adding the timestep in the raw data structure, along with the time, which is the timestamp in simulation time for the contact.

Hi, the ‘time’ parameter returned by get_body_contact_raw_data is fixed (it’s also different from physics step that I set).
But in get_sensor_readings, it’s a clock time which is correct.

Hi, thanks for providing the solution. I can calculate 3 dimension force from impulse now.

@q199493422 with the 2021.1.1 release this week, dt is now provided as part of raw data by the contact sensor to make your usecase a bit easier.

https://docs.omniverse.nvidia.com/py/isaacsim/source/extensions/omni.isaac.contact_sensor/docs/index.html#omni.isaac.contact_sensor._contact_sensor.CsRawData.dt

1 Like