Adds support to spawn different assets in environments and spawn randomizations
Description
This PR introduces the option to spawn multiple assets in the same environment (e.g. env_0 has a sphere and env_1 a cube). Originally developed by @renezurbruegg
It additionally introduces Spawn Randomizations which are applied when an asset is spawned. This allows to Randomize properties such as joint offsets and scales, which is otherwise not possible with only reset randomization.
Run
./isaaclab -p source/standalone/demos/multi_object.py
or
./isaaclab -p source/standalone/demos/multi_object.py --randomize
to see an example (Screenshot)
Example Configuration:
# Simple environment with a rigid object that can be a sphere or cube in different environments:
@configclass
class MultiObjectSceneCfg(InteractiveSceneCfg):
"""Configuration for a multi-object scene."""
# ground plane
ground = AssetBaseCfg(prim_path="/World/defaultGroundPlane", spawn=sim_utils.GroundPlaneCfg())
object: RigidObjectCfg = RigidObjectCfg(
prim_path="/World/envs/env_.*/Objects",
spawn=MultiAssetCfg(assets_cfg=[
sim_utils.SphereCfg(
radius=0.25,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 0.0, 1.0)),
rigid_props=sim_utils.RigidBodyPropertiesCfg(),
),
sim_utils.CuboidCfg(
size=(0.25, 0.25, 0.25),
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 1.0, 0.0)),
rigid_props=sim_utils.RigidBodyPropertiesCfg(),
),
]),
)
Example Config to also Randomize Scales:
# Simple environment with a rigid object that can be a sphere or cube in different environments:
@configclass
class MultiObjectSceneCfg(InteractiveSceneCfg):
"""Configuration for a multi-object scene."""
# ground plane
ground = AssetBaseCfg(
prim_path="/World/defaultGroundPlane", spawn=sim_utils.GroundPlaneCfg()
)
object: RigidObjectCfg = RigidObjectCfg(
prim_path="/World/envs/env_.*/Objects",
spawn=MultiAssetCfg(
assets_cfg=[
AssetRandomizerCfg(
child_spawner_cfg=sim_utils.SphereCfg(...),
randomization_cfg=RandomizeScaleCfg(
x_range=(0.5, 1.25),
equal_scale=True,
),
num_random_assets=100,
),
AssetRandomizerCfg(
child_spawner_cfg=sim_utils.CuboidCfg(...),
randomization_cfg=RandomizeScaleCfg(
x_range=(0.5, 1.25),
equal_scale=True,
),
num_random_assets=100,
),
]
),
)
Type of change
- New feature (non-breaking change which adds functionality)
Screenshots
Example for different Assets
./isaaclab -p source/standalone/demos/multi_object.py
Example for different Assets with scale randomizations
./isaaclab -p source/standalone/demos/multi_object.py --randomize
./isaaclab -p source/standalone/demos/multi_object.py
Please attach before and after screenshots of the change if applicable.
Checklist
- [x] I have run the
pre-commitchecks with./isaaclab.sh --format - [x] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my feature works
- [ ] I have run all the tests with
./isaaclab.sh --testand they pass - [ ] I have updated the changelog and the corresponding version in the extension's
config/extension.tomlfile - [ ] I have added my name to the
CONTRIBUTORS.mdor my name already exists there
@Mayankm96 @Dhoeller19 @jsmith-bdai ping again about that PR and the discussion above
@pascal-roth We'll look at this for the next release. Our hands are packed with more pressing tasks for the current release. Thanks for the effort on this!
Okay so I went over this MR and it seems to be mixing two different notions IMO:
- Spawning different assets at different prim paths
- Randomizing the asset properties
I think these two can be separated out as two concepts since randomizing asset properties is independent of how you spawn it.
After doing some more testing on my side, we can simplify Step 1 more. I made an MR #1164 in that direction. Would love to hear your thoughts.
For Step 2, I propose that we should make a new mode in the event manager. It will come at some cost over repeated for loops, but the code simplification is worth it, in my opinion.
@Mayankm96 thanks for the feedback, will adjust it accordingly
Closing this MR in favor of #1164 and #1165