ROS2 Problems with Message Filter and Time Sync [closed]

asked 2020-04-03 16:23:26 -0600

mequi gravatar image

updated 2020-04-04 12:30:42 -0600

Hello, I am having a strange set of issues regarding the message filter. I am attempting to synchronize two stereo image topics and the code is relatively simple and has been checked with other sources from the internet. The code builds fine with colcon build but when I try to do ros2 run I get the error

symbol lookup error: undefined symbol: _ZN15message_filters10ConnectionC1ERKSt8functionIFvvEE`.

When I try to build it without colcon and use CLion's CMake configuration I get the following

message_filters::Connection message_filters::Signal9<sensor_msgs::msg::Image_<std::allocator<void> >, sensor_msgs::msg::Image_<std::allocator<void> >, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType>::addCallback<std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > > const&, std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > > const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&>(std::function<void (std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > > const&, std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > > const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&, std::shared_ptr<message_filters::NullType const> const&)> const&)':
/opt/ros/eloquent/include/message_filters/signal9.h:176: undefined reference to `message_filters::Connection::Connection(std::function<void ()> const&)'
CMakeFiles/br-slam.dir/src/br-slam.cpp.o: In function `rclcpp::create_subscription_factory<sensor_msgs::msg::Image_<std::allocator<void> >, message_filters::Subscriber<sensor_msgs::msg::Image_<std::allocator<void> > >::subscribe(rclcpp::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rmw_qos_profile_t)::{lambda(std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > const>)#1}, std::allocator<void>, sensor_msgs::msg::Image_<std::allocator<void> >, rclcpp::Subscription<sensor_msgs::msg::Image_<std::allocator<void> >, std::allocator<void>, rclcpp::message_memory_strategy::MessageMemoryStrategy<sensor_msgs::msg::Image_<std::allocator<void> >, std::allocator<void> > >, rclcpp::message_memory_strategy::MessageMemoryStrategy>(message_filters::Subscriber<sensor_msgs::msg::Image_<std::allocator<void> > >::subscribe(rclcpp::Node*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rmw_qos_profile_t)::{lambda(std::shared_ptr<sensor_msgs::msg::Image_<std::allocator<void> > const>)#1}&&, rclcpp::SubscriptionOptionsWithAllocator<std::allocator<void> > const&, rclcpp::message_memory_strategy::MessageMemoryStrategy::SharedPtr)::{lambda(rclcpp::node_interfaces::NodeBaseInterface*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const&)#1}::operator()(rclcpp::node_interfaces::NodeBaseInterface, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, rclcpp::QoS const) const':
/opt/ros/eloquent/include/rclcpp/subscription_factory.hpp:102: undefined reference to `rosidl_message_type_support_t const* rosidl_typesupport_cpp::get_message_type_support_handle<sensor_msgs::msg::Image_<std::allocator<void> > >()'
CMakeFiles/br-slam.dir/src/br-slam.cpp.o: In function `message_filters::Connection message_filters::SimpleFilter<sensor_msgs::msg::Image_<std::allocator<void> > >::registerCallback<message_filters::MessageEvent<sensor_msgs::msg::Image_<std::allocator<void> > const> const&>(std::function<void (message_filters::MessageEvent<sensor_msgs::msg::Image_<std::allocator<void> > const> const&)> const&)':
/opt/ros/eloquent/include/message_filters/simple_filter.h:83: undefined reference to `message_filters::Connection::Connection(std::function<void ()> const&)'

I am not sure if the problems are related but either way I can not get my simple rclcpp node with a single message_filter time synchronizer to run. I am using ROS2 eloquent on Ubuntu 18.04. Any help is greatly appreciated.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by mequi
close date 2020-04-12 12:11:46.913690

Comments

Post you cmakelists and code that generated this.

stevemacenski gravatar image stevemacenski  ( 2020-04-04 01:45:04 -0600 )edit

Hi I have the exact same problem with you, and I found out that the error only occur when you source both ROS1 and ROS2 setup files and the message filters package might get confused. Sourcing one of the setup file could avoid the error.

harrisonust gravatar image harrisonust  ( 2022-06-24 01:05:22 -0600 )edit