Domain randomization in OmniisaacgymEnv

Hello,

I’m currently working on implementing Domain Randomization within the OmniIsaacgymenvs environment.

While following the instructions from the link below, I called step_randomization within the pre_physics_step function, but I encountered an error message.

Error executing job with overrides: [‘task=Ropen’]
Traceback (most recent call last):
File “scripts/rlgames_train.py”, line 135, in parse_hydra_configs
rlg_trainer.run()
File “scripts/rlgames_train.py”, line 83, in run
‘sigma’: None
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/python/lib/python3.7/site-packages/rl_games/torch_runner.py”, line 121, in run
self.run_train(args)
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/python/lib/python3.7/site-packages/rl_games/torch_runner.py”, line 102, in run_train
agent.train()
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/python/lib/python3.7/site-packages/rl_games/common/a2c_common.py”, line 1215, in train
self.obs = self.env_reset()
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/python/lib/python3.7/site-packages/rl_games/common/a2c_common.py”, line 507, in env_reset
obs = self.vec_env.reset()
File “/home/kjh/OmniIsaacGymEnvs/omniisaacgymenvs/utils/rlgames/rlgames_utils.py”, line 102, in reset
return self.env.reset()
File “/home/kjh/OmniIsaacGymEnvs/omniisaacgymenvs/envs/vec_env_rlgames.py”, line 88, in reset
obs_dict, _, _, _ = self.step(actions)
File “/home/kjh/OmniIsaacGymEnvs/omniisaacgymenvs/envs/vec_env_rlgames.py”, line 62, in step
self._task.pre_physics_step(actions)
File “/home/kjh/OmniIsaacGymEnvs/omniisaacgymenvs/tasks/Ropen.py”, line 130, in pre_physics_step
ps.step_randomization(reset_inds)
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.replicator.isaac/omni/replicator/isaac/scripts/physics_view.py”, line 195, in step_randomization
trigger_randomization(np.asarray(reset_inds))
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/exts/omni.replicator.isaac/omni/replicator/isaac/scripts/context.py”, line 45, in trigger_randomization
_context.trigger_randomization(reset_inds)
AttributeError: ‘NoneType’ object has no attribute ‘trigger_randomization’

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
Exception ignored in: <function _make_registry.._Registry.del at 0x7f0c0f995560>
Traceback (most recent call last):
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/extscore/omni.kit.viewport.registry/omni/kit/viewport/registry/registry.py”, line 103, in del
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/extscore/omni.kit.viewport.registry/omni/kit/viewport/registry/registry.py”, line 98, in destroy
TypeError: ‘NoneType’ object is not callable
Exception ignored in: <function _make_registry.._Registry.del at 0x7f0c0f995560>
Traceback (most recent call last):
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/extscore/omni.kit.viewport.registry/omni/kit/viewport/registry/registry.py”, line 103, in del
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/extscore/omni.kit.viewport.registry/omni/kit/viewport/registry/registry.py”, line 98, in destroy
TypeError: ‘NoneType’ object is not callable
Exception ignored in: <function SettingChangeSubscription.del at 0x7f0ccf49a0e0>
Traceback (most recent call last):
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/kit/kernel/py/omni/kit/app/_impl/init.py”, line 114, in del
AttributeError: ‘NoneType’ object has no attribute ‘get_settings’
Exception ignored in: <function RegisteredActions.del at 0x7f0b2fd39440>
Traceback (most recent call last):
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/extscache/omni.kit.viewport.menubar.lighting-104.0.9/omni/kit/viewport/menubar/lighting/actions.py”, line 347, in del
File “/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/extscache/omni.kit.viewport.menubar.lighting-104.0.9/omni/kit/viewport/menubar/lighting/actions.py”, line 352, in destroy
TypeError: ‘NoneType’ object is not callable
2023-09-06 05:37:06 [8,841ms] [Warning] [carb.audio.context] 1 contexts were leaked
/home/kjh/.local/share/ov/pkg/isaac_sim-2022.2.1/python.sh: line 41: 852072 Segmentation fault (core dumped) $python_exe “$@” $args
There was an error running python

As a workaround, I utilized the set_body_masses function from omni.isaac.core to initialize the mass of each link within a random range during the pre_physics_step. I’ve verified that this method works in the simulation.

My main concern is that the approach I used differs from the official tutorial, as I added the parts I wanted to randomize directly within the code. I’m curious to know if there’s any performance difference between my method and the official tutorial’s approach.

Thank you.

Hi there, there shouldn’t be any performance impact with the approach you are using. The domain randomization framework provided is meant to make it easier for use cases where resets are desired on resets or at specific intervals.