|
| 1 | +import os |
| 2 | +import sys |
| 3 | +import unittest |
| 4 | + |
| 5 | +sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../Mapping/grid_map_lib") |
| 6 | +try: |
| 7 | + from grid_map_lib import GridMap |
| 8 | +except ImportError: |
| 9 | + raise |
| 10 | + |
| 11 | + |
| 12 | +class MyTestCase(unittest.TestCase): |
| 13 | + |
| 14 | + def test_position_set(self): |
| 15 | + grid_map = GridMap(100, 120, 0.5, 10.0, -0.5) |
| 16 | + |
| 17 | + grid_map.set_value_from_xy_pos(10.1, -1.1, 1.0) |
| 18 | + grid_map.set_value_from_xy_pos(10.1, -0.1, 1.0) |
| 19 | + grid_map.set_value_from_xy_pos(10.1, 1.1, 1.0) |
| 20 | + grid_map.set_value_from_xy_pos(11.1, 0.1, 1.0) |
| 21 | + grid_map.set_value_from_xy_pos(10.1, 0.1, 1.0) |
| 22 | + grid_map.set_value_from_xy_pos(9.1, 0.1, 1.0) |
| 23 | + |
| 24 | + self.assertEqual(True, True) |
| 25 | + |
| 26 | + def test_polygon_set(self): |
| 27 | + ox = [0.0, 20.0, 50.0, 100.0, 130.0, 40.0] |
| 28 | + oy = [0.0, -20.0, 0.0, 30.0, 60.0, 80.0] |
| 29 | + |
| 30 | + grid_map = GridMap(600, 290, 0.7, 60.0, 30.5) |
| 31 | + |
| 32 | + grid_map.set_value_from_polygon(ox, oy, 1.0, inside=False) |
| 33 | + |
| 34 | + self.assertEqual(True, True) |
| 35 | + |
| 36 | + |
| 37 | +if __name__ == '__main__': |
| 38 | + unittest.main() |
0 commit comments