Undefined symbol error when using tf2_ros::BufferInterface::transform
I'm trying to use the tf2_ros::BufferInterface::transform
method on a PointCloud2
message like so (tf_buffer_
is a tf2_ros::Buffer
object):
void someMethod(const sensor_msgs::PointCloud2ConstPtr& input_cloud)
{
const auto transformed_cloud = tf_buffer_.transform<sensor_msgs::PointCloud2>(*input_cloud,
some_frame_id, ros::Duration(0.1));
... do some stuff ...
}
The code compiles fine, but fails with a symbol lookup error during run time:
undefined symbol: ros::Time const& tf2::getTimestamp<sensor_msgs::PointCloud2_<std::allocator<void> > >(sensor_msgs::PointCloud2_<std::allocator<void> > const&)
I have no idea what is going on. I tried to include all sorts of packages (tf2, tf2_ros, tf2_msgs, tf2_sensor_msgs, geometry_msgs, sensor_msgs) in both my CMakeLists and my package.xml, but that doesn't help.
It's worthwhile mentioning that I'm using the same tf2_ros::Buffer
object before this point in the program to transform a geometry_msgs::PointStamped
message, which has the same frame_id
as the point cloud, into the same target frame, and there it works just fine. Just for this PointCloud2
message it seems to fail.