Passing arguments to callback in Python
Hi!
I have a problem passing arguments to a callback function when Subscribing a ROStopic. The code below is what I do have now. But I only received error messages when I tried to pass arguments to the callback function. I want to send two dictionaries to the callback function together with the text received on the topic called "text" in the subscriber function below. How to pass these arguments? So far I have only been receiving thousands of error messages.
def callback(data):
rospy.loginfo(data)
def subscriber():
rospy.init_node("listen_for_conversation",anonymous=True)
dict_1 = {.....}
dict_2={......}
content = rospy.Subscriber("text",String,callback)
rospy.spin()
Hoping for good answers!
Thanks