ros2 / geometry2

A set of ROS packages for keeping track of coordinate transforms.
BSD 3-Clause "New" or "Revised" License
120 stars 194 forks source link

Publish dynamic TF with this->get_node_topics_interface() works in foxy but not in humble. #596

Open BlueBirdHouse opened 1 year ago

BlueBirdHouse commented 1 year ago

Bug report

Steps to reproduce issue

Make a dynamic publisher as we always do in foxy.

rclcpp::node_interfaces::NodeTopicsInterface::SharedPtr node_topics_handle = this->get_node_topics_interface();

std::unique_ptr<tf2_ros::TransformBroadcaster> tf_broadcaster_ = nullptr;
tf_broadcaster_ = std::make_unique<tf2_ros::TransformBroadcaster>(node_topics_handle);

Expected behavior

The dynamic TF broadcaster object can be initialized.

Actual behavior

It will give you an error. "passed non-default qos overriding options without providing a parameters interface"

Additional information

image

I have posted an issue on there and there. I also asked my question there. A friend from ROS2 channel suggested I post my questions there. Please, I really would like to know how to work with tf2_ros::TransformBroadcaster, get_node_xxx_interface, other handles, or something else. I don't want to use 'this' directly. By using node_xxx_handle, I can isolate different functions in different classes without passing the shared printer node everywhere.

BlueBirdHouse commented 1 year ago

I got an answer from https://github.com/ros2/ros2/issues/1407. But, can I find some detailed explanation that why we should write the code like this? Why the code works in old Foxy but will never work in Humble? What is the mechanism behind these parameters? There should be a professional channel that we finally find.