Rosbag to PCD

Convert a rosbag to PCD, online

"Rosbag to PCD" can mean two very different jobs. Sometimes you want every PointCloud2 frame exported to disk. Other times you really want one mapped point cloud from the whole recording. The right path depends on which of those jobs you are actually doing.

What rosbag-to-PCD actually means

Frame export and mapped output are not the same thing

Frame export

Local tools like bag_to_pcd read one topic and write a folder of timestamped PCD files. That is great for debugging a sensor stream, checking fields, or handing one frame to another tool.

Mapped output

If what you really need is a point cloud map, you still need LiDAR SLAM and, when available, GNSS-backed georeferencing. That is the job LidarFlow is built for.

Three honest ways to do it

Local CLI, custom Python, or a browser workflow

1. Upstream CLI

If you are already in a ROS environment and only need per-frame exports, use the upstream tool directly.

ros2 run pcl_ros bag_to_pcd --ros-args \
  -p bag_path:=rosbag2_2025_01_01/ \
  -p topic_name:=/pointcloud \
  -p output_directory:=pcds

Good for timestamped frame exports. Not a full mapping pipeline.

2. Python script

If you need custom filtering, field transforms, or one-off post-processing, a small Python script gives you more control.

import rosbag
from sensor_msgs import point_cloud2

with rosbag.Bag("input.bag") as bag:
    for _, msg, stamp in bag.read_messages(topics=["/velodyne_points"]):
        points = list(point_cloud2.read_points(msg, skip_nans=True))
        # write one PCD per frame or feed points into another tool

Flexible, but you still own the rest of the pipeline.

3. LidarFlow

If you want a mapped output instead of a folder of raw frames, upload the recording through the browser and let LidarFlow handle validation, SLAM, georeferencing, and artifact delivery.

  • Upload `.mcap` or ROS1 `.bag`
  • Validate topics before launch
  • Download `output.pcd`, `map.ply`, metadata, and trajectory artifacts
When to use which

Pick the smallest tool that still solves the whole job

Use the local path when

  • You only need frame-by-frame PCDs for debugging one topic.
  • You want to inspect timestamps, fields, or per-frame coverage before running SLAM.

Use LidarFlow when

  • You need one mapped point cloud and not a directory full of timestamped exports.
  • You want one browser surface for run status, QA, and downloads.
  • You do not want to maintain ROS, SLAM, and storage glue on every operator laptop.
Next step

Need a map, not just a directory of PCD frames?