How to configure Time sequence message filter
Hello,
I want to use time sequence message filter. I wrote the code according to API defined here Link
This is my code
void callback(const std_msgs::StringConstPtr& info) { ROS_INFO("Call is called "); }
int main(int argc, char **argv) { ros::init(argc, argv, "test");
ros::NodeHandle n;
message_filters::Subscriber<std_msgs::string> sub(n, "my_topic", 1);
message_filters::TimeSequencer<std_msgs::string> seq(sub, ros::Duration(0.1), ros::Duration(0.01), 10);
seq.registerCallback(callback);
ros::spin();
return 0; }
It gives this error In file included from /opt/ros/jade/include/message_filters/subscriber.h:43:0, from /lhome/luqman/Work/radar_ros_ws/src/bbox_rviz/src/test_doc.cpp:2: /opt/ros/jade/include/message_filters/simple_filter.h: In instantiation of ‘message_filters::Connection message_filters::SimpleFilter<m>::registerCallback(void ()(P)) [with P = const boost::shared_ptr<const std_msgs::string_<std::allocator<void=""> > >&; M = std_msgs::String_<std::allocator<void> >]’: /lhome/luqman/Work/radar_ros_ws/src/bbox_rviz/src/test_doc.cpp:21:32: required from here /opt/ros/jade/include/message_filters/simple_filter.h:96:99: error: no matching function for call to ‘message_filters::Signal1<std_msgs::string_<std::allocator<void> > >::addCallback(void (&)(const boost::shared_ptr<const std_msgs::string_<std::allocator<void=""> > >&))’ return Connection(boost::bind(&Signal::removeCallback, &signal_, signal_.addCallback(callback))); ^ /opt/ros/jade/include/message_filters/simple_filter.h:96:99: note: candidate is: In file included from /opt/ros/jade/include/message_filters/simple_filter.h:41:0, from /opt/ros/jade/include/message_filters/subscriber.h:43, from /lhome/luqman/Work/radar_ros_ws/src/bbox_rviz/src/test_doc.cpp:2: /opt/ros/jade/include/message_filters/signal1.h:91:22: note: template<class p=""> message_filters::Signal1<m>::CallbackHelper1Ptr message_filters::Signal1<m>::addCallback(const boost::function<void(p)>&) [with="" p="P;" m="std_msgs::String_<std::allocator<void"> >] CallbackHelper1Ptr addCallback(const boost::function<void(p)>& callback)<="" p="">
As stated in description, "The TimeSequencer filter guarantees that messages will be called in temporal order according to their header's timestamp". If that is correct, than the given example in docs would be incorrect.
FWIW, there's a StringStamped message type in marti_common_msgs ( http://docs.ros.org/kinetic/api/marti... )