ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
This error: TypeError: 'instancemethod' object has no attribute '__getitem__'
means that you're trying to use square brackets ( __getitem__ ) on something that doesn't support them; namely a method.
For the publish method call, you should be using parentheses, just like any other method call in python. You'll also need to revise the argument to your publish call; it should be a python message object:
msg = Twist() # create a new Twist message object
msg.linear.y = 1 # set the linear y component to 1
pub.publish(msg) # publish your message