@@ -0,0 +1,977 @@
+#!/usr/bin/env python%0Aimport rospy%0Afrom sensor_msgs.msg import Image%0Afrom cv_bridge import CvBridge, CvBridgeError%0Aimport cv2%0Afrom flexbe_core import EventState, Logger%0Afrom flexbe_core.proxy import ProxySubscriberCached%0Aimport os %0Aimport sys%0Afrom sensor_msgs.msg import PointCloud2%0A%0A%0Aclass StorePictureState(EventState):%0A%09'''%0A%09Stores the picture to the local home folder.%0A%0A%09%3E# Image %09Image%09%09The received Image%0A%09%3C= done %09%09%09The picture has been received and stored.%0A%0A%09'''%0A%0A%09def __init__(self):%0A%09%09super(StorePictureState, self).__init__(outcomes = %5B'done'%5D,%09input_keys = %5B'Image'%5D)%0A                %0A%0A%09def execute(self, userdata):%0A%09%09%0A%09%09return 'done'%0A%09def on_enter(self,userdata):%0A%09%09orig_img = userdata.Image%0A%09%09cv_image = bridge.imgmsg_to_cv2(image_message, desired_encoding=%22passthrough%22)%0A                filename = os.path.expanduser('~/picture_'+str(rospy.Time.now()) %0A   %09%09cv2.imwrite(filename,cv_image)%0A                print 'Picture has been saved to the home folder'%09%0A%0A%09%0A%09%09%0A

store picture state