I am doing a project in which I need to display series of images in Baxter robot's screen.

asked 2017-06-30 15:41:53 -0500

Biruk22 gravatar image

I tried to launch it on ./baxter. sh, but it kept saying that the input type is a not numpy array. I do know that gray scale images are not acceptable, and I have checked that. However, I am encountering the same problem again and again. Can you help me on this?

Traceback (most recent call last): File "/home/baxter/ros_ws/src/baxter_examples/scripts/xdisplay_image.py", line 63, in <module> msg = cv_bridge.CvBridge().cv2_to_imgmsg(img, encoding="passthrough") File "/opt/ros/indigo/lib/python2.7/dist-packages/cv_bridge/core.py", line 246, in cv2_to_imgmsg raise TypeError('Your input type is not a numpy array') TypeError: Your input type is not a numpy array This is the code that I used

#! usr/bin/python2

if __name__ == '__main__' :

rospy.init_node('rsdk_xdisplay_image', anonymous=True) #added to follow the format of publishing a message
pub = rospy.Publisher('/robot/xdisplay', Image, latch=True, queue_size=1)
images=["r.png","l.png","f.png"] #added list of imgages found in /xdisplayImages
while not rospy.is_shutdown():

      for path in images:  # loop to iterate images
          img = cv2.imread(path)
          msg = cv_bridge.CvBridge().cv2_to_imgmsg(img, encoding="bgr8")
          pub.publish(msg)
# Sleep to allow for image to be published.
          rospy.sleep(1)
edit retag flag offensive close merge delete