ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question


asked 2019-03-31 08:11:11 -0500

Yehor gravatar image

updated 2019-03-31 08:11:42 -0500


Is it necessarily to have a def callback in the rospy.Subscriber? I am asking because I came across one question here. In that question, the asker uses a Subscribe method without def callback.

Thank you

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-03-31 22:00:26 -0500

janindu gravatar image

It is not necessary to have a def callback in the rospy.Subscriber constructor(It's an optional argument). However, if no callback functions are set, the messages won't be processed. You can later add callbacks using the add_callback() (source)

If you look at the question that you are referring to, he is using message_filter to approximately synchronise messages and process them together in a single callback, which he registers by calling self.ts.registerCallback(self.callback).

edit flag offensive delete link more


thank you for the answer

Yehor gravatar image Yehor  ( 2019-04-01 07:07:25 -0500 )edit

Question Tools



Asked: 2019-03-31 08:11:11 -0500

Seen: 386 times

Last updated: Mar 31 '19