Python: Lidar Sensor#

This example loads lidar_example.usda, renders a lidar PointCloud, maps the composite render variable to CPU memory, and visualizes detections in rerun.io. Point color is derived from the Intensity channel.

The scene is Z-up and contains a lidar at (0, 0, 1) rotated to look along world +X, an asphalt ground plane, and a concrete cube. The USD requests Coordinates, Intensity, Counts, and TimeOffsetNs channels.

“Create a Python sensor example that loads a scene containing a configured lidar, warms up the sensor pipeline, renders one point-cloud frame, reads valid point data using the count channel, prints summary statistics, and optionally visualizes the points with intensity-based colors.”

Lidar sensor example output

Prerequisites#

  • Python 3.10-3.13

  • uv

Running#

cd examples/python/lidar
uv run main.py

Options#

Flag

Description

--scene PATH

Load a different USDA scene

--no-rr

Disable Rerun visualization and print only the frame summary

--rrd PATH

Write a Rerun recording instead of spawning a viewer

lidar_example_panels.usda, beside the example, is an alternative scene for --scene: the same lidar, 1.5 m above the origin, among a glass pane, a silver panel and concrete walls, with a preview camera product the example does not step.

uv run main.py --scene lidar_example_panels.usda

Expected console output values vary, but a successful run prints the number of valid points, mean intensity, and maximum time offset in nanoseconds.