Hi there,
I’m trying to combine multiple distributions using rep.distribution.choice as is described in the documentation here. Unfortunately, running the example code from the documentation results in an error.
Sample code:
import omni.replicator.core as rep
# Add Default Light
distance_light = rep.create.light(rotation=(315,0,0), intensity=3000, light_type="distant")
with rep.trigger.on_frame():
with rep.create.cube():
rep.modify.pose(
position=rep.distribution.choice([
rep.distribution.uniform((0., 0., 0.), (10., 10., 10.)),
rep.distribution.normal((100., 100., 100.), (50., 50., 50.))
])
)
Error message:
2024-04-15 13:24:51 [25,474ms] [Error] [asyncio] Task exception was never retrieved
future: <Task finished name='Task-10' coro=<Extension.run_script_async() done, defined at /home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/extension.py:173> exception=ValueError("Base type <class 'omni.replicator.core.scripts.utils.utils.ReplicatorItem'> is not supported. Only elements of type str, bool, int and float are supported.")>
Traceback (most recent call last):
File "/home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/extension.py", line 194, in run_script_async
spec.loader.exec_module(module)
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/nikita/illuminex/temp_test_stack_distributions.py", line 9, in <module>
position=rep.distribution.choice([
File "/home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/utils/utils.py", line 606, in __call__
return ReplicatorItem(self.__fn, *args, **kwargs)
File "/home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/utils/utils.py", line 635, in __init__
self.node = self.__fn(*args, **kwargs)
File "/home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/distribution.py", line 253, in choice
data_type = _get_data_type(choices)
File "/home/nikita/.local/share/ov/pkg/deps/8021e278fce7781f5bb307a5b4b24ed4/extscache/omni.replicator.core-1.9.8+105.0.lx64.r.cp310/omni/replicator/core/scripts/distribution.py", line 53, in _get_data_type
raise ValueError(
ValueError: Base type <class 'omni.replicator.core.scripts.utils.utils.ReplicatorItem'> is not supported. Only elements of type str, bool, int and float are supported.
I noticed in this forum post it was stated that randomizing distributions is not supported. I assumed that this post must be stale as the documentation states that this feature is supported.
Is it possible to use Omniverse Replicator to combine multiple distributions? If so, how can I do this? If not, when can I expect this feature to be added?
Thanks for the help!