Ask Your Question

simple FIFO stack (queue) for MoveIt in ROS

asked 2015-03-10 03:42:23 -0500

est_CEAR gravatar image


I want to use a simple queue (FIFO stack) to give a list of waypoints to MoveIt. I looked at the tutorial : Callbacks_and_Spinning and the class CallbackQueue but it looks like we can use it only with Publisher/Subscriber. Is there any existing simple queue or must I create it from array?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-03-31 08:33:49 -0500

Wolf gravatar image

You'd better use


or std::list with push_front() and pop_back()

The problem with std::vector in this use case is that it will have to relocate your entire data every time you call insert( name_vector.begin(),element) in order for keeping its memory layout. This might be computationally expensive! For std::vector you can only efficiently insert / remove objects at the end of the vector.

edit flag offensive delete link more


Ok, thanks!

est_CEAR gravatar image est_CEAR  ( 2015-03-31 08:57:58 -0500 )edit

answered 2015-03-31 07:43:46 -0500

est_CEAR gravatar image

Hi, I used std::vector<t> with the following methods : insert( name_vector.begin(),element) for "push" pop_back() for "pop"

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-03-10 03:42:23 -0500

Seen: 203 times

Last updated: Mar 31 '15