0
$\begingroup$

Rosanswers logo

Dear all,

I am trying to use the TimeSequencer filter of the message_filters library to introduce a delay to a certain topic. I have created a simple example following the documentation on http://wiki.ros.org/message_filters

#include "ros/ros.h"
#include "std_msgs/String.h"
#include "geometry_msgs/PoseStamped.h"
#include <message_filters/subscriber.h>
#include <message_filters/time_sequencer.h>

void chatterCallback(const geometry_msgs::PoseStamped::ConstPtr& msg)
{
  ROS_INFO("Msg received");

}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "subscriber");

  ros::NodeHandle n;

  message_filters::Subscriber<geometry_msgs::PoseStamped> sub(n, "chatter", 1);
  message_filters::TimeSequencer<geometry_msgs::PoseStamped> seq(sub, ros::Duration(0.1), ros::Duration(0.01), 10);
  seq.registerCallback(chatterCallback);
  ros::spin();

  return 0;
}

However, I get a compilation error stating " undefined reference to `message_filters::Connection::disconnect()' ". Here is the whole compilation error message:

CMakeFiles/Subscriber.dir/src/Subscriber.cpp.o: In function `message_filters::TimeSequencer<geometry_msgs::PoseStamped_<std::allocator<void> > >::~TimeSequencer()':
Subscriber.cpp:(.text._ZN15message_filters13TimeSequencerIN13geometry_msgs12PoseStamped_ISaIvEEEED2Ev[_ZN15message_filters13TimeSequencerIN13geometry_msgs12PoseStamped_ISaIvEEEED5Ev]+0x2d): undefined reference to `message_filters::Connection::disconnect()'

Does anyone know where the error comes from? I have searched for more documentation but I haven't found a solution. Any help would be very much appreciated.

I am running ROS Kinetic on Ubuntu 16.04.

Thanks in advance,

Ignacio


Originally posted by iabadia on ROS Answers with karma: 55 on 2019-05-14

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

However, I get a compilation error stating

undefined reference to `message_filters::Connection::disconnect()' 

"undefined reference" errors are never compilation errors, but linker errors.

It's likely you're not (correctly) linking to the message_filters libraries.

If you can show us your CMakeLists.txt we can check it for you.

Note: please remove all the boilerplate comments from the file before you post it here, they're not needed.


Originally posted by gvdhoorn with karma: 86574 on 2019-05-14

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by iabadia on 2019-05-14:
You are right, stupid mistake, I didn't add the message_filters libraries in the CMakeLists.txt. Problem solved, thanks!!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.