I’m very sorry, but I have some confusion while using the RTX sensor.
First, I created a very simple scene with only a cube in it.
Additionally, I ran the official example code, which includes both the cube and the RTX sensor. However, the data I’m getting is all empty, and I’m not sure why.
{'rendering_time': 62.80000327527523, 'rendering_frame': (3781, 30), 'IsaacExtractRTXSensorPointCloudNoAccumulator': {'azimuth': array([], dtype=float64), 'beamId': array([], dtype=float64), 'data': array([], dtype=float64), 'distance': array([], dtype=float64), 'elevation': array([], dtype=float64), 'emitterId': array([], dtype=float64), 'index': array([], dtype=float64), 'intensity': array([], dtype=float64), 'materialId': array([], dtype=float64), 'normal': array([], dtype=float64), 'objectId': array([], dtype=float64), 'timestamp': array([], dtype=float64), 'velocity': array([], dtype=float64), 'info': {'numChannels': 0, 'numEchos': 0, 'numReturnsPerScan': 0, 'renderProductPath': '/Render/OmniverseKit/HydraTextures/Replicator', 'ticksPerScan': 0, 'transform': array([ 1., 0., 0., 0., 0., 1., 0., 0., 0., 0., 1., 0., -0.,
-0., -0., 1.]), 'azimuth': array([], dtype=float64), 'beamId': array([], dtype=float64), 'distance': array([], dtype=float64), 'elevation': array([], dtype=float64), 'emitterId': array([], dtype=float64), 'index': array([], dtype=float64), 'intensity': array([], dtype=float64), 'materialId': array([], dtype=float64), 'normal': array([], dtype=float64), 'objectId': array([], dtype=float64), 'timestamp': array([], dtype=float64), 'velocity': array([], dtype=float64)}}}
from isaacsim import SimulationApp
kit = SimulationApp({"headless": False})
from isaacsim.core.utils.stage import add_reference_to_stage
import numpy as np
import omni
from isaacsim.sensors.rtx import LidarRtx
from isaacsim.core.api import World
add_reference_to_stage(usd_path="/home/a/OM/test/cube.usd",
prim_path="/World")
# Create the RTX Lidar with the specified attributes.
sensor = LidarRtx(
prim_path="/World/lidar",
translation=np.array([0.0, 0.0, 0.0]),
orientation=np.array([1.0, 0.0, 0.0, 0.0]),
config_file_name="Example_Rotary",
)
# Initialize the LidarRtx object, which creates a render product for the sensor.
sensor.initialize()
# Attach an annotator to the sensor.
sensor.attach_annotator("IsaacExtractRTXSensorPointCloudNoAccumulator")
# Play the timeline to initialize the OmniGraph associated with the annotator and render product,
# and begin collecting data.
timeline = omni.timeline.get_timeline_interface()
timeline.play()
# Collect data from the annotator on each simulation frame.
while kit.is_running():
# Step the simulation
kit.update()
# Print data collected by each annotator attached to the sensor as a Python dict
print(sensor.get_current_frame())
timeline.stop()
kit.close()
