Is it possible to simulate force/torque sensor in Isaac Sim?

Hi, I’m trying to simulate force/torque sensor in Isaac Sim. When I check the documentation on the website, they tell me that this sensor is deprecated.
Is there a way to obtain the precise values ​​of a force on a certain point of a rigid body? I tried with contact sensors but they only give me the surface load, not the force values ​​in the 3 directions. If it’s not available yet, do you have any idea when this will be implemented? Thank you in advance for your answer.

Hi,

I am moving your topic to the Isaac Sim category for better visibility.

Raffaello

Hi @milan.francois.t.amighi - This document will be helpful to you: Force Sensor — Omniverse IsaacSim latest documentation

Hi, I implemented a force/torque sensing using the ArticulationView to control a Franka Panda (prim_path “/World/Franka”) robot arm.

from omni.isaac.core.articulations import ArticulationView
frankaArticulationView=ArticulationView(prim_paths_expr="/World/Franka", enable_dof_force_sensors=True)
frankaArticulationView.initialize()

# reading the force/torque sensor values at the panda_hand_joint:
frankaArticulationView.get_measured_joint_forces()[0][9]

It seems that the functionality is satisfactory when there are no objects grasped. However, when there are objects grasped within the gripper, the forces are not propagating through the kinematic chain as expected. Anything, I need to consider with objects grasped? Or should this be the way to go?

Thank you in advance for your answer!

@milan.francois.t.amighi
yes the current Isaac sim contact sensors provide normal forces. There are more information you can get from get_contact_force_data API, such as the contact point, normal vector to the surface and so on. Do you mean normal and tangential forces by “force values in 3 directions”? We will release new APIs in the next release that will allow you to get tangential forces as well if that is what you need

@mabraun
do you mind elaborating the problem you are seeing? Do you mean other joints (e.g. if you use a different index rather than [9]) do not sense any forces when they should?
Having a simple example we can use to reproduce the problem would be useful

@mrakhsha I figured out, that it has something to do with my physicsScene setup. Initially, I created a USD physicsScene with

scene = UsdPhysics.Scene.Define(stage, Sdf.Path("/World/physicsScene"))

To additionally add parts to the stage I created a World object afterwards

world = World()

This statement implicitly created a second physicsScene with prim path /physicsScene. In this configuration I got the strange force measurements effecting the joints as soon as parts are gripped. I tried to initialize the World object with reference to the USD physics scene “/World/physicsScene” to avoid creation of a second physicsScene, but this results in an error message:

  File "/home/isaac/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.core/omni/isaac/core/world/world.py", line 89, in __init__
    SimulationContext.__init__(
  File "/home/isaac/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.core/omni/isaac/core/simulation_context/simulation_context.py", line 135, in __init__
    self._init_stage(
  File "/home/isaac/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.core/omni/isaac/core/simulation_context/simulation_context.py", line 818, in _init_stage
    self._physics_context = PhysicsContext(
  File "/home/isaac/.local/share/ov/pkg/isaac_sim-2023.1.0-hotfix.1/exts/omni.isaac.core/omni/isaac/core/physics_context/physics_context.py", line 68, in __init__
    raise Exception(f"A non physics scene prim already exists at: {self._prim_path}")
Exception: A non physics scene prim already exists at: /physicsScene

Is there a conceptional difference between the UsdPhysics Scene I created first and the scene that is created by initializing the World object?

Update: I continued experimenting with the PhysicsContext. When I enable GPU Dynamics, the forces that are measured in the joints are different compared to the computations using the CPU. I have a scene containing a still standing Franka robot that grasps a DynamicCube located in the gripper. For both prims disable_gravity is set to True. Once the cube is grasped by using franka.gripper.close() the following forces are measured with CPU dynamics:[[[ 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00 0.0000000e+00] [ 4.7343996e-04 -9.9611025e-05 1.0627788e-04 -2.1982144e-04 4.2869859e-05 1.3228333e-04] [-9.9611323e-05 -4.8512200e-04 -8.2436600e-06 4.2874392e-05 1.8248167e-04 1.8033724e-04] [ 4.8513335e-04 -9.7915996e-05 2.0214455e-05 -1.8248870e-04 9.8393495e-05 1.9185914e-04] [-1.0721778e-05 -5.1744742e-04 -2.4925597e-05 -1.3841297e-04 1.1605226e-04 -2.3866918e-04] [-6.0844078e-04 2.7905638e-05 -1.7324777e-04 1.2018562e-04 8.9669447e-05 -2.7176997e-04] [ 2.3069064e-04 6.3994393e-04 4.2213680e-04 -8.9664907e-05 -2.4314695e-04 1.7081953e-04] [-7.1871339e-04 5.2137941e-04 -4.1850610e-05 2.1422804e-04 5.4827920e-05 2.2261252e-04] [ 8.4623712e-04 3.6440778e-04 -1.7343980e-04 -2.1423068e-04 7.3380725e-05 -1.8362964e-04] [-3.5142162e-04 1.1933559e-04 -8.7712740e-04 -1.8337797e-04 -7.6476463e-05 2.2278508e-04] [-4.0491638e+00 -3.4418242e+00 2.8566952e+00 1.5664504e-01 -1.5270185e-01 2.9934850e-02] [-4.0492010e+00 -3.4420142e+00 -2.8577428e+00 1.5671042e-01 -2.0849639e-01 3.7281480e-02]]]
and these are the measured joint forces with GPU dynamics enabled:
[[[ 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00 0.00000000e+00] [-2.73343593e-01 -8.96248639e-01 1.81329101e-01 -3.17444295e-01 1.17635556e-01 1.68359607e-01] [-8.96248698e-01 2.22711027e-01 2.40825072e-01 1.17635556e-01 2.68628001e-01 2.38652170e-01] [-2.22711220e-01 -8.55519533e-01 3.59643191e-01 -2.68682539e-01 2.62443841e-01 4.90921766e-01] [ 8.34132135e-01 8.98900628e-02 -4.38559055e-01 -2.44085431e-01 3.62238251e-02 -5.28819978e-01] [ 7.33981282e-02 -9.34200168e-01 -1.95664555e-01 -3.26356143e-02 -4.63437429e-03 -2.16895446e-01] [ 9.70859706e-01 -3.16005610e-02 1.67809818e-02 4.63486277e-03 -8.81323069e-02 2.00852036e-01] [-1.94595493e-02 6.17306530e-01 -7.67625451e-01 1.47571065e-03 1.55053511e-01 1.27400473e-01] [ 3.82509199e-03 6.67392492e-01 6.87785625e-01 3.18763487e-04 3.95125188e-02 -3.92188132e-02] [ 1.21875303e-02 9.57961738e-01 -3.30822007e-03 -5.58450818e-02 -1.61981625e-05 -1.12553018e-04] [ 9.96295363e-04 -6.88329223e-04 -1.10884648e-04 2.12367179e-10 -1.88676200e-10 -6.88249041e-11] [ 8.77040729e-04 6.17836951e-04 -1.95645567e-04 -2.12367152e-10 1.88676186e-10 -6.88249041e-11]]]

Everything else is the same. As you can see, there are nearly no forces applied by the gripper when using GPU dynamics (10e-4).