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

Compatibility of .pcd files in ROS and standalone PCL

asked 2011-08-29 00:42:48 -0500

Bogdan Harasymowicz-Boggio gravatar image

updated 2011-09-02 09:43:38 -0500

kwc gravatar image


This is not a question but I don't know where to post it, so please move the topic to the appropriate forum.

For the last few days I've had trouble displaying .pcd files in pcl_visualization pcd_viewer that work properly with the standalone PCL's pcd_viewer and vice-versa (mainly I wanted to process the .pcd files saved generated in RGBDSLAM).

I was unable to find a solution on the Web (just suggestions to install the unstable version of ROS) but now I've found one, so I post it here in case someone has the same problem.

SOLUTION: Create a ros package and add a source file with the following code (the output cloud is XYZ with no color):

#include <pcl/ros/conversions.h>
#include <pcl/io/pcd_io.h>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>

main (int argc, char** argv)
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> (argv[1], *cloud) == -1)
    std::cout << "ERROR: couldn't read the pcd file!" << std::endl;
    return (-1);

  pcl::io::savePCDFileASCII ("output_cloud.pcd", *cloud);
  std::cout << "Converted!" << std::endl;

  return (0);

rosmake it and execute passing the name of your .pcd file. You'll be able to open correctly the output file either with ROS and standalone PCL.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-12-11 10:27:49 -0500

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Solution posted in question update.

edit flag offensive delete link more

Question Tools


Asked: 2011-08-29 00:42:48 -0500

Seen: 550 times

Last updated: Dec 11 '11