0
$\begingroup$

Rosanswers logo

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::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 message_filters::Signal1::CallbackHelper1Ptr message_filters::Signal1::addCallback(const boost::function<void(P)>&) [with P = P; M = std_msgs::String_std::allocator<void >] CallbackHelper1Ptr addCallback(const boost::function<void(P)>& callback)


Originally posted by tonyParker on ROS Answers with karma: 377 on 2017-08-03

Post score: 0


Original comments

Comment by naveedhd on 2017-08-04:
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.

Comment by Ed Venator on 2017-08-09:
FWIW, there's a StringStamped message type in marti_common_msgs (http://docs.ros.org/kinetic/api/marti_common_msgs/html/msg/StringStamped.html)

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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


Originally posted by naveedhd with karma: 161 on 2017-08-04

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.