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

How to configure Time sequence message filter

asked 2017-08-03 12:01:37 -0500

tonyParker gravatar image

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)&gt;&amp;) [with="" p="P;" m="std_msgs::String_&lt;std::allocator&lt;void"> >] CallbackHelper1Ptr addCallback(const boost::function<void(p)&gt;&amp; callback)<="" p="">

edit retag flag offensive close merge delete

Comments

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.

naveedhd gravatar image naveedhd  ( 2017-08-04 06:44:11 -0500 )edit

FWIW, there's a StringStamped message type in marti_common_msgs ( http://docs.ros.org/kinetic/api/marti... )

Ed Venator gravatar image Ed Venator  ( 2017-08-09 23:15:09 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-08-04 06:41:03 -0500

naveedhd gravatar image

I suspect that this problem is due to TimeSequencer working with topics having time stamps. which means if you replace std_msgs::String with (for example) geometry_msgs::PoseStamped, this would compile

edit flag offensive delete link more

Question Tools

Stats

Asked: 2017-08-03 12:01:37 -0500

Seen: 428 times

Last updated: Aug 03 '17