ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I guess you have followed this tutorial.
The error is comming from line 66:
image = bridge.imgmsg_to_cv2(image_message, desired_encoding="passthrough")
and in your script I cant see where image_message
is populated (it is mentioned only here). This line and all of the code below it seems out of place. Looks like some part of the code you posted is missing or there are tab inconsistencies. You already have initialized a subscriber in the __init__
method. My guess is that you want to process the image published on the CM_040GE/image_raw
topic. In that case in the binded callback
method you already have the conversion to the opencv image:
cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
where data is the ros image message. You should move your processing (everything from line 66 to the end) into this method or create a separate processing method and call it from within the callback.