'gym.get_env_rigid_contacts' returns empty list in RL

I tend to write my own hammering environment and try to use contact to help training. But when I call this ‘get_env_rigid_contacts’ API, I got an empty list. I tested this API and found in every RL case it would return an empty list. But when I call this function in the example code such as franka_cube_ik.py or 1080_balls_of_solitude.py. it returned the desired list. I check the sim_params and they are all set equally. Does anybody have the same issue calling contact in RL? Could anyone tell me why I cannot get a proper list of RL tasks? Thanks!

Hi @lichothu,

Try using the acquire_net_contact_force_tensor and refresh_net_contact_force_tensor APIs. These are documented in programming/tensors.html.

You’re probably using the GPU pipeline in your RL training by default, so the contact information isn’t getting copied back to the CPU (and thus made visible to our older non-tensor contact API).

Take care,

Thanks! This is really helpful.