RTX LiDAR - Loading via extension

Hi! I am trying to write an extension to load an RTX Lidar onto the stage, which consecutively creates an actiongraph with a PostProcessing SDGpipeline. I follow the documentation here.

First, I followed the documentation and executed the code in the Script Editor, when it worked perfectly. I was able to visualize the PointCloud on the viewport. The code on the Script editor is:
se_script_crop

whereas if I enter the same code in the extension script as follows:

sensorPath = "/sensor"
self.lidar_config="Example_Rotary"
_, self._sensor = omni.kit.commands.execute(
    "IsaacSensorCreateRtxLidar",
    path=sensorPath,
    parent=None,
    config=self.lidar_config,
    translation=(-40, 0, 10),
    orientation=Gf.Quatd(0.5, 0.5, -0.5, -0.5),
)
# _, render_product_path = create_hydra_texture([1, 1], self._sensor.GetPath().pathString)

# Code snippet copied from render_product.py
stage = get_current_stage()
with Usd.EditContext(stage, stage.GetSessionLayer()):
    resolution: Tuple[int] = [1, 1]
    factory = omni.hydratexture.acquire_hydra_texture_factory_interface()
    render_product_path = omni.usd.get_stage_next_free_path(stage, "/Render/RenderProduct_Isaac", False)
    name = render_product_path.split("/Render/RenderProduct_")[-1]
    texture = factory.create_hydra_texture(name, resolution[0], resolution[1], "", self._sensor.GetPath().pathString, "rtx")

writer = rep.writers.get("RtxLidar" + "DebugDrawPointCloud")
writer.attach([render_product_path])

A sensor prim is created and so is a completely identical omnigraph, but then I wasn’t able to visualize the point cloud on the viewport nor was I able to publish the pointcloud using ROS.

After a bit of digging, I found out that the the first OGN in the action graph - SdOnNewFrame receives a list of 2 renderProductDataPtrs and 2 renderProductPaths when I execute the code in script editor and one one when in extension. I have attached the screenshots below.

When in Script Editor:
se_sgonnewframe_crop

When via extension:
ext_ogn_crop

I tried to create an Actiongraph as given here inside the extension script and the RTX Lidar seems to work fine.

Still, I am a bit curious to know why wouldn’t the script in the other documentation work! It would be really greatful if someone can elaborate on why writer.attach([render_product_path]) is not actually appending the path! (which I understood as the source to the problem)

Not sure what is going on, but I did notice that in the firs script, render_product_path comes from create_hydra_texture

And in the second factor.create_hydra_texture is assigned to texture, not render_product_path.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.