problem in PCD file generation code for object recognition [closed]

asked 2012-02-17 19:27:43 -0500

youga gravatar image

I am trying this program to generate pcd file using image pipeline, but i am unable to get any pointcloud through pcd viewer. I am using logitech webcam pro9000 camera and have also used minoru camera for the same, but it is showing the same result. Is it the camera problem or is there something wrong with the code...?

#include <ros/ros.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <boost/foreach.hpp>

pcl::PointCloud<pcl::PointXYZRGB> PC;    

void callback(const sensor_msgs::PointCloud2ConstPtr& msg)
{
     printf("Writing the file...\n");
     pcl::fromROSMsg(*msg, PC);
     int a = pcl::io::savePCDFileBinary"/home/rootx/pcl_proj/pcd/temp.pcd", PC);
     printf("Saved the pcd file...%d Return %d\n", PC.points.size(), a);

}

int main(int argc, char** argv)
{
     ros::init(argc, argv, "sub_pcl");
     ros::NodeHandle nh;
     ros::Subscriber sub = nh.subscrib<sensor_msgs::PointCloud2>("points2", 1, callback);
     ros::spin();
}

I tried this command to view pcd file pcd_viewer: rosrun perception_pcl pcd_viewer <filename>

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by tfoote
close date 2013-09-18 14:12:20