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

Additionally to the answer presented you can use a lambda like:

def callback(data, dict_1, dict_2):
    ...
callback_lambda = lambda x: callback(x,dict_1,dict_2)
sub = rospy.Subscriber("text", String, callback_lambda)

This was useful to me since the version of ROS I was using (hydro) did not seem to have callback_args implemented yet.

Additionally to the answer presented you can use a lambda like:

def callback(data, dict_1, dict_2):
    ...
callback_lambda = lambda x: callback(x,dict_1,dict_2)
sub = rospy.Subscriber("text", String, callback_lambda)

This was useful to me since the version of ROS I was using (hydro) did not seem to have callback_args (see http://docs.ros.org/melodic/api/rospy/html/rospy.topics.Subscriber-class.html) implemented yet. yet.