Replicator example fails

I am trying to run this sample from the replicator tutorials in Code, using the script editor:
import omni.replicator.core as rep

async def test_rgb():
cone = rep.create.cone()

cam = rep.create.camera(position=(500,500,500), look_at=cone)
rp = rep.create.render_product(cam, (1024, 512))

rgb = rep.AnnotatorRegistry.get_annotator("rgb")
rgb.attach(rp)

await rep.orchestrator.step_async()
data = rgb.get_data()
print(data.shape, data.dtype)   # ((512, 1024, 4), uint8)

import asyncio
asyncio.ensure_future(test_rgb())

I get the following errors in the output:
2022-09-20 08:35:14 [6,150,354ms] [Error] [asyncio] [c:\users\brunovetter\appdata\local\ov\pkg\code-2022.1.3\kit\python\lib\asyncio\base_events.py:1619] Task exception was never retrieved
future: <Task finished coro=<test_rgb() done, defined at executing: Python 0…:3> exception=AttributeError(“module ‘omni.replicator.core.scripts.orchestrator’ has no attribute ‘step_async’”)>
Traceback (most recent call last):
File “executing: Python 0…”, line 12, in test_rgb
AttributeError: module ‘omni.replicator.core.scripts.orchestrator’ has no attribute ‘step_async’

Thanks for any help
Bruno

Also, get_data does not exist, it is actually commented out in the source.

Edit: I Might be wrong.

Hi Bruno,
It seems that you are using the 2022.1.3 version, can you try with 2022.2 that just came out? The documentation was actually updated today and I believe this example is compatible only with the new version.

Thanks Teresa,
updating to Code 2022.2.0 helped!

1 Like