ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem running ApproximateTime Policy tutorial

asked 2014-05-26 05:55:56 -0500

anonymous user

Anonymous

updated 2014-05-26 05:56:20 -0500

I'm trying to make use of the an ApproximateTime synchronization, however I am having a boost library related issue with that. Then I decided to test the actual ros tutorial here.

Here is the source file,

/*test_message_filter.cpp*/
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <sensor_msgs/Image.h>
#include <boost/bind.hpp>

using namespace sensor_msgs;
using namespace message_filters;

void callback(const ImageConstPtr& image1, const ImageConstPtr& image2)
{
  // Solve all of perception here...
  ROS_INFO_STREAM("[test_messge_filter] started " << "\n");
}

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

  ros::NodeHandle nh;
  message_filters::Subscriber<Image> image1_sub(nh, "image1", 1);
  message_filters::Subscriber<Image> image2_sub(nh, "image2", 1);

  typedef sync_policies::ApproximateTime<Image, Image> MySyncPolicy;
  // ApproximateTime takes a queue size as its constructor argument, hence MySyncPolicy(10)
  Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), image1_sub, image2_sub);
  sync.registerCallback(boost::bind(&callback, _1, _2));

  ros::spin();

  return 0;
}

I have the following in the CMakeLists.txt file

rosbuild_add_executable(message_fitler_cpp src/test_message_filter.cpp)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(message_fitler_cpp bind)

The error that I'm getting after a rosmake looks like this

  Linking CXX executable ../bin/message_fitler_cpp
  /usr/bin/ld: CMakeFiles/message_fitler_cpp.dir/src/test_message_filter.o: undefined reference to symbol 'boost::signals::connection::~connection()'
  /usr/bin/ld: note: 'boost::signals::connection::~connection()' is defined in DSO /usr/lib/libboost_signals.so.1.46.1 so try adding it to the linker command line
  /usr/lib/libboost_signals.so.1.46.1: could not read symbols: Invalid operation
  collect2: ld returned 1 exit status
  make[3]: *** [../bin/message_fitler_cpp] Error 1
  make[3]: Leaving directory `/home/hash/fuerte_workspace/sandbox/ros_test/build'
  make[2]: *** [CMakeFiles/message_fitler_cpp.dir/all] Error 2
  make[2]: Leaving directory `/home/hash/fuerte_workspace/sandbox/ros_test/build'
  make[1]: *** [all] Error 2
  make[1]: Leaving directory `/home/hash/fuerte_workspace/sandbox/ros_test/build'
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-05-27 23:24:44 -0500

anonymous user

Anonymous

I found a helpful answer here.

So finally I replace the content of CMakeLists.txt file as

rosbuild_add_executable(message_fitler_cpp src/test_message_filter.cpp)
#rosbuild_add_boost_directories()
#rosbuild_link_boost(message_fitler_cpp signals)

and that worked.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-05-26 05:55:56 -0500

Seen: 543 times

Last updated: May 27 '14