What's the efficient way to add domain randomization in environments with multiple rigid bodies?

@gstate @kellyg
I want to create RL environments with multiple rigid bodies and add domain randomization to every rigid body and the agent (robot) in each environment in Isaac Sim.

Because dr in Isaac Sim has to be applied to Views with the same number of prims (usually num_envs), in order to add dr to the robot, I have to create one RigidPrimView for every rigid body in one env to make sure that every RigidPrimView (for rigid bodies) and ArticulationView (for the robot) all have num_envs prims. I suppose this is somehow inefficient when I need to obtain rigid body states (like pose or velocity), as I need to run some for loop to iterate through every RigidPrimView and call functions like get_world_poses for num_rigid_bodies_per_env times, which is not parallelly optimized in GPU.

However, if I do not add domain randomization or only add dr to rigid bodies, there is a more efficient way to manage multiple rigid bodies, which is creating a single ‘‘large’’ RigidPrimView containing all rigid body prims. In this way, I only need to call functions like get_world_poses once and can avoid the for loop. But the disadvantage is that to apply dr to this “large” View, we must set num_envs parameter of dr to be num_envs*num_rigid_bodies_per_env. If we do so, we cannot add dr to other prims like robots which have only one prim in every environment (which is different from num_rigid_bodies_per_env).

Can I still do something similar to create a “large” View when domain randomization is applied to Views of different numbers of prims? Or do you have any suggestions for efficiently managing multiple rigid body states and applying dr simultaneously?

Hi @user58271 - Thank you for the question. We will respond to you as soon as we can.

Look forward to it!

Hi @user58271 - Apologies for the delay in response. Please let us know if you are still having any issues or questions after using the latest Isaac Sim release.

Btw, this doc will be helpful: 9.4. Domain Randomization for RL — Omniverse IsaacSim latest documentation