ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Try indenting the line

try:
    self.image_pub.publish(self.bridge.cv2_to_imgmsg(cv_image,"mono16"))
except CvBridgeError as e :
    print(e)

so that's a part of the callback method. That's why the error says

NameError: name 'self' is not defined

because it's not part of the method. Remember that indentation is very important for Python.