Simple approx time sync example errors
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;
}
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).