Ask Your Question
0

Message_filters TimeSequencer compile error

asked 2019-05-14 04:20:06 -0500

iabadia gravatar image

updated 2019-05-14 08:54:47 -0500

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-05-14 08:20:35 -0500

gvdhoorn gravatar image

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.

edit flag offensive delete link more

Comments

You are right, stupid mistake, I didn't add the message_filters libraries in the CMakeLists.txt. Problem solved, thanks!!

iabadia gravatar image iabadia  ( 2019-05-14 08:57:03 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-05-14 04:20:06 -0500

Seen: 62 times

Last updated: May 14 '19