ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
Without checking or too much experience in ros2:
your rclcpp::spin(node)
is only after the while loop. So your node is not added to an executor and callbacks won't be executed. In ROS 2 there is rclcpp::spin_some(node)
which looks like the thing you are looking for. Add the spin_some
statement inside of your while loop and remove the spin(node)
.
I would be happy if you provide feedback on this answer.