# Adding contact sensors to shadow hand's fingertips - OmniIsaacGymEnvs

**URL:** <https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335>\
**Category:** Isaac Gym\
**Created:** [March 31, 2023, 2:01pm UTC](https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335 "2023-03-31T14:01:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![adebor](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/adebor/32/239497_2.png) [@adebor](https://forums.developer.nvidia.com/u/adebor)\
**Post date:** [March 31, 2023, 2:01pm UTC](https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335/1 "2023-03-31T14:01:24Z")

</div>

Hi there,

I’m currently modifying the ShadowHand example provided in [OmniIsaacGymEnvs](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/) in order to control the hand using efforts rather than position control, and I’d like to train RL models to achieve this using **contact/force/tactile observations** rather than “visual” ones (fingertip positions, angles, velocities, etc.) as done in the OpenAI examples for instance.

### Wanted

In order to simulate the pressure/tactile sensors of the real Shadow Hand, I want to attach a contact sensor (as defined [here](https://docs.omniverse.nvidia.com/py/isaacsim/source/extensions/omni.isaac.sensor/docs/index.html#module-omni.isaac.sensor.scripts.contact_sensor)) to all 5 fingertips of all my hands (_i.e._ of all cloned envs), in order to get fingertip contact data at each step of my RL loop when manipulating an object.

### Tried

In the `set_up_scene` method of my task class, I tried to create such sensors using the `IsaacSensorCreateContactSensor` command with `self.default_zero_env_path + "/shadow_hand/robot0_xxdistal"` as the prim path (xx being replaced by ff, mf, etc., _i.e._ the five fingers), and I then used the `ContactSensorInterface` in `get_observations` to get data from these sensors. I observed nothing but zero measurements (_i.e._ no contact and thus no force), so I tried to visualize my sensors in the simulator by setting the `visualize` flag to True when using the creation command, and I set the `color` parameter to some kind of red. Turns out the sensors are located way above the hands (in the screenshot below, see the red dots outlining the spherical sensors), and do not move although the fingers do, which is not wanted.

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/4/5/455cab41fd627c5a8bc0cc608b12719d96522f88.jpeg)

When setting `use_flatcache` to False in the config file of the task (similar to [here](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/blob/220d34c6b68d3f7518c4aa008ae009d13cc60c03/omniisaacgymenvs/cfg/task/ShadowHand.yaml#L56)), the hands appear standing vertically, and do not move anymore. However, the sensors’ location matches in this case the position of the fingertips’ distal joint of these vertically standing hands, as (not easily) visible in the screenshot below.

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/9/f/9f4e54e84b7559a6323fcc605482eb780d8d7139.jpeg)

Could someone help me solving this problem? That is creating contact sensors attached to the fingertips (not to the joints, although this makes no sense to me anyway) and that move with these in simulation, allowing to get contact data from the interaction between these tips and the manipulated object.

Thank you very much for your help.

PS1: this topic is adapted from [my GitHub issue](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/issues/31#issue-1647940970).  
PS2: I’m fairly new to Isaac Sim and Gym, so I may very well be completely wrong in my approach, don’t hesitate to tell me.

---

<div class="post-metadata">

**Author:** ![adebor](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/adebor/32/239497_2.png) [@adebor](https://forums.developer.nvidia.com/u/adebor)\
**Post date:** [April 4, 2023, 7:51am UTC](https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335/2 "2023-04-04T07:51:48Z")

</div>

It turns out that I did not read [this issue](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/issues/4#issue-1271613409) in its entirety, and did not run the CPU pipeline. Running this pipeline solves the issue, very sorry for that.

However, I thus have to loop over the cloned environments to get data for my sensors in my task. Is there a way to use sensors et get data from them in a vectorized way?

---

<div class="post-metadata">

**Author:** ![adebor](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/adebor/32/239497_2.png) [@adebor](https://forums.developer.nvidia.com/u/adebor)\
**Post date:** [April 5, 2023, 7:58am UTC](https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335/3 "2023-04-05T07:58:45Z")

</div>

See [the answer](https://github.com/NVIDIA-Omniverse/OmniIsaacGymEnvs/issues/31#issuecomment-1496079946) on GitHub.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [April 19, 2023, 7:58am UTC](https://forums.developer.nvidia.com/t/adding-contact-sensors-to-shadow-hands-fingertips-omniisaacgymenvs/248335/4 "2023-04-19T07:58:48Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
