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

simple FIFO stack (queue) for MoveIt in ROS

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

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 -0500

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 image est_CEAR  ( 2015-03-31 08:57:58 -0500 )edit
0

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

Question Tools

1 follower

Stats

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

Seen: 301 times

Last updated: Mar 31 '15