Ask Your Question
0

simple FIFO stack (queue) for MoveIt in ROS

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

est_CEAR gravatar image

Hi,

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?

Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

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

Wolf gravatar image

You'd better use

std::queue http://www.cplusplus.com/reference/qu...

or std::list http://www.cplusplus.com/reference/li... 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

Comments

Ok, thanks!

est_CEAR gravatar imageest_CEAR ( 2015-03-31 08:57:58 -0600 )edit
0

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

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

Stats

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

Seen: 162 times

Last updated: Mar 31 '15