ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

bag file to pcd files

asked 2016-05-24 00:43:02 -0500

noman gravatar image

updated 2016-05-24 02:01:48 -0500

gvdhoorn gravatar image

when i try to convert bag file using the following command to pcd file then i get multiple pcd files. is this correct ? How can i obtain single pcd file from a bag file.

rosrun pcl_ros bag_to_pcd <input_file.bag> <topic> <output_directory>
edit retag flag offensive close merge delete


can this node be used to convert to point cloud data directly from the "scan" topic which is in laser reading format or does the topic need to be a point cloud data publishing topic ?

Vignesh_93 gravatar image Vignesh_93  ( 2021-02-08 09:36:06 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2016-10-04 08:28:40 -0500

mjcarroll gravatar image

The bag_to_pcd file will use the topic that you choose as input, and turn each sensor_msgs/PointCloud2 message on that topic into it's own PCD file.

If you want a single PCD file, you need to use a tool like the point_cloud_assembler ( ) to concatenate all of the clouds together into a single cloud. You can then use the bag_to_pcd tool to save that new single cloud.

edit flag offensive delete link more

answered 2016-10-03 04:30:33 -0500

Kailegh gravatar image

I do not understand your question, you want to obtain 1 big pointcloud containing every pointcloud in the rosbag? If that is what you want you can simply add the pointclouds.

rosrun pcl_ros bag_to_pcd <input_file.bag> <topic> <output_directory>

That will get every single topic that the rosbag would publish and save it in the directory you want.

edit flag offensive delete link more



How does you answer explain anything ? You just repeated the question back again

rosrun pcl_ros bag_to_pcd <input_file.bag> <topic> <output_directory>

Outputs many .pcd files out of a .bag file and OP wants to have a single output that accumulates all the .pcd's into a single one.

"You can simply add the pointclouds." oh thank you for explaining how to do this as well...

kaanoguzhan gravatar image kaanoguzhan  ( 2020-07-12 12:23:06 -0500 )edit

is there anyway to run this command: rosrun pcl_ros bag_to_pcd <input_file.bag> <topic> <output_directory> in python script rather than in terminal?

Farid gravatar image Farid  ( 2020-10-15 08:10:22 -0500 )edit

You can use subprocess in python to run these as standalone linux commands or run this node pcl_ros like standard nodes of ROS.

Vignesh_93 gravatar image Vignesh_93  ( 2021-02-08 09:39:23 -0500 )edit

Question Tools

1 follower


Asked: 2016-05-24 00:43:02 -0500

Seen: 15,216 times

Last updated: Oct 04 '16