teb_local_planner icon indicating copy to clipboard operation
teb_local_planner copied to clipboard

[Linking Bug - Rolling] tf2 geometry msgs converters

Open guilyx opened this issue 2 years ago • 0 comments

Hi,

We were so far using Foxy, that still had the tf2_geometry_msgs.h header file in the debian release (0.17.2-1focal.20211011.234834) and had no issue using TEB on the foxy branch.

I'm now porting to Rolling with tf2_geometry_msgs on (0.19.0-1focal.20211105.230706). The header was ported to tf2_geometry_msgs.hpp and tf2_geometry_msgs.h was deprecated (it gives a warning, but the .h still exists and imports the .hpp).

Note that the compilation gives no error and I stumbled on this when running TEB after starting to run my Behavior Tree, the controller_server process died after TEB failed to find a symbol for a fromMsg converter.

Tried enabling the tests and the linker error appeared on compilation after a few fixes (mainly just porting Node to LifecycleNode in the homotopy class test)

This is the converter that's not found when compiling:

/** \brief Convert a Quaternion message to its equivalent tf2 representation.
 * This function is a specialization of the toMsg template defined in tf2/convert.h.
 * \param in A Quaternion message type.
 * \param out The Quaternion converted to a tf2 type.
 */
inline
void fromMsg(const geometry_msgs::msg::Quaternion & in, tf2::Quaternion & out)
{
  // w at the end in the constructor
  out = tf2::Quaternion(in.x, in.y, in.z, in.w);
}

Here's the linker error:

--- stderr: teb_local_planner                             
/usr/bin/ld: libteb_local_planner.so: undefined reference to `void tf2::fromMsg<geometry_msgs::msg::Quaternion_<std::allocator<void> >, tf2::Quaternion>(geometry_msgs::msg::Quaternion_<std::allocator<void> > const&, tf2::Quaternion&)'
collect2: error: ld returned 1 exit status

Which comes from teb_local_planner_ros.cpp

guilyx avatar Dec 04 '21 00:12 guilyx