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

How to receive the lastest message stored in subscriber queue?? [closed]

asked 2013-08-11 05:44:55 -0500

Is it possible to retrieve the most latest message stored in subscriber queue?? If possible the how??

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by ayush_dewan
close date 2013-08-14 01:02:36

1 Answer

Sort by ยป oldest newest most voted

answered 2013-08-11 08:58:40 -0500

Chad Rockey gravatar image

If you're only interested in the latest messages and want to drop the rest, just set a queue_size of 1, when you create the subscriber.

Otherwise, you'll have to write your own data structure (queue, stack, std::vector) and continually spin to fill your data structure from the callbacks and process it in your own thread. Be careful of thread safety.

edit flag offensive delete link more


Thanks a lot..

ayush_dewan gravatar image ayush_dewan  ( 2013-08-14 01:01:52 -0500 )edit

Question Tools

1 follower


Asked: 2013-08-11 05:44:55 -0500

Seen: 375 times

Last updated: Aug 11 '13