Too many invalid object id from RTXLidar

Hi All.
I’m using isaacsim 4.5 on ubuntu 22.04 and I want to get semantic data from RTX Lidar. Here is my code

from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": False})
import numpy as np
import omni.replicator.core as rep
from isaacsim.core.api import World
from isaacsim.core.api.objects import DynamicCuboid
from isaacsim.sensors.rtx import LidarRtx
import omni.syntheticdata._syntheticdata as _syntheticdata

my_world = World(stage_units_in_meters=1.0)
my_world.scene.add_default_ground_plane()

lidar = my_world.scene.add(LidarRtx(prim_path="/World/Lidar", name="Lidar", position=[2.0, 0.0, 1.5], valid_range = (0.1, 2000.0)))
annotator = rep.AnnotatorRegistry.get_annotator("RtxSensorCpuIsaacCreateRTXLidarScanBuffer", init_params={"outputObjectId": True})
annotator.attach([lidar._render_product_path]) 

cube_1 = my_world.scene.add(DynamicCuboid(prim_path="/World/cube", name="cube_1", position=np.array([2, 2, 2.5]), scale=np.array([20, 0.2, 5])))
cube_2 = my_world.scene.add(DynamicCuboid(prim_path="/World/cube_2", name="cube_2", position=np.array([2, -2, 2.5]), scale=np.array([20, 0.2, 5])))

my_world.reset()
while simulation_app.is_running():
    simulation_app.update()
    data = annotator.get_data()
    objects = data["objectId"]
    #about 200000 unique ids here, too many for this simple scene
    print(len(set(objects)))
    interface = _syntheticdata.acquire_syntheticdata_interface()
    for object in objects:
        path = interface.get_uri_from_instance_segmentation_id(int(object))
my_world.stop()
simulation_app.close()

After running this code I get a lot of warnings:

I’ve also found that there are too many unique ids in objects list and most of them are invalid. So do I miss any step to use RTXLidarScanBuffer or is it a bug of isaacsim 4.5?

Hi @fullike! The objectId contains the id at each hit location. The number of object IDs is related to firing frequency of lidar. Typically firing frequency of a lidar ranges from 10000 to 200000 pulses per second. So in your case, ~200000 unique ids seems reasonable.

I reduced firing frequency to a lower value (for example 10, I also reduced the rotation_frequency to 1), then the number of unique object ID is reduced.

I also printed the path if it is valid.

for object_id in set(objects):
    path = interface.get_uri_from_instance_segmentation_id(int(object_id))
    if path:
        print(f"object id: {object_id}, path {path}")

When running the script, I disabled the warnings with the following command:

./python.sh /home/zhengwang/Desktop/forum_support/invalid_objectid_RTXLidar/test.py --/log/level=error --/log/fileLogLevel=error --/log/outputStreamLevel=error

Then I can see output like this:

len of object id: 148
object id: 2, path /World/cube
object id: 3, path /World/cube_2
object id: 4, path /World/defaultGroundPlane/Environment/Geometry

So I suggest you try again with disabling the warnings.

Hi zhengwang, thanks for your reply

I disabled warning and output pcd file with colors indicating different paths by code below:

import os
import numpy as np
import open3d as o3d
from isaacsim import SimulationApp
simulation_app = SimulationApp({"headless": False}, experience=f'{os.environ["EXP_PATH"]}/isaacsim.exp.full.kit')
from isaacsim.core.api import World
from isaacsim.core.api.objects import DynamicCuboid
from isaacsim.sensors.rtx import LidarRtx
import omni.replicator.core as rep
import omni.syntheticdata._syntheticdata as _syntheticdata

my_world = World(stage_units_in_meters=1.0)
my_world.scene.add_default_ground_plane()

lidar = my_world.scene.add(LidarRtx(prim_path="/World/Lidar", name="Lidar", position=[2.0, 0.0, 1.5], config_file_name="Velodyne_VLS128"))
lidar.initialize()
annotator = rep.AnnotatorRegistry.get_annotator("RtxSensorCpuIsaacCreateRTXLidarScanBuffer", init_params={"outputObjectId": True})
annotator.attach([lidar._render_product]) 

cube_1 = my_world.scene.add(DynamicCuboid(prim_path="/World/cube", name="cube_1", position=np.array([2, 2, 2.5]), scale=np.array([20, 0.2, 5])))
cube_2 = my_world.scene.add(DynamicCuboid(prim_path="/World/cube_2", name="cube_2", position=np.array([2, -2, 2.5]), scale=np.array([20, 0.2, 5])))

i = 0
my_world.reset()
while simulation_app.is_running():
    simulation_app.update()
    if i == 100:
        data = annotator.get_data()
        points = data["data"]
        objects = data["objectId"]
        interface = _syntheticdata.acquire_syntheticdata_interface()          
        color_table = {
            "":(0.2,0.2,0.2),
            "/World/cube":(1,0,0),
            "/World/cube_2":(0,1,0),
            "/World/defaultGroundPlane/Environment/Geometry":(0,0,1)
            }
        colors = []
        valid_count = 0
        for i in range(len(points)):
            path = interface.get_uri_from_instance_segmentation_id(int(objects[i]))
            colors.append(color_table[path])
            if path:
                valid_count +=1
        print(f"valid_count: {valid_count}")
        pcd = o3d.geometry.PointCloud()
        pcd.points = o3d.utility.Vector3dVector(points)
        pcd.colors = o3d.utility.Vector3dVector(colors)
        o3d.io.write_point_cloud("./out.pcd", pcd)
    i+=1
my_world.stop()
simulation_app.close()

as you see only very few points have colors which means most of object id are not indicating the hitting prim.

RTX lidar is important for us because physx lidar can’t capture animated characters. Could you please help us to solve this issue?
Thanks

Hi @fullike Have you tried running it longer and collect more data?
I changed if i == 100 to if i%100 == 0 and print the valid count at every 100th loop.
For some loops, there are not many valid counts, but for some loops it has decent amount of valid counts.
Here is my output:

valid_count: 0
valid_count: 2
valid_count: 1028
valid_count: 2989
valid_count: 4262
valid_count: 5271
valid_count: 0
valid_count: 4056
valid_count: 8098
valid_count: 12234
valid_count: 12463
valid_count: 12668
valid_count: 12774
valid_count: 12783
valid_count: 12785
valid_count: 12783

Hello!

We noticed that this topic hasn’t received any recent responses, so we are closing it for now to help keep the forum organized.

If you’re still experiencing this issue or have additional questions, please feel free to create a new topic with updated details. When doing so, we recommend mentioning or linking to this original topic in your new post—this helps provide context and makes it easier for others to assist you.

Thank you for being part of the NVIDIA Isaac Sim community.

Best regards,
The NVIDIA Isaac Sim Forum Team