当前位置: 首页>>代码示例>>Python>>正文


Python Mapper.shutdown方法代码示例

本文整理汇总了Python中mapper.Mapper.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Python Mapper.shutdown方法的具体用法?Python Mapper.shutdown怎么用?Python Mapper.shutdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mapper.Mapper的用法示例。


在下文中一共展示了Mapper.shutdown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from mapper import Mapper [as 别名]
# 或者: from mapper.Mapper import shutdown [as 别名]

#.........这里部分代码省略.........
		
		# Build the reflexive halt mask
		reflexive_halt_mask = cv.GetImage(cv.fromarray(numpy.zeros((24, 24), numpy.uint8)))
		cv.Circle(reflexive_halt_mask, (12, 12), REFLEXIVE_HALT_RADIUS, 255, -1)
		
		while True:			
			x = 2000
			y = 2000
			heading = 0
			roi_x = x - (roi_face/2)
			roi_y = y - (roi_face/2)
			
			if (not test):
				uicommand = uiManager.getUICommand()
				if uicommand:
					tokens = str.split(uicommand)
					if (tokens[0] == "click"):
						print "a click has gone through"
					if (tokens[0] == "mode"):
						if (tokens[1] == '0'):
							print "Entering autonomous mode"
							flight_mode = AUTO
						elif (tokens[1] == '1'):
							print "Entering manual waypoint command mode."
							flight_mode = WAYPOINT
						elif (tokens[1] == '2'):
							print "Entering manual controller command mode."
							flight_mode = MANUAL
					if (tokens[0] == "export"):
						exportManager.run()
			
			mapperManager.scan()
			m = mapperManager.mapPointer()
			
			# Create the screen buffer 
			cv.SetImageROI(m, (roi_x, roi_y, roi_face, roi_face))
			cv.Copy(m, screen_image)
			cv.ResetImageROI(m)
			
			# Check for a reflexive halt condition
			halt_roi = (x-12, y-12, 24, 24)
			halt = mapperManager.obstaclePresentMask(reflexive_halt_mask, halt_roi)
			cv.Circle(screen_image, (roi_face/2, roi_face/2), REFLEXIVE_HALT_RADIUS, (0, 0, 255, 0), 1)
			if (halt):
				print "REFLEXIVE HALT!"
			
			
			# Prevent the LIDAR from ghosting itself
			cv.Circle(m, (x, y), 10, (255, 255, 255, 255), -1)
			
			# Perform the appropriate tfask
			if (flight_mode == AUTO):
				new_waypoints = []
				if (len(waypointQ) < 10):
					new_waypoints = goalManager.computeNewWaypoints(mapperManager, waypointQ, None, 4, screen_image)
				# this will have to change when we figure out how to do waypoint arrival
				waypointQ = new_waypoints
			elif (flight_mode == WAYPOINT):
				pass
			elif (flight_mode == MANUAL):
				pass				
			
			
			# Commit graphics to the screen buffer
			old_x = 225
			old_y = 225
			for w in waypointQ:
				plot_x = w[0] - x + (roi_face/2)
				plot_y = w[1] - y + (roi_face/2)
				cv.Line(screen_image, (old_x, old_y), (plot_x, plot_y), (0, 0, 255, 0), 1)
				old_x = plot_x
				old_y = plot_y
				#cv.Circle(screen_image, (plot_x, plot_y), 15, (0, 0, 255, 0), 1)
				#cv.Circle(screen_image, (plot_x, plot_y), 6, (0, 0, 255, 0), 1)
				cv.Circle(screen_image, (plot_x, plot_y), 2, (0, 0, 255, 0), -1)
			angle = heading + 1.61
			heading_x = int(math.floor(roi_face/2 + 12*math.cos(angle)))
			heading_y = int(math.floor(roi_face/2 - 12*math.sin(angle)))
			cv.Circle(screen_image, (roi_face/2, roi_face/2), 6, (255, 0, 0, 0), -1)
			cv.Line(screen_image, (roi_face/2, roi_face/2), (heading_x, heading_y), (0, 255, 0), 1)
			
			if test:
				cv.ShowImage("map", screen_image)
				cv.WaitKey(10)
			
			
			# Transmit the results to the appropriate places
			if (not test):
				uiManager.sendLidarString(screen_image.tostring())
	
	except KeyboardInterrupt:
		print "Caught the keyboard interrupt!"
	except Exception as ex:
		print "Caught an unhandled exception:"
		print ex
	
	if (mapperManager):
		mapperManager.shutdown()
	if (not test and uiManager):
		uiManager.shutdown()
开发者ID:evenator,项目名称:senior-project,代码行数:104,代码来源:planner.py


注:本文中的mapper.Mapper.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。