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

Revision history [back]

#!/usr/bin/env python
...
def callback(data, args): 
  dict_1 = args[0]
  dict_2 = args[1]
... 
sub = rospy.Subscriber("text", String, callback, (dict_1, dict_2))

Or you could put these into a class, and have the dictionaries be class member variables.

You want to use the optional callback_args parameter to Subscriber:

#!/usr/bin/env python
...
def callback(data, args): 
  dict_1 = args[0]
  dict_2 = args[1]
... 
sub = rospy.Subscriber("text", String, callback, (dict_1, dict_2))

Or you could put these into a class, and have the dictionaries be class member variables.

You want to use the optional callback_args parameter to Subscriber:

#!/usr/bin/env python
...
def callback(data, args): 
  dict_1 = args[0]
  dict_2 = args[1]
... 
sub = rospy.Subscriber("text", String, callback, (dict_1, dict_2))

Or you could put these into a class, and have the dictionaries be class member variables.

Cut and paste a reasonable amount of your error messages into the question body if you need help with errors.

You want to use the optional callback_args parameter to Subscriber:

#!/usr/bin/env python
...
def callback(data, args): 
  dict_1 = args[0]
  dict_2 = args[1]
... 
sub = rospy.Subscriber("text", String, callback, (dict_1, dict_2))

Or you could put these into a class, and have the dictionaries be class member variables.

Cut and paste a reasonable amount of your error messages into the question body if you need help with errors.

You want to use the optional callback_args parameter to Subscriber:

def callback(data, args): 
  dict_1 = args[0]
  dict_2 = args[1]
... 
sub = rospy.Subscriber("text", String, callback, (dict_1, dict_2))

Or you could put these into a class, and have the dictionaries be class member variables.

The C++ equivalent uses boost::bind http://answers.ros.org/question/12045/how-to-deliver-arguments-to-a-callback-function/

Cut and paste a reasonable amount of your error messages into the question body if you need help with errors.