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

Revision history [back]

click to hide/show revision 1
initial version

Yes, every ROS node needs to spin, with the stipulation that your terminology matches conventional usage.

"ROS node" is conventionally used to refer to a process (or standalone executable, disregarding nodelets). Threads, such as those used by an asynchronous spinner, are computational structures within a process. In the case of an asynchronous spinner, that are all able to use the global callback queue (thus, only one spin is necessary).

As to your use of MAVROS, it depends on what you mean by I built a node that uses MAVROS. If you run MAVROS as a node separate and distinct from your own node, then both need spin calls. If you've simply modified the MAVROS source, adding your own code to it that compiles into a single executable, then a single spin is sufficient.

Note that there are cases where it is helpful to use multiple spin calls (typically, multiple spinOnce calls with multiple threads) within a single node, and it is also sometimes useful to set up multiple callback queues within a single node. But these are beyond your question; any (communicating, functioning) ROS node must have at least one callback queue and one spin call.

Yes, every ROS node needs to spin, with the stipulation that your terminology matches conventional usage.

"ROS node" is conventionally used to refer to a process (or standalone executable, disregarding nodelets). (Edit: upon thinking about it, a more correct definition would also require use of a ROS callback queue. For instance, one might only access the master API in their executable; such a process would probably still be considered a ROS node, but it would have no need for a spin.) Threads, such as those used by an asynchronous spinner, are computational structures within a process. In the case of an asynchronous spinner, that are all able to use the global callback queue (thus, only one spin is necessary).

As to your use of MAVROS, it depends on what you mean by I built a node that uses MAVROS. If you run MAVROS as a node separate and distinct from your own node, then both need spin calls. If you've simply modified the MAVROS source, adding your own code to it that compiles into a single executable, then a single spin is sufficient.

Note that there are cases where it is helpful to use multiple spin calls (typically, multiple spinOnce calls with multiple threads) within a single node, and it is also sometimes useful to set up multiple callback queues within a single node. But these are beyond your question; any (communicating, functioning) ROS node must have at least one callback queue and one spin call.

Yes, every ROS node needs to spin, with the stipulation that your terminology matches conventional usage.

"ROS node" is conventionally used to refer to a process (or standalone executable, disregarding nodelets). (Edit: upon thinking about it, a more correct definition would also require use of a ROS callback queue. For instance, one might only access the master API in their executable; such a process would probably still be considered a ROS node, but it would have no need for a spin.) Threads, such as those used by an asynchronous spinner, are computational structures within a process. In the case of an asynchronous spinner, that are all able to use the global callback queue (thus, only one spin is necessary).

As to your use of MAVROS, it depends on what you mean by I built a node that uses MAVROS. If you run MAVROS as a node separate and distinct from your own node, then both need spin calls. If you've simply modified the MAVROS source, adding your own code to it that compiles into a single executable, then a single spin is sufficient.

Note that there are cases where it is helpful to use multiple spin calls (typically, multiple spinOnce calls with multiple threads) within a single node, and it is also sometimes useful to set up multiple callback queues within a single node. But these are beyond your question; any (communicating, functioning) ROS node must have at least one callback queue and one spin call.