5 from nav_msgs.msg
import OccupancyGrid
6 from sensor_msgs.msg
import LaserScan
7 import oculusprimesocket
14 lockfilepath =
"/run/shm/map.raw.lock" 22 lockfilepath =
"/run/shm/map.raw.lock" 23 framefilepath =
"/run/shm/map.raw" 25 if os.path.exists(lockfilepath):
28 open(lockfilepath,
'w')
30 framefile = open(framefilepath,
'w')
31 packeddata = struct.pack(
'%sb' %len(data.data), *data.data)
32 framefile.write(packeddata)
35 if os.path.exists(lockfilepath):
36 os.remove(lockfilepath)
38 quaternion = ( data.info.origin.orientation.x, data.info.origin.orientation.y,
39 data.info.origin.orientation.z, data.info.origin.orientation.w )
40 th = tf.transformations.euler_from_quaternion(quaternion)[2]
43 s =
"state rosmapinfo "+str(data.info.width)+
","+str(data.info.height)+
"," 44 s += str(data.info.resolution)+
","+str(data.info.origin.position.x)+
"," 45 s += str(data.info.origin.position.y)+
","+str(th)+
","+str(rospy.get_time())
52 firstscan.unregister()
68 size = len(scanpoints)
71 s += str(round(scanpoints[i],3))+
"," 73 s += str(round(scanpoints[size-1],3))
91 rospy.init_node(
'map_remote', anonymous=
False)
93 if os.path.exists(lockfilepath):
94 os.remove(lockfilepath)
96 rospy.Subscriber(
"map", OccupancyGrid, mapcallBack)
97 firstscan = rospy.Subscriber(
"scan", LaserScan, scanCallback)
101 while not rospy.is_shutdown():
104 if t - lastsendinfo > sendinfodelay:
107 if len(scanpoints) > 0: