本文整理汇总了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()