Fetching RTX Lidar pointcloud 2023.1.1

Hey looking at the changes mentioned in a previous post for 2023.1.1

I see that…

> 
> import omni.kit.commands
> from pxr import Gf
> import omni.replicator.core as rep
> lidar_config = "Example_Rotary"
> 
> # Create The Camera
> _, sensor = omni.kit.commands.execute(
>     "IsaacSensorCreateRtxLidar",
>     path="/sensor",
>     parent=None,
>     config=lidar_config,
>     translation=(0, 0, 1.0),
>     orientation=Gf.Quatd(1,0,0,0),
> )
> # Create and Attach a render product to the camera
> render_product = rep.create.render_product(sensor.GetPath(), [1, 1])
> 
> 
> # Create Annotator to read the data from with annotator.get_data()
> annotator = rep.AnnotatorRegistry.get_annotator("RtxSensorCpuIsaacCreateRTXLidarScanBuffer")
> annotator.attach(render_product)
> 
> # This is the new part, it actually gets the data from the annotator and prints the point cloud data.
> # When the data changes, you have to fetch it again, i.e. every frame if you want it.
> 
> data = annotator.get_data()
> print(data["data"])

In another action graph I can fetch the dataPtr via

import omni.graph.core as og
point_cloud = og.Controller().node("/Render/PostProcess/SDGPipeline/RenderProduct_Isaac_RtxSensorCpuIsaacCreateRTXLidarScanBuffer").get_attribute("outputs:dataPtr").get()

print(point_cloud)


How can I fetch the point cloud array in another action graph? I’m using on tick to fire that graph so it gets the data every tick I will change it to be frame at a later date, I’m just testing atm

Cheers

Got this running via action graph by using two action graphs and a global, i’ll change that later…

from pxr import Gf
from omni.isaac.core.utils.render_product import create_hydra_texture
import omni.replicator.core as rep
lidar_config = "ZVISION_ML30S"


global annotator


# 1. Create The Camera
_, sensor = omni.kit.commands.execute(
    "IsaacSensorCreateRtxLidar",
    path="/sensor",
    parent=None,
    config=lidar_config,
    translation=(0, 0, 1.0),
    orientation=Gf.Quatd(1,0,0,0),
)
# 2. Create and Attach a render product to the camera
hydra_texture = rep.create.render_product(sensor.GetPath(), [1, 1], name="Isaac")


# Create the debug draw pipeline in the post process graph
writer = rep.writers.get("RtxLidar" + "DebugDrawPointCloud" + "Buffer")
writer.attach([hydra_texture])



# 4. Create Annotator to read the data from with annotator.get_data()
annotator = rep.AnnotatorRegistry.get_annotator("RtxSensorCpuIsaacComputeRTXLidarPointCloud")
annotator.attach([hydra_texture])```

Then used a on on frame tick to fire the second script node

```data = annotator.get_data()
print(data["data"])```


I'll look at either changing the global command with a path or change the global to something more personalised its really about just getting the data flowing for SDG at the moment!

Hopefully this helps someone!

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