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

Convert VelodyneScan to PointCloud2 from a rosbag file

asked 2014-09-04 21:33:50 -0600

AsifA gravatar image


I would like to build a 3D map from velodyne_points (sensor_msgs/PointCloud2) in offline mode. In order to save some storage space, I am logging only velodyne_packets (velodyne_msgs/VelodyneScan) to a rosbag file using velodyne_driver. Later, I need to convert this VelodyneScan into PointCloud2 to build the map.

So my question is: How to convert VelodyneScan into PointCloud2 when the device is no connected? I was trying velodyne_pointcloud that works fine only when the sensor (Velodyne) is connected. Otherwise, it does not publish /velodyne_points.

Thank you.

edit retag flag offensive close merge delete


how you are running velodyne_pointploud

bvbdort gravatar image bvbdort  ( 2014-09-05 04:24:29 -0600 )edit

I am playing back the rosbag file as rosbag play --clock file_name.bag and then launching the cloud_nodelet.launch file located in the velodyne_pointcloud package. cont ...

AsifA gravatar image AsifA  ( 2014-09-05 07:09:33 -0600 )edit

In the launch file, I am assigning the value "$(find velodyne_pointcloud)/params/32db.yaml" to the parameter "calibration".

AsifA gravatar image AsifA  ( 2014-09-05 07:11:04 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted

answered 2014-09-05 07:36:43 -0600

bvbdort gravatar image

updated 2014-09-05 07:37:56 -0600

<node pkg="nodelet" type="nodelet" name="cloud_nodelet" output="screen" args="load velodyne_pointcloud/CloudNodelet velodyne_nodelet_manager">

add node output on screen, hope it gives whats the problem is.

edit flag offensive delete link more


In addition to this, I also need to run nodelet manager from velodyne_driver package.

AsifA gravatar image AsifA  ( 2014-09-05 09:19:48 -0600 )edit

answered 2017-04-17 03:59:58 -0600

markstrefford gravatar image

This worked for me. If your Velodyne scans are in scans.bag

In separate terminal sessions run the following:


Run the nodelet:

rosrun nodelet nodelet standalone velodyne_pointcloud/CloudNodelet

Use rosbag record to record the point cloud messages:

rosrun rosbag record -O pointcloud.bag /velodyne_points

And finally play your bag containing the VelodyneScan:

rosbag play scans.bag
edit flag offensive delete link more


i tried this but my pointcloud.bag is empty. I am guessing my velodyne_pointcloud isnt working correctly then. When i run the command "rosrun nodelet nodelet standalone velodyne_pointcloud/CloudNodelet", l get: type is velodyne_pointcloud/CloudNodelet continued...

icywhite gravatar image icywhite  ( 2017-12-27 02:58:20 -0600 )edit

bunch of laser_ring info, then:

icywhite gravatar image icywhite  ( 2017-12-27 02:59:35 -0600 )edit

answered 2014-09-04 22:04:55 -0600

joq gravatar image

Use rosbag play on the bag file so it publishes velodyne_packets for velodyne_pointcloud to convert.

edit flag offensive delete link more


Yes, I do play rosbag but problem is still there.

AsifA gravatar image AsifA  ( 2014-09-04 22:18:00 -0600 )edit

So what is your actual problem? Play back the data or convert it?

BennyRe gravatar image BennyRe  ( 2014-09-05 03:06:47 -0600 )edit

The problem is convert it. I can play back the recorded data, say velodyne_packets. Then I launch either cloud_nodelet or transform nodelet, in both cases I do not see velodyne_points being published. cont..

AsifA gravatar image AsifA  ( 2014-09-05 06:36:10 -0600 )edit

On the other hand, when Velodyne sensor is connected and velodyne_packets is being published online, then velodyne_points is also published using either cloud_nodelet or transform_nodelet.

AsifA gravatar image AsifA  ( 2014-09-05 06:45:05 -0600 )edit

I was reading velodyne_pointcloud package. It says that cloud_nodelet or transform_nodelet subscribes to velodyne_packets (velodyne_msgs/VelodyneScan)one or more raw Velodyne data packets from the device. cont ...

AsifA gravatar image AsifA  ( 2014-09-05 06:52:17 -0600 )edit

Does this mean that velodyne_pointcloud will work only when the device is connected? If not then why velodyne_packets are not being converted to velodyne_points?

AsifA gravatar image AsifA  ( 2014-09-05 06:56:17 -0600 )edit

No it should work with any valid /velodyne_packets stream.

joq gravatar image joq  ( 2014-09-05 10:49:23 -0600 )edit

Try running the node instead of the nodelet, its simpler to launch.

joq gravatar image joq  ( 2014-09-05 10:50:13 -0600 )edit

Question Tools

1 follower


Asked: 2014-09-04 21:33:50 -0600

Seen: 4,866 times

Last updated: Apr 17 '17