When to use rclcpp::spin or RCLCPP_COMPONENTS_REGISTER_NODE?
When should i use rclcpp::spin() (or one of its variations) and when should I use RCLCPP_COMPONENTS_REGISTER_NODE()?
The context is that I am following the action server tutorial. The code in the tutorial uses RCLCPP_COMPONENTS_REGISTER_NODE to be able to run the node. But the tutorial ends with a link to some other examples. In one of those examples it uses rclcpp::spin. What are the differences between these ways of starting a node?
The action server tutorial: https://index.ros.org/doc/ros2/Tutori...
The examples: https://github.com/ros2/examples/tree...
The specific example with rclcpp::spin: https://github.com/ros2/examples/blob...
Waiting for an answer..
Also would like to read the answer to this question
I am struggling with an issue related to this... so far what I have understood:
On the other hand, I'm not sure about the pros and cons of these two different ways of compiling the node.