[ROS2] tf2::fromMsg linker error
Hi all,
I'm getting a weird linker error using tf2::fromMsg
function in ROS2 Eloquent.
tf2::Transform mSensor2BaseTransf;
[...]
// Save the transformation
geometry_msgs::msg::TransformStamped s2b =
mTfBuffer->lookupTransform(mDepthFrameId, mBaseFrameId, rclcpp::Time(0), rclcpp::Duration(0.1));
// Get the TF2 transformation
tf2::fromMsg(s2b.transform, mSensor2BaseTransf);
This code is used inside a Component library that compiles without any problem, but when I create a C++ Container that load the component I get the following error:
undefined reference to `void tf2::fromMsg<geometry_msgs::msg::Transform_<std::allocator<void> >, tf2::Transform>(geometry_msgs::msg::Transform_<std::allocator<void> > const&, tf2::Transform&)'
Any idea about how to solve the problem?
Thank you Walter collect2: error: ld returned 1 exit status
Same issue in Humble. (I'm trying to use
tf2::fromMsg
on aTwistStamped
to populate a 6D Eigen vector)undefined symbol: void tf2::fromMsg<std::shared_ptr<geometry_msgs::msg::TwistStamped_<std::allocator<void> > const>, Eigen::Matrix<double, 6, 1, 0, 6, 1> >(std::shared_ptr<geometry_msgs::msg::TwistStamped_<std::allocator<void> > const> const&, Eigen::Matrix<double, 6, 1, 0, 6, 1>&)