Skip to content

Commit c76f50d

Browse files
committed
calculate index in the map vector
1 parent 8b66b28 commit c76f50d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/mapping/binary/binary_map.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
Author: Shisato Yano
55
"""
66

7+
import numpy as np
78
import sys
89
from pathlib import Path
910
sys.path.append(str(Path(__file__).absolute().parent) + "/../grid")
1011
from grid_map import GridMap
12+
from grid_map import FloatGrid
1113

1214
class BinaryMap:
1315
"""
@@ -35,7 +37,13 @@ def update_map(self, points_x_list, points_y_list):
3537
points_y_list: List of y coordinates of point cloud
3638
"""
3739

38-
pass
40+
points_x_array, points_y_array = np.array(points_x_list), np.array(points_y_list)
41+
42+
for i in range(len(points_x_array)):
43+
index = self.map.calculate_vector_index_from_position(points_x_array[i],
44+
points_y_array[i])
45+
if index is not None:
46+
self.map.set_grid_data(index, FloatGrid(value=1.0))
3947

4048
def draw_map(self, axes, elems):
4149
""""

0 commit comments

Comments
 (0)