How to enable DOF force sensors?

The documentation says the DOF force sensors must be enabled to get joint forces:

If the enable_dof_force_sensors flag was not set to True in the asset options, the returned values will be 0.

Indeed I get only zero values for the forces, but I do not see this as a flag on AssetOptions to enable it. It has only these:

['angular_damping', 'armature', 'collapse_fixed_joints', 'default_dof_drive_mode', 'density', 'disable_gravity','fix_base_link', 'flip_visual_attachments', 'linear_damping', 'max_angular_velocity','max_linear_velocity', 'min_particle_mass', 'replace_cylinder_with_capsule','slices_per_cylinder', 'tendon_limit_stiffness', 'thickness', 'use_obj', 'use_physx_armature']

How do I go about reading out force data from the joint sensors?

It looks like we have some documentation issues to fix here.

Instead of setting an AssetOption flag, you should be calling the enable_actor_dof_force_sensors function.

See the python/rlgpu/tasks/humanoid.py file for an example of DOF sensor usage - look for use_dof_force_sensors in that file.

That shows the use of the tensor APIs for this: acquire_dof_force_tensor / refresh_dof_force_tensor

The non-tensor API should also work, though we don’t have an example of that.

Take care,
-Gav

2 Likes

Thanks that resolved it. The main thing I was missing before was the call to refresh_dof_force_tensor.

Hi guys,

It seems like force sensors are not available in Flex. Will there be any support for this in the future? Says if you want to grasp a soft object with a gripper, how can you integrate a force sensor in the gripper? Thanks!

Our plans are to properly expose soft body support through PhysX in future incarnations of the Gym APIs that run with Omniverse.

There is some soft body contact force information available in Flex through an APIs that we are not planning to document right now, but we hope to be able to share example code for it at some point in the future. Note however that this API will be quite different from what we make available in the future with PhysX and Omniverse for soft body contacts.

Take care,
-Gav