forked from ahq1993/MPNet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visualizer.py
40 lines (31 loc) · 974 Bytes
/
visualizer.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
import struct
import numpy as np
import argparse
def main(args):
# visualize point cloud (obstacles)
obs = []
temp=np.fromfile(args.obs_file)
obs.append(temp)
obs = np.array(obs).astype(np.float32).reshape(-1,2)
plt.scatter(obs[:,0], obs[:,1], c='blue')
# visualize path
path = np.loadtxt(args.path_file)
print(path)
path = path.reshape(-1, 2)
path_x = []
path_y = []
for i in range(len(path)):
path_x.append(path[i][0])
path_y.append(path[i][1])
plt.plot(path_x, path_y, c='r', marker='o')
plt.show()
parser = argparse.ArgumentParser()
# for training
parser.add_argument('--obs_file', type=str, default='./data/obs_cloud/obc0.dat',help='obstacle point cloud file')
parser.add_argument('--path_file', type=str, default='./results/env_0/path_0.txt',help='path file')
args = parser.parse_args()
print(args)
main(args)