convert directly from bag to pcd
Hi,
I have vlp-16 running with ubuntu 14.04 and Ros indigo, is it possible to convert directly from rosbag to pcd while recording the pointcloud? as we know during recording it generate .bag.active
Asked by shahrilburt on 2019-01-24 01:03:10 UTC
Answers
I don't know of any existing node which can do this, but it's a very simple one to write yourself. The point cloud callback function would look like this:
void cloud_cb (const sensor_msgs::PointCloud2ConstPtr& input)
{
// Convert the sensor_msgs/PointCloud2 data to pcl/PointCloud
pcl::PointCloud<pcl::PointXYZ> cloud;
pcl::fromROSMsg (*input, cloud);
pcl::writeASCII("saved_ascii_cloud.pcd", cloud);
pcl::writeBinary("saved_binary_cloud.pcd", cloud);
}
You'd need to write a node which subscribed to your PointCloud2 topic with this callback, and add some code to create a numbered sequence of file names.
Hope this gets you going in the right direction.
Asked by PeteBlackerThe3rd on 2019-01-24 09:59:06 UTC
Comments
Just to clarify do you want to run a node which listens to a point-cloud topic and saves them as a series of .PCD files as they arrive, avoiding the bag file completely. Or do you have a bag file of point cloud messages and you want to extract them all as PCD files?
Asked by PeteBlackerThe3rd on 2019-01-24 08:12:59 UTC
Yes i was thingking to save the data pointcloud topic with the series of .PCD files avoiding the bag file. Is it possible to do that?
Asked by shahrilburt on 2019-01-24 08:18:09 UTC