Ask Your Question

ROS Bag File Point Cloud

asked 2016-02-05 14:58:42 -0500

parisresident gravatar image

updated 2016-02-05 16:27:12 -0500

Is their a way to open a .bag file in a application such as cloud compare, or mesh lab?

I am using a Kinect camera for mapping and I want to be able to view the 3d point cloud map created.

Thank you for your help.

P.S sorry for bad english.

Also, how do I capture one frame of a ros bag. I just one to store one frame of a point cloud scene from rviz.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-02-06 08:29:14 -0500

codenotes gravatar image

A .bag file is just an store of serialized ROS messages of any kind. It has no affinity for any particular type of message (such as PointCloud) and so you can't open a .bag file in any application unless that application is specifically written to read a .BAG file, and for that, it would need to incorporate the ROS C libraries that read and write to bag files ( ).

So, the answer would be no. The main app that opens bag files is rqt_bag, a plugin for the rqt ROS GUI framework. If you want to visualize a pointcloud, you can do it with RVIZ fairly easily, but I appreciate you may want to edit it or otherwise analyze it. One thing you can do, is just do a "rostopic echo <yourpointcloudtopic> and pipe the output to a file. The resulting data is very easily modified in a text editor to become a .ply file. You can look up the .ply specification, but it is just a little metadata and all the x,y,z points that constitute your cloud. Be very quick to hand-modify the rostopic echo data into a .ply file and then you can import into meshlab or whatever you like.

edit flag offensive delete link more


Any hint on how to "pipe the output to a file" when doing "rostopic echo <yourpointcloudtopic>"?

CLDer gravatar image CLDer  ( 2021-05-14 11:18:28 -0500 )edit

answered 2017-12-03 22:04:32 -0500

M@t gravatar image

updated 2017-12-03 22:05:05 -0500

Just to add to codenotes answer, I suggest you also look into pcl_ros as it has a few useful functions for writing ROS messages (in and out of bagfiles) to PCD files.

For example:

$ rosrun pcl_ros pointcloud_to_pcd input:=/velodyne/pointcloud2

Will subscribe to the /velodyne/pointcloud2 topic and save every message as an individual PCD file. Or, if you want to read data directly from a bagfile...

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

Can be used to read all the messages on a topic, and save them as individual PCD files. I've used the first command a fair bit, and found it very useful for debugging.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-02-05 14:58:42 -0500

Seen: 5,331 times

Last updated: Dec 03 '17