Ask Your Question

Revision history [back]

The ROS python library runs additional threads to handle message subscription and publishing. So when you call rospy.Subscribe in your code, it doesn't check for incoming messages and execute callbacks itself. It simply adds the topic and function to a list. This list is regularly checked in a different thread which executes the callbacks as needed. This is why you don't need any polling in your code to make the message callbacks work.

Hope this makes sense.

The ROS python library runs additional threads to handle message subscription and publishing. So when you call rospy.Subscribe rospy.Subscribe in your code, it doesn't check for incoming messages and execute callbacks itself. It simply adds the topic and function to a list. This list is regularly checked in a different thread which executes the callbacks as needed. This is why you don't need any polling in your code to make the message callbacks work.

Hope this makes sense.