IsaacLab icon indicating copy to clipboard operation
IsaacLab copied to clipboard

[Question] Domain Randomziation

Open Entongsu opened this issue 8 months ago • 1 comments

Hi,

I'm working on reinforcement learning training in Isaac Sim and would appreciate your help with two questions:

Object Scaling: I’d like to perform domain randomization on the scale of objects, but I haven’t found the relevant functions or documentation for this. Could you point me in the right direction?

Object Randomization Across Environments: I’d also like to randomize the objects used in training. From what I’ve seen, Isaac Sim requires each environment instance to load the same number of objects. Is it possible to configure different environments to each load a single but different object, rather than all loading the same set?

Thanks in advance for your help!

Entongsu avatar Apr 24 '25 23:04 Entongsu

Thanks for posting this. Have you reviewed this tutorial on domain randomization? This would be a place to start. Thank you for your interest in Isaac Lab.

RandomOakForest avatar Apr 25 '25 23:04 RandomOakForest

Regarding the first question, I am using functions like randomize_visual_color, randomize_rigid_body_mass, randomize_rigid_body_scale randomize_rigid_body_material randomize_rigid_body_material randomize_visual_texture_material

But I was interested in the second question as well. Which is the best way to randomize the shape of the object itself? For example, from cubes to cylinders? Is it possible?

torydebra avatar May 05 '25 12:05 torydebra

Thanks for following up. I will move this post to our Discussions section for follow up. In the meantime, here is a summary of what to consider.

To randomize object shapes (e.g., switching between cubes and cylinders), use USD asset swapping combined with environment-specific spawning:

Shape Randomization Implementation

1. Multi-Shape Asset Configuration

from isaaclab.assets import AssetBaseCfg

SHAPE_USD_PATHS = [
    "/Isaac/Props/Shapes/Cube.usd",
    "/Isaac/Props/Shapes/Cylinder.usd",
    "/Isaac/Props/Shapes/Sphere.usd"
]

object_cfg = AssetBaseCfg(
    prim_path="/World/Env_.*/Object",
    spawn=usd_utils.spawn_rigid_objects(
        prim_paths=[f"/World/Env_{i}/Object" for i in num_envs],
        usd_paths=np.random.choice(SHAPE_USD_PATHS, num_envs)
    )
)

2. Per-Environment Variation Each environment instance receives a randomly selected shape while maintaining:

  • Physics collision properties through unified API access
  • Consistent material/texture randomization pipelines
  • Positional constraints across different geometries

Key Requirements

  1. Pre-built USD assets for each shape variant
  2. Matching collision meshes across different geometries
  3. Consistent prim hierarchy for transform operations

Implementation Considerations

  • Use GridCloner for efficient multi-environment spawning ^4
  • Combine with scale randomization through actor_params.scale.range ^3
  • For procedural generation, implement mesh deformation using Omniverse Mesh API as shown in the vertex modification approach ^1

An example workflow from the NVIDIA forums shows successful shape randomization by:

  1. Generating multiple USD files with different geometries
  2. Randomly selecting them during environment initialization
  3. Using rigid body aggregation for physics handling ^1

This approach enables true geometric diversity while maintaining Isaac Lab's optimized physics pipeline.

References

RandomOakForest avatar Jun 04 '25 21:06 RandomOakForest