File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 66
77"""
88
9+ import numpy as np
10+ import matplotlib .pyplot as plt
11+
12+ AREA_WIDTH = 30.0
13+
14+
15+ def generate_ray_casting_grid_map (ox , oy , reso ):
16+
17+ minx = min (ox ) - AREA_WIDTH / 2.0
18+ miny = min (oy ) - AREA_WIDTH / 2.0
19+ maxx = max (ox ) + AREA_WIDTH / 2.0
20+ maxy = max (oy ) + AREA_WIDTH / 2.0
21+ xw = round ((maxx - minx ) / reso )
22+ yw = round ((maxy - miny ) / reso )
23+
24+ # calc each potential
25+ pmap = [[0.0 for i in range (yw )] for i in range (xw )]
26+
27+ for ix in range (xw ):
28+ x = ix * reso + minx
29+
30+ for iy in range (yw ):
31+ y = iy * reso + miny
32+ pmap [ix ][iy ] = x + y
33+
34+ draw_heatmap (pmap )
35+ plt .show ()
36+
37+
38+ def draw_heatmap (data ):
39+ data = np .array (data ).T
40+ plt .pcolor (data , vmax = 100.0 , cmap = plt .cm .Blues )
41+
942
1043def main ():
1144 print (__file__ + " start!!" )
1245
46+ ox = [0.0 ]
47+ oy = [0.0 ]
48+ reso = 1.0
49+
50+ generate_ray_casting_grid_map (ox , oy , reso )
51+
1352
1453if __name__ == '__main__' :
1554 main ()
You can’t perform that action at this time.
0 commit comments