Skip to content

foxglove/compressed-point-cloud-example

Repository files navigation

nuScenes Compressed Point Cloud MCAP Example

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-mini into ./nuscenes/ when the dataset is missing.
  • It uses foxglove-sdk to write the output MCAP.
  • It exports all LIDAR_TOP sweeps by default, not just the sparse keyframes.
  • It writes a single MCAP topic with draco-encoded payloads.
  • It preserves the nuScenes intensity and ring point attributes.
  • It stores the sensor extrinsics in the Foxglove pose field.

Prerequisites

  • uv
  • Network access the first time you run the script so it can download the public v1.0-mini archive from nuscenes.org

Setup

uv sync

Usage

List the scenes available in a local nuScenes extract:

uv run generate-nuscenes-compressed-point-cloud \
  --version v1.0-mini \
  --list-scenes

Generate an MCAP for one scene:

uv run generate-nuscenes-compressed-point-cloud \
  --version v1.0-mini \
  --scene-name scene-0061 \
  --output nuscenes-mini-draco.mcap

The 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.

Notes

  • The script fetches the published CompressedPointCloud.proto and its dependencies from the foxglove/foxglove-sdk repository at a pinned commit, compiles a protobuf descriptor set locally, and writes protobuf messages through foxglove-sdk.
  • nuScenes stores lidar calibration quaternions as [w, x, y, z]; the script converts them to Foxglove's x/y/z/w field order.
  • --resolution controls the target spatial quantization in meters before the points are handed to Draco.
  • Use --frame-mode keyframes if you want the old keyframe-only export.
  • Automatic download currently supports the public v1.0-mini archive. If you want another nuScenes version, place it under ./nuscenes/ manually or pass --dataroot to a different local extract.

About

A generator for the new foxglove.CompressedPointCloud message type

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages