Files
PythonRobotics/tests/test_grid_map_lib.py
jsbyysheng a3fd04f68f fix error: 'numpy.ndarray' object has no attribute 'append' (#662)
* Update grid_map_lib.py

fix error: 'numpy.ndarray' object has no attribute 'append'

* Update test_grid_map_lib.py

* Update test_grid_map_lib.py

Co-authored-by: Atsushi Sakai <asakai.amsl+github@gmail.com>
2022-05-07 18:15:01 +09:00

29 lines
876 B
Python

from Mapping.grid_map_lib.grid_map_lib import GridMap
import numpy as np
def test_position_set():
grid_map = GridMap(100, 120, 0.5, 10.0, -0.5)
grid_map.set_value_from_xy_pos(10.1, -1.1, 1.0)
grid_map.set_value_from_xy_pos(10.1, -0.1, 1.0)
grid_map.set_value_from_xy_pos(10.1, 1.1, 1.0)
grid_map.set_value_from_xy_pos(11.1, 0.1, 1.0)
grid_map.set_value_from_xy_pos(10.1, 0.1, 1.0)
grid_map.set_value_from_xy_pos(9.1, 0.1, 1.0)
def test_polygon_set():
ox = [0.0, 20.0, 50.0, 100.0, 130.0, 40.0]
oy = [0.0, -20.0, 0.0, 30.0, 60.0, 80.0]
grid_map = GridMap(600, 290, 0.7, 60.0, 30.5)
grid_map.set_value_from_polygon(ox, oy, 1.0, inside=False)
grid_map.set_value_from_polygon(np.array(ox), np.array(oy),
1.0, inside=False)
if __name__ == '__main__':
conftest.run_this_test(__file__)