To pass more arguments to your callback function in rospy, it is actually super simple.
1 2 3 4 5 |
def callback(data, args): arg1 = args[0] arg2 = args[1] sub = rospy.Subscriber("topic_name", String, callback, (arg1, arg2)) |
Of course, rather than a tuple, something like a single “String” could also be passed directly.