ros / geometry2

A set of ROS packages for keeping track of coordinate transforms.
189 stars 275 forks source link

TransformBroadcaster in tf2 is missing dependency on tf2_msgs #482

Open christianrauch opened 3 years ago

christianrauch commented 3 years ago

There is no documentation at all on how to create a tf2_ros::TransformBroadcaster inside a ROS2 node.

My best guess is to depend on tf2 and:

#include <tf2_ros/transform_broadcaster.h>
[...]
auto tf_broadcaster = std::make_shared<tf2_ros::TransformBroadcaster>(this->shared_from_this());

which causes a compiler error:

/usr/bin/ld: libMultiWiiNode.so: undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<tf2_msgs::msg::TFMessage_<std::allocator<void> > >()'

It turns out that including tf2 is not sufficient and that one also has to include the tf2_msgs dependency manually. The tf2 packages should automatically include all its dependencies, such as tf2_msgs.