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

Revision history [back]

click to hide/show revision 1
initial version

What is different is that this time I am working with a ROS package where there are no classes, everything is in functions but I don't think that should matter because that is how the tutorial is done.

just a guess, but seeing as you only instantiate your listener in your callback: 0.2 seconds is probably not enough time for the tf::TransformListener to see enough of your tree to fill the buffer and be able to retrieve transforms for you. TF needs a buffer, or it can't do anything.

Try instantiating your listener in a scope outside your callbacks (as a global variable fi). I would expect things to improve.

What is different is that this time I am working with a ROS package where there are no classes, everything is in functions but I don't think that should matter because that is how the tutorial is done.

just a guess, but seeing as you only instantiate your listener in your callback: 0.2 seconds is probably not enough time for the tf::TransformListener to see enough of your tree to fill the buffer and be able to retrieve transforms for you. TF needs a buffer, or it can't do anything.

Try instantiating your listener in a scope outside your callbacks (as a global variable fi). I would expect things to improve.


Edit: to avoid globals you could also use boost::bind(..) or use C++11 lambdas / closures.

What is different is that this time I am working with a ROS package where there are no classes, everything is in functions but I don't think that should matter because that is how the tutorial is done.

just a guess, but seeing as you only instantiate your listener in your callback: 0.2 seconds is probably not enough time for the tf::TransformListener to see enough of your tree to fill the buffer and be able to retrieve transforms for you. TF needs a buffer, or it can't do anything.

Try instantiating your listener in a scope outside your callbacks (as a global variable fi). I would expect things to improve.


Edit: to avoid globals (and possible leakage) you could also use boost::bind(..) or use C++11 lambdas / closures.