pcl to tf - example for pcl::transformPointCloud
I am looking for a working example for translating a pointcloud to tf. Here is my example based on the examples here. pcl_ros tutorials (http://wiki.ros.org/pcl_ros#CA-1e7f8563c53a97f77516b3fe5ea24f4b33d237de_3)
typedef pcl::PointCloud<pcl::PointXYZ> PointCloud;
ros::Publisher tf_pub;
tf::TransformListener *tf_listener;
void callback(const PointCloud::ConstPtr& pcl_in)
{
PointCloud pcl_out;
tf_listener->waitForTransform("/world", (*pcl_in).header.frame_id, (*pcl_in).header.stamp, ros::Duration(5.0));
pcl_ros::transformPointCloud("/world", *pcl_in, pcl_out, *tf_listener);
tf_pub.publish(pcl_out);
printf ("Cloud: width = %d, height = %d\n", pcl_in->width, pcl_in->height);
BOOST_FOREACH (const pcl::PointXYZ& pt, pcl_in->points)
printf ("\t(%f, %f, %f)\n", pt.x, pt.y, pt.z);
}
int main(int argc, char** argv)
{
ros::init(argc, argv, "sub_pcl");
ros::NodeHandle nh;
ros::Subscriber sub = nh.subscribe<PointCloud>("points2", 1, callback);
tf_pub = nh.advertise<PointCloud> ("tf_points2", 1);
tf_listener = new tf::TransformListener();
ros::spin();
//delete tf_listener;
//return 0;
}
this resumes in the following error.
[ERROR] [1381659561.691872448]: Frame id /pcl does not exist! Frames (3): Frame /world_marker exists with parent /world.
Frame /world exists with parent NO_PARENT.
the frame_id /pcl exists. rxgraph show that is all connected and well.
anybody there who can tell me what i'm doing wrong or maybe has a working example for me?
update: after looking around and trying a lot, i didn't find a working example anyway. the above code is not what i'am searching for. i was on the wrong lane, by googling to the theme pcl to tf.
i was looking for an example for maybe an /world frame and the /pcl frame from pcl_ros tutorial above. must i transform any point of the pointcloud or ...??? don't no what to do.
at the end, i only want a /world -> /camera -> /pcl tf chain for the ardrone. but stick in the pcl to tf thing and didn't come further :(
anybody out there who can help me at this point.
My question so stupid?
Please be patient, support for this community is a voluntary effort. wiki.ros.org/Support