Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add implementation for cancel interface #809

Merged
merged 2 commits into from
Feb 17, 2022

Conversation

iuhilnehc-ynos
Copy link

to fix #703

Signed-off-by: Chen Lihui lihui.chen@sony.com

@iuhilnehc-ynos
Copy link
Author

This PR is based on ros2/geometry2#490

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I see that TFFrameTransformer::cancel calls TFWrapper::cancel, which then calls into tf2_ros::Buffer::cancel.

But what calls TFFrameTransform::cancel to begin with?

@iuhilnehc-ynos
Copy link
Author

@clalancette

But what calls TFFrameTransform::cancel to begin with?

the cancel could also be called from destructor MessageFilter<>::~MessageFilter(), please refer to the following backtrace.

backtrace

(gdb) bt
#0  rviz_default_plugins::transformation::TFFrameTransformer::cancel(tf2_ros::TransformStampedFuture const&) (this=0x55555698ad80, ts_future=...)
    at /home/chenlh/Projects/ROS2/ros2-master/src/ros2/rviz/rviz_default_plugins/src/rviz_default_plugins/transformation/tf_frame_transformer.cpp:210
#1  0x00007ffedf42e110 in tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>::clear() (this=0x555556aac460) at /home/chenlh/Projects/ROS2/ros2-master/install/include/tf2_ros/message_filter.h:342
#2  0x00007ffedf439cad in tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>::~MessageFilter() (this=0x555556aac460, __in_chrg=<optimized out>)
    at /home/chenlh/Projects/ROS2/ros2-master/install/include/tf2_ros/message_filter.h:273
#3  0x00007ffedf4665bf in __gnu_cxx::new_allocator<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> >::destroy<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> >(tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>*)
    (this=0x555556aac460, __p=0x555556aac460) at /usr/include/c++/9/ext/new_allocator.h:153
#4  0x00007ffedf45dc35 in std::allocator_traits<std::allocator<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> > >::destroy<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> >(std::allocator<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> >&, tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>*) (__a=..., __p=0x555556aac460) at /usr/include/c++/9/bits/alloc_traits.h:497
#5  0x00007ffedf45b747 in std::_Sp_counted_ptr_inplace<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>, std::allocator<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer> >, (__gnu_cxx::_Lock_policy)2>::_M_dispose() (this=0x555556aac450) at /usr/include/c++/9/bits/shared_ptr_base.h:557
#6  0x000055555555bea6 in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() (this=0x555556aac450)
    at /usr/include/c++/9/bits/shared_ptr_base.h:155
#7  0x000055555555b835 in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() (this=0x7fffffffab48, __in_chrg=<optimized out>)
    at /usr/include/c++/9/bits/shared_ptr_base.h:730
#8  0x00007ffedf42cee0 in std::__shared_ptr<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() (this=0x7fffffffab40, __in_chrg=<optimized out>)
    at /usr/include/c++/9/bits/shared_ptr_base.h:1169
#9  0x00007ffedf42df68 in std::__shared_ptr<tf2_ros::MessageFilter<geometry_msgs::msg::PolygonStamped_<std::allocator<void> >, rviz_common::transformation::FrameTransformer>, (__gnu_cxx::_Lock_policy)2>::reset() (this=0x555556a91d60) at /usr/include/c++/9/bits/shared_ptr_base.h:1287
#10 0x00007ffedf42d66c in rviz_common::MessageFilterDisplay<geometry_msgs::msg::PolygonStamped_<std::allocator<void> > >::unsubscribe() (this=
    0x555556a91c30) at /home/chenlh/Projects/ROS2/ros2-master/install/include/rviz_common/message_filter_display.hpp:166
#11 0x00007ffedf42ca49 in rviz_common::MessageFilterDisplay<geometry_msgs::msg::PolygonStamped_<std::allocator<void> > >::onDisable()
    (this=0x555556a91c30) at /home/chenlh/Projects/ROS2/ros2-master/install/include/rviz_common/message_filter_display.hpp:177
#12 0x00007ffff7e370b6 in rviz_common::Display::onEnableChanged() (this=0x555556a91c30)
    at /home/chenlh/Projects/ROS2/ros2-master/src/ros2/rviz/rviz_common/src/rviz_common/display.cpp:352
#13 0x00007ffff7e325e5 in rviz_common::DisplayGroup::onEnableChanged() (this=0x5555569ebca0)
    at /home/chenlh/Projects/ROS2/ros2-master/src/ros2/rviz/rviz_common/src/rviz_common/display_group.cpp:138
#14 0x00007ffff7dd26e2 in rviz_common::Display::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)
<...>

NOTE:

  • geometry2/tf2_ros/include/tf2_ros/message_filter.h
template<class M, class BufferT = tf2_ros::Buffer>
class MessageFilter 

The second template param BufferT can be either tf2_ros::Buffer or rviz_default_plugins::transformation::FrameTransformer.

  • rviz/rviz_common/src/rviz_common/transformation/transformation_manager.cpp
rviz_common::transformation::TransformationManager::setTransformer
	to create rviz_default_plugins::transformation::TFFrameTransformer
	emit transformerChanged()
  • rviz/rviz_common/include/rviz_common/message_filter_display.hpp
MessageFilterDisplay::subscribe
  tf_filter_ =
    std::make_shared<tf2_ros::MessageFilter<MessageType, transformation::FrameTransformer>>(
    *context_->getFrameManager()->getTransformer(),
    fixed_frame_.toStdString(),
    static_cast<uint32_t>(message_queue_property_->getInt()),
    rviz_ros_node_.lock()->get_raw_node());

MessageFilterDisplay::unsubscribe
  tf_filter_.reset();

@iuhilnehc-ynos
Copy link
Author

iuhilnehc-ynos commented Dec 28, 2021

CI:
Build args: --packages-above-and-dependencies tf2_ros rviz_common rviz_default_plugins
Test args: --packages-above tf2_ros rviz_common rviz_default_plugins

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Chen Lihui added 2 commits February 17, 2022 14:44
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
Signed-off-by: Chen Lihui <lihui.chen@sony.com>
@clalancette
Copy link
Contributor

CI for this is over in ros2/geometry2#490

@clalancette clalancette merged commit 2a42dda into ros2:ros2 Feb 17, 2022
@ros-discourse
Copy link

This pull request has been mentioned on ROS Discourse. There might be relevant details there:

https://discourse.ros.org/t/ros-2-tsc-meeting-2022-02-17/24435/1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rviz2 randomly crashes while running with nav2 stack
3 participants