Rigid body states of ShadowHand's fingers

Hi, I’m trying to draw a line between the thumb distal and the index distal. I’m using the following code to get the rigid body positions of the finger joints and use them as the start and end vertices of the line:

rigid_body_states = gym.get_actor_rigid_body_states(env, shadow_handle, gymapi.STATE_POS)
rigid_body_names = gym.get_actor_rigid_body_names(envs, shadow_handles)

idx_thumb = rigid_body_names.index(‘thdistal’)
idx_index = rigid_body_names.index(‘ffdistal’)

line_p = [
rgd_bd_state[‘pose’][‘p’][idx_thumb][0],
rgd_bd_state[‘pose’][‘p’][idx_thumb][1],
rgd_bd_state[‘pose’][‘p’][idx_thumb][2],
rgd_bd_state[‘pose’][‘p’][idx_index][0],
rgd_bd_state[‘pose’][‘p’][idx_index][1],
rgd_bd_state[‘pose’][‘p’][idx_index][2]
]

gym.add_lines(viewer, env, 2, line_p, [1, 0, 0])

But the line seems to not be starting and ending on the actual distal joints:

Is this behavior correct? Is there any way to get the position of the red “parts” of the hand?

Have you put asset_options.collapse_fixed_joints = True before spawning the asset in your environment?

I had problems with this option for a different robot when I wanted to retrieve the position of the end-effector link rather than end-effector joint:

If turning the option off does not help, you could create two fake links in assets/mjcf/open_ai_assets/hand/robot.xml and use the name of these fake links instead of 'thdistal' and 'ffdistal'.

1 Like

Hi that fixed the issue. With the collapse_fixed_joints=False I was able to access the positions of the finger tips. Thank you.