Hello,
I have come across an issue when trying to get objectIds from the RTX Lidar.
When using IsaacSim 2023.1.1 the code runs, but does not run on 2022.2.1 (another issue entirely).
This code is all run from the script editor and there is an object (cone) placed in the scene (has debug lidar points on it). The spawn code is run before play. The data retrieval is run during simulation playing.
When running this code in the script editor, I see the debug Lidar points fine, however, when I go to try and get the objectIds of all hit objects the array is empty. This code comes from the doc page RTX_LIDAR.
import omni.kit.commands
from pxr import Gf
import omni.replicator.core as rep
lidar_config = “Example_Rotary”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
render_product = rep.create.render_product(sensor.GetPath(), [1, 1])
3. Create a Replicator Writer that “writes” points into the scene for debug viewing
writer = rep.writers.get(“RtxLidarDebugDrawPointCloudBuffer”)
writer.attach(render_product)4. Create Annotator to read the data from with annotator.get_data()
annotator = rep.AnnotatorRegistry.get_annotator(“RtxSensorCpuIsaacCreateRTXLidarScanBuffer”)
annotator.initialize(outputObjectId=True)
annotator.attach(render_product)
The code that is used to try and get the objectIds is below:
output_lidar_data = annotator.get_data()
print(output_lidar_data)
Below is the output of this code:
{‘azimuth’: array(, dtype=float64), ‘beamId’: array(, dtype=float64), ‘data’: array([[ 9.708219 , -0.5087862 , -1.7421757 ],
[ 9.70936 , -0.50884604, -1.6008642 ],
[ 9.701449 , -0.5084315 , -1.4605494 ],
…,
[ 9.703027 , -0.49263918, -1.0434356 ],
[ 9.710629 , -0.49302518, -0.9054116 ],
[ 9.708224 , -0.49290308, -0.7684523 ]], dtype=float32), ‘distance’: array([9.876413, 9.853597, 9.823942, …, 9.771396, 9.765202, 9.751056],
dtype=float32), ‘elevation’: array(, dtype=float64), ‘emitterId’: array(, dtype=float64), ‘index’: array([ 204, 206, 208, …, 921558, 921560, 921562], dtype=uint32), ‘intensity’: array([0.03194074, 0.03438428, 0.03642835, …, 0.03662872, 0.03836866,
0.03758959], dtype=float32), ‘materialId’: array(, dtype=float64), ‘normal’: array(, dtype=float64), ‘objectId’: array(, dtype=float64), ‘timestamp’: array(, dtype=float64), ‘velocity’: array(, dtype=float64), ‘info’: {‘numChannels’: 128, ‘numEchos’: 2, ‘numReturnsPerScan’: 921600, ‘renderProductPath’: ‘/Render/RenderProduct_Replicator’, ‘ticksPerScan’: 3600, ‘transform’: array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., -0.,
-0., 1., 1.])}}
Does anyone know why this is not working?
Best,
Jon