Robotics StackExchange | Archived questions

way to create loop without rospy.spin

Is there a way to make a node keep looping(publishing and subscribing) without using rospy.spin()? Do I need to use rospy.spin for my subscriber to to keep seeking out messages from the the topics its subscribed to?

Asked by distro on 2022-05-02 02:49:52 UTC

Comments

Answers

rospy.spin() is the way. Your subscriber callback will be called each time a new message comes in.

Here's a good reference on how to write a python ROS node with procedural programming and OPP https://roboticsbackend.com/oop-with-ros-in-python/#The_Python_ROS_program_with_OOP

Asked by Alex-SSoM on 2022-05-05 09:42:12 UTC

Comments