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


map_store
Author(s): Dave Hershberger
autogenerated on Mon Oct 6 2014 02:01:21