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

convert directly from bag to pcd

asked 2019-01-24 00:03:10 -0500

shahrilburt gravatar image

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

edit retag flag offensive close merge delete

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?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-24 07:12:59 -0500 )edit

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?

shahrilburt gravatar image shahrilburt  ( 2019-01-24 07:18:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-01-24 08:59:06 -0500

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.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-01-24 00:03:10 -0500

Seen: 1,140 times

Last updated: Jan 24 '19