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

To clearly answer your question and remove any doubt :

Why is a rospy.spinOnce() not required ?

  • Because it doesn't exist, I'm not sure why you would ask that given that there isn't any documentation about a function spinOnce in rospy. The first answer on this question provides interesting links.

But in fact callbacks do seem to be happening

  • That's the normal behavior with rospy. roscpp and rospy ARE NOT THE SAME. When it comes to callbacks, with roscpp you need to use spin() or spinOnce() to process the events. Withrospy you don't need it because when you create a subscriber it gets its own thread.

In python when must spin() used ?

  • If you want to keep your node alive until you request a shutdown or ros crashes, which is nice not having to handle it by yourself.

and when is spinOnce() used?

  • Never, it doesn't exist.

To clearly answer your question and remove any doubt :

Why is a rospy.spinOnce() not required ?

  • Because it doesn't exist, I'm not sure why you would ask that given that there isn't any documentation about a function spinOnce in rospy. The first answer on this question provides interesting links.

But in fact callbacks do seem to be happening

  • That's the normal behavior with rospy. roscpp and rospy ARE NOT THE SAME. When it comes to callbacks, with roscpp you need to use spin() or spinOnce() to process the events. Withrospy you don't need it because when you create a subscriber it gets its own thread.

In python when must spin() used ?

  • If you want to keep your node alive until you request a shutdown or ros crashes, which is nice not having to handle it by yourself.crashes. You can use it even if you haven't any subscriber.

and when is spinOnce() used?

  • Never, it doesn't exist.

To clearly answer your question and remove any doubt :

Why is a rospy.spinOnce() not required ?

  • Because it doesn't exist, I'm not sure why you would ask that given that there isn't any documentation about a function spinOnce in rospy. The first answer on this question provides interesting links.

But in fact callbacks do seem to be happening

  • That's the normal behavior with rospy. roscpp and rospy ARE NOT THE SAME. When it comes to callbacks, with roscpp you need to use spin() or spinOnce() to process the events. Withrospy you don't need it because when you create a subscriber it gets its own thread.

In python when must spin() used ?

  • If you want to keep your node alive until you request a shutdown or ros crashes. You can use it even if you haven't don't have any subscriber.

and when is spinOnce() used?

  • Never, it doesn't exist.
click to hide/show revision 4
No.4 Revision

To clearly answer your question and remove any doubt :

Why is a rospy.spinOnce() not required ?

  • Because it doesn't exist, I'm not sure why you would ask that given that there isn't any documentation about a function spinOnce in rospy. The first answer on this question provides interesting links.

But in fact callbacks do seem to be happening

  • That's the normal behavior with rospy. roscpp and rospy ARE NOT THE SAMEare not the same. When it comes to callbacks, with roscpp you need to use spin() or spinOnce() to process the events. Withrospy you don't need it because when you create a subscriber it gets its own thread.

In python when must spin() used ?

  • If you want to keep your node alive until you request a shutdown or ros crashes. You can use it even if you don't have any subscriber.

and when is spinOnce() used?

  • Never, it doesn't exist.