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

What is the tf threading model?

asked 2011-03-18 14:54:27 -0500

tfoote gravatar image

I want to use it in a single threaded node.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
6

answered 2011-03-18 14:56:31 -0500

this post is marked as community wiki

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

A TransformListener class is continuously listening for incoming coordinate transforms from TransformBroadcasters. Any blocking call would severely disrupt the flow of information to the listener. Therefore, a transform listener, by default, spins its own thread. This particularly helps with calls to functions like tf::Transformer::waitForTransform which can block callbacks while it is waiting to hear back from tf.

  • The API for tf::Transformer, tf::TransformListener and tf::TransformSender all use mutex locks to be threadsafe.
  • tf::Transformer::waitForTransform requires a dedicated listening thread (provided by default by tf::TransformListener)

If TransformListener spins a thread it will only service callbacks in the custom callback queue for the tf topic.

edit flag offensive delete link more

Comments

I would love it if info like the answer here (especially the bullet points) were put into the doxygen comments for tf::TransformListener (and sender etc).

hersh gravatar image hersh  ( 2013-12-09 04:05:01 -0500 )edit
0

answered 2011-03-19 02:06:05 -0500

dornhege gravatar image

What does that mean for the case, when there is a TransformListener, but no other ros spinning going on with respect to other subscribers (i.e. not tf). The TransformListener will get its tf data via its on spinning thread.

Will other callbacks from other subscribers be called although there is no one explictly spinning?

edit flag offensive delete link more

Comments

No. It is in a separate callback queue and will only service the tf callbacks. (merged into above answer)
Tully gravatar image Tully  ( 2011-03-19 05:36:06 -0500 )edit
thanks, that's what I hoped for.
dornhege gravatar image dornhege  ( 2011-03-19 08:25:43 -0500 )edit

Question Tools

Stats

Asked: 2011-03-18 14:54:27 -0500

Seen: 1,619 times

Last updated: Mar 19 '11