Accessing "data" from RtxSensorCpuIsaacCreateRTXLidarScanBuffer via script nodes

Hello,

I’m working on some code to extract the “data” attribute of “RtxSensorCpuIsaacCreateRTXLidarScanBuffer”

I’m using action graph to run a on load script to boot the lidar head as previously mentioned in another thread. this works perfectly

Blockquoteimport omni.kit.commands
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”
import math

1. Create The Camera

_, sensor = omni.kit.commands.execute(
“IsaacSensorCreateRtxLidar”,
path=“/sensor”,
parent=None,
config=lidar_config,
translation=(0, 0, 0),
orientation=Gf.Quatd(1,0,0,0),
)

2. Create and Attach a render product to the camera

render_product_path = rep.create.render_product(sensor.GetPath(), [1, 1], name=“Isaac”)

3. Create a Replicator Writer that “writes” points into the scene for debug viewing

writer = rep.writers.get(“RtxLidarDebugDrawPointCloudBuffer”)
writer.attach([render_product_path])

4. Create Annotator to read the data from with annotator.get_data()

annotator = rep.AnnotatorRegistry.get_annotator(“RtxSensorCpuIsaacCreateRTXLidarScanBuffer”)
annotator.attach([render_product_path])

print (annotator)

point_cloud_data = annotator.get_data().get(‘data’, None)

Check if data is available

if point_cloud_data is not None:
print(“Point cloud data exists.”)
# Optionally, you can print the length or shape of the data
print(“Number of points in point cloud:”, len(point_cloud_data))
else:
print(“No point cloud data available.”)

The return for this is

Point cloud data exists
Number of points in point cloud: 0

I’m unsure if this is because it is its onload and the data hasn’t had time to be generated which I suspect.

I would like to use a secondary node which run on tick as show here

I’ve tried the following code in the second script

Blockquoteimport omni.graph.core as og
import numpy as np

Access the specific OmniGraph node

node_path = “/Render/PostProcess/SDGPipeline/RenderProduct_Isaac_RtxSensorCpuIsaacCreateRTXLidarScanBuffer”
node = og.Controller().node(node_path)

Verify if the node is valid

if node is not None:
# Try to retrieve the data from the node
try:
point_cloud_data = node.get_attribute(“outputs:pointCloudData”).get()

    # Check if point_cloud_data exists
    if point_cloud_data is not None:
        print("Point cloud data exists.")
        # Convert to NumPy array to determine size and shape
        point_cloud_np = np.array(point_cloud_data)
        print("Number of points in point cloud:", len(point_cloud_np))
        print("Shape of point cloud data:", point_cloud_np.shape)
    else:
        print("No point cloud data available in the specified node.")
except Exception as e:
    print(f"Error accessing point cloud data in node {node_path}: {e}")

else:
print(f"Node {node_path} not found.")

print(point_cloud)

but sadly i get no data

Error accessing point cloud data in node /Render/PostProcess/SDGPipeline/RenderProduct_Isaac_RtxSensorCpuIsaacCreateRTXLidarScanBuffer: Invalid AttributeObj object in Py_Attribute in get

Really quite stuck here,

thanks