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

Essentially rclcpp::spin() is allowing the ros node to keep running and check for events on subscribed topics and service calls, and direct the callbacks. It doesn't loop through the constructor, it's a blocking operation in your code; rather it binds these topic/service/action events to the callbacks you define as publisher_ or timer_ through rclcpp executors. The executors are designed to queue callbacks and make sure nothing blocks other activities.

From the definition in that link above:

Coordinate the order and timing of available communication tasks. [...] It coordinates the nodes and callback groups by looking for available work and completing it, based on the threading or concurrency scheme provided by the subclass implementation.