Go to the documentation of this file.00001
00002
00003 import rospy
00004 import sys
00005 import world_canvas_msgs.srv
00006
00007 save_as = None
00008 try:
00009 save_as = sys.argv[1]
00010 except:
00011 print "You must specify a name for the map on the server"
00012 sys.exit(1)
00013
00014 print "Waiting for /dynamic_map..."
00015 rospy.wait_for_service('/dynamic_map')
00016 print "Waiting for /save_map..."
00017 rospy.wait_for_service('/save_map')
00018 print "Waiting for /list_maps..."
00019 rospy.wait_for_service('/list_maps')
00020 print "Waiting for /delete_map..."
00021 rospy.wait_for_service('/delete_map')
00022
00023 print "Checking for duplicates..."
00024 list_last_maps = rospy.ServiceProxy('/list_maps', world_canvas_msgs.srv.ListMaps)
00025 delete_map = rospy.ServiceProxy('/delete_map', world_canvas_msgs.srv.DeleteMap)
00026 maps = []
00027 try:
00028 maps = list_last_maps().map_list
00029 except:
00030 print "Getting maps from the annotations_manager has failed"
00031 sys.exit(2)
00032
00033 for i in maps:
00034 if (i.name == save_as):
00035 print "Deleting map", i.map_id
00036 delete_map(i.map_id)
00037
00038 print "Starting service..."
00039 save_map = rospy.ServiceProxy('/save_map', world_canvas_msgs.srv.SaveMap)
00040 print "Saving map as", save_as
00041 save_map(save_as)
00042 print "Done"
00043