Ask Your Question
0

Using savePCDFileASCII, PCD file isn't created (no errors though)

asked 2016-07-19 10:35:30 -0600

ateator gravatar image

updated 2016-07-19 10:37:08 -0600

Hey guys,

I'm using an XV-11 and IMU to create a 3D sensor_msgs::PointCloud which is successfully advertised on a topic. I want to convert that cloud into a sensor_msgs::PointCloud2 and then pcl::PointCloud. I would also like to convert the intensities into RGB values, but I was having too many problems accessing/editing the rgb values for pcl::PointCloud<pcl::pointxyzrgb>. So, I ended up with this code for just the XYZ values...

    sensor_msgs::PointCloud cloud_out;
    sensor_msgs::PointCloud2 cloud2_out;

... calculations and unnecessary code omitted

    sensor_msgs::convertPointCloudToPointCloud2 (cloud_out, cloud2_out);
    pcl::PointCloud<pcl::PointXYZ> pcl_cloud;
    pcl::fromROSMsg(cloud2_out, pcl_cloud);
    pcl::io::savePCDFileASCII ("test_pcd123.pcd", pcl_cloud);

which compiles and runs without any errors, except that test_pcd123.pcd cannot be found anywhere on my computer. Any ideas on what's going wrong?

When I use std::cerr << "Saved " << pcl_cloud.points.size () << " data points to test_pcd.pcd." << std::endl;, a correct message of Saved 360 data points to test_pcd.pcd. is shown

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-07-19 13:33:40 -0600

ateator gravatar image

Made a minor change, now it works

    pcl::PointCloud<pcl::PointXYZ> pcl_cloud;
    pcl::fromROSMsg(cloud2_out, pcl_cloud);

    writeCount++;
    char filename[100];
    sprintf(filename, "/home/ateator/catkin_ws/src/laser_assembler/src/outputpcd/output%dx.pcd", writeCount);

    pcl::io::savePCDFileASCII (filename, pcl_cloud);
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

1 follower

Stats

Asked: 2016-07-19 10:35:30 -0600

Seen: 494 times

Last updated: Jul 19 '16