def draw_maps_main(args=None): coloredlogs.install(level="DEBUG") from duckietown_world.world_duckietown import load_map from duckietown_world.resources import list_maps if args is None: args = sys.argv[1:] parser = argparse.ArgumentParser() parser.add_argument("--output", help="output dir", default="out-draw_maps") parser.add_argument("map_names", nargs=argparse.REMAINDER) parsed = parser.parse_args(args) output = parsed.output if parsed.map_names: map_names = parsed.map_names else: map_names = list_maps() logger.info("Drawing the maps %s." % ", ".join(map_names)) from duckietown_world.gltf import export_gltf for map_name in map_names: duckietown_map = load_map(map_name) out = os.path.join(output, map_name) draw_map(out, duckietown_map) style = "synthetic-F" export_gltf(duckietown_map, out) draw_map_gymd(map_name, out, style) y = duckietown_map.as_json_dict() fn = os.path.join(out, "map.json") with open(fn, "w") as f: f.write(json.dumps(y, indent=4))
def draw_maps_main(args=None): from duckietown_world.world_duckietown import list_maps, load_map if args is None: args = sys.argv[1:] parser = argparse.ArgumentParser() parser.add_argument("--output", help="output dir", default='out-draw_maps') parsed = parser.parse_args(args) output = parsed.output map_names = list_maps() print(map_names) for map_name in map_names: duckietown_map = load_map(map_name) out = os.path.join(output, map_name) draw_map(out, duckietown_map) y = duckietown_map.as_json_dict() fn = os.path.join(out, 'map.json') with open(fn, 'w') as f: f.write(json.dumps(y, indent=4)) print('written to %s' % fn)
def draw_maps_main(args=None): from duckietown_world.world_duckietown import list_maps, load_map if args is None: args = sys.argv[1:] parser = argparse.ArgumentParser() parser.add_argument("--output", help="output dir", default="out-draw_maps") parser.add_argument("map_names", nargs=argparse.REMAINDER) parsed = parser.parse_args(args) output = parsed.output if parsed.map_names: map_names = parsed.map_names else: map_names = list_maps() logger.info("Drawing the maps %s." % ", ".join(map_names)) for map_name in map_names: duckietown_map = load_map(map_name) out = os.path.join(output, map_name) draw_map(out, duckietown_map) y = duckietown_map.as_json_dict() fn = os.path.join(out, "map.json") with open(fn, "w") as f: f.write(json.dumps(y, indent=4))
""" Draw top-down visualizations of a map-set or a single map """ __license__ = "MIT" __copyright__ = "Copyright (c) 2020 András Kalapos" from duckietown_world.svg_drawing.draw_maps import draw_map from duckietown_world.world_duckietown import list_maps, load_map from duckietown_utils.env import MAPSETS # Draw every map in a mapset (see duckietown_utils.env -> MAPSETS for the list of mapsets) for map in MAPSETS['multimap_aido5']: duckietown_map = load_map(map) draw_map('maps/' + map, duckietown_map) # Draw a single map map_name = '_myTestA' duckietown_map = load_map(map_name) draw_map('maps/' + map_name, duckietown_map)