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

How to run services on another thread?

asked 2019-11-22 05:18:49 -0600

drodgu gravatar image

updated 2019-11-22 05:21:01 -0600

Hi everyone,

I have a navigation application and I need a callback to run on another thread rather than the main one. I've search on the internet and I've discovered that you can do such things using ros subscribers as it is shown in this other reference [1]. In this node I need to use ros service communication. My question is how can I setup my ros::AdvertiseServiceOptions::create in order to link that service server advertisment to another thread by using ros::AsyncSpinner?

Thanks in advance for your help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-09-27 17:19:58 -0600

tfoote gravatar image

You can create a separate callback_queue and associate it with the AsyncSpinner

There's an example and documentation here:

edit flag offensive delete link more


Thank you for the guide!

drodgu gravatar image drodgu  ( 2021-09-27 23:16:12 -0600 )edit

Question Tools

1 follower


Asked: 2019-11-22 05:18:49 -0600

Seen: 176 times

Last updated: Sep 27 '21