TimeSynchronizer compilation error
Hi,
I am trying to implement a simple approximate time synchronizer that synchronizes two topics, Imu data and a twist message from an xbox controller
I have not even departed from the structure of the example here, but I can't for the life of me figure out where my build errors are coming from since it is buried somewhere in a sea of boost warning messages that I can't decrypt.
The node I wrote is below.
#include <ros/ros.h>
#include <geometry_msgs/Twist.h>
#include <sensor_msgs/Imu.h>
#include <sensor_msgs/Joy.h>
#include <message_filters/subscriber.h>
#include <message_filters/time_synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
using namespace sensor_msgs;
using namespace geometry_msgs;
using namespace message_filters;
void syncCallback(const sensor_msgs::Imu::ConstPtr& msg, const geometry_msgs::Twist::ConstPtr& vel)
{
ROS_INFO("HERE WE ARE!");
}
int main(int argc, char** argv)
{
/* initialize ros and create node */
ros::init(argc, argv, "sync_cmd");
/* create node handle */
ros::NodeHandle nh;
/* create filtered subscriber objects for imu and xbox topics */
message_filters::Subscriber<sensor_msgs::Imu> imu_sub(nh, "/imu/data", 1);
message_filters::Subscriber<geometry_msgs::Twist> xbox_sub(nh, "/cmd_vel", 1);
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Imu, geometry_msgs::Twist> MySyncPolicy;
// ApproximateTime takes a queue size as its constructor argument, hence MySyncPolicy(10)
message_filters::Synchronizer<MySyncPolicy> sync(MySyncPolicy(10), imu_sub, xbox_sub);
sync.registerCallback(boost::bind(&syncCallback, _1, _2));
ros::spin();
return 0;
}
There are a huge amount of error messages from boost which are really hard for me to make sense of, but the first thing that looked important was the error message below. The full error message can be found at http://pastebin.com/SQdT5VhT
/home/ubuntu/catkin_ws/src/mvp_ros/src/synchronizer.cpp:34:89: required from here
/opt/ros/indigo/include/message_filters/sync_policies/approximate_time.h:167:89: error: 'value' is not a member of 'ros::message_traits::TimeStamp<geometry_msgs::Twist_<std::allocator<void> >, void>'
ros::Time msg_time = mt::TimeStamp<typename mpl::at_c<Messages, i>::type>::value(msg);
^
/opt/ros/indigo/include/message_filters/sync_policies/approximate_time.h:177:99: error: 'value' is not a member of 'ros::message_traits::TimeStamp<geometry_msgs::Twist_<std::allocator<void> >, void>'
previous_msg_time = mt::TimeStamp<typename mpl::at_c<Messages, i>::type>::value(previous_msg);
^
/opt/ros/indigo/include/message_filters/sync_policies/approximate_time.h:183:100: error: 'value' is not a member of 'ros::message_traits::TimeStamp<geometry_msgs::Twist_<std::allocator<void> >, void>'
previous_msg_time = mt::TimeStamp<typename mpl::at_c<Messages, i>::type>::value(previous_msg);
^
EDIT1:
Ughh ok I thought the suggestion from @ahendrix would work, but now I'm hitting another error that is even more cryptic.....
CMakeFiles/synchronizer.dir/src/synchronizer.cpp.o: In function `message_filters::Synchronizer<message_filters::sync_policies::ApproximateTime<sensor_msgs::Imu_<std::allocator<void> >, geometry_msgs::TwistStamped_<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()':
synchronizer.cpp:(.text._ZN15message_filters12SynchronizerINS_13sync_policies15ApproximateTimeIN11sensor_msgs4Imu_ISaIvEEEN13geometry_msgs13TwistStamped_IS5_EENS_8NullTypeESA_SA_SA_SA_SA_SA_EEE13disconnectAllEv[_ZN15message_filters12SynchronizerINS_13sync_policies15ApproximateTimeIN11sensor_msgs4Imu_ISaIvEEEN13geometry_msgs13TwistStamped_IS5_EENS_8NullTypeESA_SA_SA_SA_SA_SA_EEE13disconnectAllEv]+0x24): undefined reference to `message_filters::Connection::disconnect()'
The key error here seems to be the undefined reference to message_filters::Connection::Connection(boost::function<void ()> const&)
. I feel terrible just posting error codes and asking or help...in addition to helping me solve this ...