Go to the documentation of this file.00001
00002
00003 import rospy
00004 import os
00005 from sensor_msgs.msg import Image
00006
00007 '''
00008 rostopic info /camera/depth/image_rect
00009 Type: sensor_msgs/Image
00010
00011 rosmsg show sensor_msgs/Image
00012 std_msgs/Header header
00013 uint32 seq
00014 time stamp
00015 string frame_id
00016 uint32 height
00017 uint32 width
00018 string encoding
00019 uint8 is_bigendian
00020 uint32 step
00021 uint8[] data
00022 '''
00023
00024 def imgrect_callBack(data):
00025 lockfilepath = "/run/shm/xtion.raw.lock"
00026 framefilepath ="/run/shm/xtion.raw"
00027
00028 if os.path.exists(lockfilepath):
00029 return
00030
00031 open(lockfilepath, 'w')
00032
00033 framefile = open(framefilepath, 'w')
00034 framefile.write(data.data)
00035 framefile.close()
00036
00037 if os.path.exists(lockfilepath):
00038 os.remove(lockfilepath)
00039
00040
00041
00042
00043
00044
00045
00046 rospy.init_node('openni_imgrect_to_shm', anonymous=False)
00047 rospy.Subscriber("camera/depth/image_raw", Image, imgrect_callBack)
00048
00049 rospy.spin()