Ask Your Question

Revision history [back]

Just leave out the (self):

rospy.Subscriber("cmd_vel", Twist, self.callback)

Btw. please always copy-paste the exact error message you get, including the backtrace.

Just leave out the (self):

rospy.Subscriber("cmd_vel", Twist, self.callback)

What happens is that instead of passing a reference to the callback method to the subscribe method, you call it actually with self as parameter. That's why the print fails. The backtrace you get should show that the error happens in the __init__ method.

Btw. please always copy-paste the exact error message you get, including the backtrace.

Just leave out the (self):

rospy.Subscriber("cmd_vel", Twist, self.callback)

What happens is that instead of passing a reference to the callback method to the subscribe method, you call it actually with self as parameter. That's why the print fails. The backtrace you get should show that the error happens in the __init__subscribe_cmd_vel method.

Btw. please always copy-paste the exact error message you get, including the backtrace.