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

Simple approx time sync example errors

asked 2014-08-13 13:02:51 -0500

pnyholm gravatar image

I am using Hydro on Ubuntu 12.04. I am attempting to make an approximate time synchronizer for my application. I created a simple example to try to get it to work but I am running into the three errors below and cannot figure out what is going wrong by looking through the wiki, FAQs, and other answers. My code is found below the three errors. Does anyone have insight on this? Thanks in advance!

CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o:-1: In function `message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<geometry_msgs::TransformStamped_<std::allocator<void> >, geometry_msgs::TransformStamped_<std::allocator<void> >, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType, message_filters::NullType> >::disconnectAll()':
File not found: CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o

CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o:-1: In function `message_filters::Connection message_filters::Signal9<geometry_msgs::TransformStamped_<std::allocator<void> >, geometry_msgs::TransformStamped_<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<boost::shared_ptr<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&, boost::shared_ptr<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&>(boost::function<void (boost::shared_ptr<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&, boost::shared_ptr<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&, boost::shared_ptr<message_filters::NullType const> const&)> const&)':
File not found: CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o

CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o:-1: In function `message_filters::Connection message_filters::SimpleFilter<geometry_msgs::TransformStamped_<std::allocator<void> > >::registerCallback<ros::MessageEvent<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&>(boost::function<void (ros::MessageEvent<geometry_msgs::TransformStamped_<std::allocator<void> > const> const&)> const&)':
File not found: CMakeFiles/test_pack_node.dir/src/test_pack_node.cpp.o

My example code is:

#include <ros/ros.h>

#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>

#include <geometry_msgs/TransformStamped.h>

class ExampleClass
{

public:
  ExampleClass() :
    nh_(ros::NodeHandle()),
    sub1_(nh_, "topic1", 10),
    sub2_(nh_, "topic2", 10),
    sync_(MySyncPolicy(10),  sub1_, sub2_)
  {
    sync_.registerCallback(boost::bind(&ExampleClass::Callback, this, _1, _2));
  }

  void Callback(const geometry_msgs::TransformStampedConstPtr msg1, const geometry_msgs::TransformStampedConstPtr msg2)
  {
    ROS_INFO("Sync is working");
  }

private:

  ros::NodeHandle nh_;

  message_filters::Subscriber<geometry_msgs::TransformStamped> sub1_;
  message_filters::Subscriber<geometry_msgs::TransformStamped> sub2_;
  typedef message_filters::sync_policies::ApproximateTime<geometry_msgs::TransformStamped, geometry_msgs::TransformStamped> MySyncPolicy;
  message_filters::Synchronizer<MySyncPolicy> sync_;

};

int main(int argc, char** argv){

  ros::init(argc, argv, "test_pack");

  ExampleClass foo;

  ROS_INFO("SPINNING...");
  ros::spin();

  return 0;
}
edit retag flag offensive close merge delete

Comments

1

Your code is correct, it should work. From the errors you posted, I'd guess it's something to do with how you configured your ROS package (more specifically, your CMakeLists.txt).

Murilo F. M. gravatar image Murilo F. M.  ( 2014-08-13 22:09:57 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-08-14 16:27:32 -0500

pnyholm gravatar image

As Murilo suggested the code does work find but there was a small typo in CMakeLists.txt. Thanks Murilo.

edit flag offensive delete link more

Comments

Cool! You're welcome.

Murilo F. M. gravatar image Murilo F. M.  ( 2014-08-14 17:37:53 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-13 13:02:51 -0500

Seen: 1,381 times

Last updated: Aug 14 '14