ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
#!/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.
2 | No.2 Revision |
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.
3 | No.3 Revision |
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.
4 | No.4 Revision |
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.
5 | No.5 Revision |
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.