-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalign_manual.py
More file actions
37 lines (31 loc) · 915 Bytes
/
Copy pathalign_manual.py
File metadata and controls
37 lines (31 loc) · 915 Bytes
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
import numpy as np
from occupancy_grid import OccupancyGridMap
print("Loading and converting map...")
# Load probability grid
with np.load('maps/raw_map.npz') as npz:
prob_data = npz['data']
resolution = float(npz['resolution'])
origin = (float(npz['origin_x']), float(npz['origin_y']))
# Convert to standard format
ogm = OccupancyGridMap.from_probability_grid(prob_data, resolution, origin)
ogm.get_info()
# Save png image of raw map
ogm.save_image('maps/unaligned_map.png')
# Interactive alignment
print("\n" + "="*60)
print("INTERACTIVE ALIGNMENT")
print("="*60)
ogm_aligned = ogm.align_interactive()
'''
# Inflate obstacles
print("\nInflating obstacles...")
ogm_aligned.inflate_obstacles(0.15)
'''
# Save
print("\nSaving final map...")
ogm_aligned.save('maps/final_map.npz')
ogm_aligned.save_image('maps/final_map.png')
print("\n" + "="*60)
print("DONE!")
print("="*60)
ogm_aligned.get_info()