This project generates a small MCAP file containing
foxglove.CompressedPointCloud protobuf messages sourced from the public
nuScenes lidar dataset.
The example is intentionally minimal:
- It reads lidar keyframes directly from a local nuScenes extract.
- It automatically downloads
v1.0-miniinto./nuscenes/when the dataset is missing. - It uses
foxglove-sdkto write the output MCAP. - It exports all
LIDAR_TOPsweeps by default, not just the sparse keyframes. - It writes a single MCAP topic with
draco-encoded payloads. - It preserves the nuScenes
intensityandringpoint attributes. - It stores the sensor extrinsics in the Foxglove
posefield.
- uv
- Network access the first time you run the script so it can download the
public
v1.0-miniarchive fromnuscenes.org
uv syncList the scenes available in a local nuScenes extract:
uv run generate-nuscenes-compressed-point-cloud \
--version v1.0-mini \
--list-scenesGenerate an MCAP for one scene:
uv run generate-nuscenes-compressed-point-cloud \
--version v1.0-mini \
--scene-name scene-0061 \
--output nuscenes-mini-draco.mcapThe script writes one foxglove.CompressedPointCloud message per lidar
sweep on /point_cloud/compressed.
On the first run, the script downloads https://www.nuscenes.org/data/v1.0-mini.tgz
and extracts it into ./nuscenes/. Later runs reuse that local copy.
- The script fetches the published
CompressedPointCloud.protoand its dependencies from thefoxglove/foxglove-sdkrepository at a pinned commit, compiles a protobuf descriptor set locally, and writes protobuf messages throughfoxglove-sdk. - nuScenes stores lidar calibration quaternions as
[w, x, y, z]; the script converts them to Foxglove'sx/y/z/wfield order. --resolutioncontrols the target spatial quantization in meters before the points are handed to Draco.- Use
--frame-mode keyframesif you want the old keyframe-only export. - Automatic download currently supports the public
v1.0-miniarchive. If you want another nuScenes version, place it under./nuscenes/manually or pass--datarootto a different local extract.