0
$\begingroup$

Rosanswers logo

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.


Originally posted by mmyself on ROS Answers with karma: 138 on 2013-10-13

Post score: 3


Original comments

Comment by mmyself on 2013-10-14:
My question so stupid?

Comment by tfoote on 2013-10-14:
Please be patient, support for this community is a voluntary effort. wiki.ros.org/Support

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

It appears that your incoming data is in the frame "/pcl" but "/pcl is not published as a tf frame_id. Only "/world" and "/world_marker" exist.

You can see your frame tree with the tf package view_frames. Something needs to publish the transform from "/pcl" to "/world" or you need to update what frame the recieved point cloud is stamped as being originated.


Originally posted by tfoote with karma: 58457 on 2013-10-14

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by mmyself on 2013-10-14:
thx a lot tfoote,

"but "/pcl is not published as a tf frame_id". this is what i also thought, after a long night yesterday. but this is exactly what i want.

so i'm back to my question, how can i bring a pcl to tf. if i was searching on google for pcl to tf i found only examples in the above way.

Must i only make a tf broadcaster for the pcl? You know an example file in ros where i can see how this work? maybe this i a good example?

http://lars.mec.ua.pt/lartk/doc/plane_model_road_segmentation/html/transform__cloud__nodelet_8cpp_source.html

many thx for your patient, tf is a hard concept for me ;)

Comment by tfoote on 2013-10-15:
Have you gone through all the tf tutorials? http://wiki.ros.org/tf/Tutorials That should help you understand the basic concepts. You can either add a broadcaster or change the incoming data.

Comment by mmyself on 2013-10-15:
i know the tutorials and have other tf solutions working. my prob is the pcl to tf thing. hope i can post the solution here. try to bring the above link to work. and will post it.

$\endgroup$
0
$\begingroup$

Rosanswers logo

  1. tully's answer is absolut correct, to my question.

  2. the answer i need, i found here. here happens the tranformation stuff. https://github.com/ethz-asl/ethzasl_ptam/blob/master/ptam/src/PTAMVisualizer.cpp

  3. my fault was: i don't know that i can gave many topics the same frame.id and that there must only one tf for two different frames to work in rviz, in my case world->camera. So i gave the pcl topic also the frame.id /world and everything works great. i can see the cloud in rivz :)


Originally posted by mmyself with karma: 138 on 2013-10-23

This answer was NOT ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.