C: Lidar Sensor#

This example loads lidar_example.usda, renders a lidar PointCloud output, maps the composite render variable to CPU memory, and reads the named tensor channels.

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.

The executable applies the runtime setting --/renderer/raytracingMotion/enabled=true because MotionBVH is required by the lidar sensor pipeline.

“Create a C/C++ lidar sensor example that applies required sensor runtime settings before renderer creation, loads a lidar scene, warms up the sensor pipeline, renders one point-cloud output, reads valid point data safely through the count channel, prints summary statistics, and cleans up all results and mappings.”

Lidar sensor example output

Build and Run#

Prerequisites

sudo apt install build-essential cmake

Building

cd examples/c/sensors/lidar
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Running

./build/lidar-composite-tensor

You can also pass an explicit scene path:

./build/lidar-composite-tensor path/to/lidar_example.usda

Prerequisites

Building

cd examples/c/sensors/lidar
cmake -S . -B build
cmake --build build --config Release

Running

.\build\Release\lidar-composite-tensor.exe

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