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

rospy.Subscriber

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

Yehor gravatar image

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

Hello,

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
1

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

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

Comments

thank you for the answer

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

Question Tools

2 followers

Stats

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

Seen: 414 times

Last updated: Mar 31 '19