Ask Your Question
0

In which order are callback functions in a node which offers a service and also subscribes to a topic?

asked 2019-02-24 18:13:10 -0600

eric.valls.grunewald gravatar image

I want to use a node that both offers a service and subscribes to a topic. If, when ros::spin() is called I have both a new message in the topic and a request from the service, which callback function is called first? The service or the subscriber one?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-02-24 19:23:43 -0600

updated 2019-03-01 17:49:48 -0600

I'd recommend reading the Callbacks and Spinning page page. Since it sounds like you are calling ros::spin(), then all callbacks get put into a callback queue in the order in which they are received. Then every call to ros::spin() will handle the callback at the front of the queue. So the answer to your question depends on the order in which the service request and the topic were received.

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

2 followers

Stats

Asked: 2019-02-24 18:13:10 -0600

Seen: 109 times

Last updated: Mar 01