Ask Your Question
0

How to generate <sensor_msgs::PointCloud2> format bagfile

asked 2019-08-13 02:56:29 -0500

3fmeow gravatar image

Hi, I have some pcap files that were collected in velodyne VLP16, how do I convert this pcap file to a bagfile in the sensor_msgs::pointcloud2 format ? I've tried it

rosrun velodyne_driver velodyne_node _model:=VLP16 _pcap:=/your/pcap/path/data.pcap _read_once:=true

rosrun rosbag record -O out.bag /velodyne_packets.

But the bag file generated is of type velodyne_msgs/VelodyneScan, my program needs sensor_msgs::PointCloud2 type data. This is a piece of code from my project

subLaserCloud = nh.subscribe<sensor_msgs::PointCloud2>("TOPICS", 1, &ImageProjection::cloudHandler, this);

Hope to get a reply soon, and thanks in advance.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2019-08-13 03:57:50 -0500

pavel92 gravatar image

Well according to the documentation velodyne_node captures Velodyne 3D LIDAR data and publishes it in raw form. This uses the same device driver class as velodyne_driver/DriverNodelet.
I guess you have been looking at this answer. Looks like the next thing yo need to do is convert the velodyne_msgs/VelodyneScan into sensor_msgs/PointCloud2 by using the CloudNodelet from velodyne_pointcloud or the cloud_node.

edit flag offensive delete link more

Comments

Yes, thank you very much for your advice. Here is my current operation process:

roscore
rosrun velodyne_driver velodyne_node _model:=VLP16 _pcap:=my.pcap _read_once:=true
rosrun nodelet nodelet standalone velodyne_pointcloud/CloudNodelet _calibration:=VLP-16.yaml

Then began to run my program, now I can finally see the images in the rviz. And I have a new problem, I want to save the data of PointCloud2. After executing the above three steps, I run the following command in a new terminal:

rosrun rosbag record -O out1.bag /velodyne_points

Terminal print

[ WARN] [1565691355.513475857]: /use_sim_time set to true and no clock published.  Still waiting for valid time...

How can I solve this problem. Once again thank you. : )

3fmeow gravatar image3fmeow ( 2019-08-13 05:25:31 -0500 )edit

Im glad it helped. In addition, it is a common practice that if you have a new problem you should create a new question to keep problem tracking organized. As for your new problem, refer to this question. As you can see you can set the /use_sim_time parameter to true/false like this:

rosparam set use_sim_time true
pavel92 gravatar imagepavel92 ( 2019-08-13 06:39:44 -0500 )edit

thank you very much

3fmeow gravatar image3fmeow ( 2019-08-13 20:57:58 -0500 )edit

Your Answer

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

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-08-13 02:56:29 -0500

Seen: 35 times

Last updated: Aug 13