| import numpy as np |
| import matplotlib.pyplot as plt |
| import argparse |
| import os |
| import sys |
| import json |
| sys.path.append(os.path.join(os.environ['ALFRED_ROOT'])) |
| def main(args): |
| id=args.floor_plan |
| npy_file = os.path.join('layouts', 'FloorPlan%d-layout.npy' % id) |
| json_file = os.path.join('layouts', 'FloorPlan%d-openable.json' % id) |
| with open(json_file) as f: |
| json_obejct=json.load(f) |
| pos = np.load(npy_file) |
| for p in pos: |
| plt.scatter(p[0], p[1], color='b') |
| for k, v in json_obejct.items(): |
| obj_id=k.split('|')[0] |
| plt.scatter(v[0], v[1], color='r') |
| plt.text(v[0], v[1], obj_id) |
| plt.show() |
| if __name__ == "__main__": |
| parser = argparse.ArgumentParser() |
| |
| parser.add_argument('--floor_plan', type=int,required=True, help="number to display reachble points") |
| parse_args = parser.parse_args() |
| main(parse_args) |