From 59dc1d770f36b5c12f743db6d91bf1990f0891f9 Mon Sep 17 00:00:00 2001 From: ymd-stella <7959916+ymd-stella@users.noreply.github.com> Date: Thu, 18 Jun 2020 04:21:53 +0900 Subject: [PATCH] Use dedicated TransformListener thread (#551) Signed-off-by: ymd-stella --- .../transformation/tf_wrapper.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rviz_default_plugins/src/rviz_default_plugins/transformation/tf_wrapper.cpp b/rviz_default_plugins/src/rviz_default_plugins/transformation/tf_wrapper.cpp index a499d4c08..eb8a44a3e 100644 --- a/rviz_default_plugins/src/rviz_default_plugins/transformation/tf_wrapper.cpp +++ b/rviz_default_plugins/src/rviz_default_plugins/transformation/tf_wrapper.cpp @@ -123,8 +123,16 @@ void TFWrapper::initialize( bool using_dedicated_thread) { initializeBuffer(clock, rviz_ros_node.lock()->get_raw_node(), using_dedicated_thread); - tf_listener_ = std::make_shared( - *buffer_, rviz_ros_node.lock()->get_raw_node(), false); + if (using_dedicated_thread) { + // TODO(pull/551): The TransformListener needs very quick spinning so it uses its own node + // here. Remove this in favor of a multithreaded spinner and ensure that the listener callback + // queue does not fill up. + tf_listener_ = std::make_shared( + *buffer_, true); + } else { + tf_listener_ = std::make_shared( + *buffer_, rviz_ros_node.lock()->get_raw_node(), false); + } } void TFWrapper::initializeBuffer(