Difference between spin and rate.sleep in ROS
问题 I am new to ROS and trying to understand this powerful tool. I am confused by the spin and rate.sleep functions. Could anyone help me with difference between those two functions and when to use which? Thanks. 回答1: ros::spin() and ros::spinOnce() are resposible to handle communication events, e.g. arriving messages. If you are subscribing messages, services or actions you must call spin to process the events. While ros::spinOnce() handles the events and returns immediately, ros::spin() blocks