Ask Your Question
0

Is there a way to call spinOnce for a specific subscriber?

asked 2017-03-31 19:17:09 -0600

cpagravel gravatar image

Inside my node I have several callbacks. I want to avoid using spinOnce() inside my node as much as possible since the current job should always finish what it is doing before the next callback begins. However, there is one instance which I need to wait on a particular message before continuing. The current solution is to run spinOnce() in a loop, but this is not the way it should be done.

Is there a nice way of doing this? I've read a little about creating my own queuing system, but I would like to find a way that requires the fewest amount of changes.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-31 20:56:29 -0600

ahendrix gravatar image

Section 4 in the roscpp callbacks and spinning describes how to assign different subscribers to different callback queues, and then you can spin the one callback queue for your subscriber without invoking callbacks for your other subscribers.

edit flag offensive delete link more

Comments

This is what I ended up doing. Created a separate nodehandle, queue, and used callAvailable on that queue.

cpagravel gravatar imagecpagravel ( 2017-04-03 12:09:02 -0600 )edit

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: 2017-03-31 19:17:09 -0600

Seen: 229 times

Last updated: Mar 31 '17