mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
release grid based_sweep_coverage_path_planner.py
This commit is contained in:
@@ -39,7 +39,6 @@ class SweepSearcher:
|
||||
self.goaly = goaly
|
||||
|
||||
def move_target_grid(self, cxind, cyind, gmap):
|
||||
|
||||
nxind = self.moving_direction + cxind
|
||||
nyind = cyind
|
||||
|
||||
@@ -96,7 +95,8 @@ class SweepSearcher:
|
||||
self.update_turning_window()
|
||||
|
||||
def search_start_grid(self, grid_map):
|
||||
xinds = [], y_ind = 0
|
||||
xinds = []
|
||||
y_ind = 0
|
||||
if self.sweep_direction == self.SweepDirection.DOWN:
|
||||
xinds, y_ind = search_free_grid_index_at_edge_y(grid_map, from_upper=True)
|
||||
elif self.sweep_direction == self.SweepDirection.UP:
|
||||
@@ -191,7 +191,8 @@ def setup_grid_map(ox, oy, reso, sweep_direction, offset_grid=10):
|
||||
|
||||
grid_map.expand_grid()
|
||||
|
||||
xinds_goaly = [], goaly = 0
|
||||
xinds_goaly = []
|
||||
goaly = 0
|
||||
if sweep_direction == SweepSearcher.SweepDirection.UP:
|
||||
xinds_goaly, goaly = search_free_grid_index_at_edge_y(grid_map, from_upper=True)
|
||||
elif sweep_direction == SweepSearcher.SweepDirection.DOWN:
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import grid_based_sweep_coverage_path_planner
|
||||
|
||||
|
||||
class TestPlanning(TestCase):
|
||||
|
||||
def test_planning1(self):
|
||||
ox = [0.0, 20.0, 50.0, 100.0, 130.0, 40.0, 0.0]
|
||||
oy = [0.0, -20.0, 0.0, 30.0, 60.0, 80.0, 0.0]
|
||||
reso = 5.0
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.LEFT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.UP,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
def test_planning2(self):
|
||||
ox = [0.0, 50.0, 50.0, 0.0, 0.0]
|
||||
oy = [0.0, 0.0, 30.0, 30.0, 0.0]
|
||||
reso = 1.3
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.LEFT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.UP,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
def test_planning3(self):
|
||||
ox = [0.0, 20.0, 50.0, 200.0, 130.0, 40.0, 0.0]
|
||||
oy = [0.0, -80.0, 0.0, 30.0, 60.0, 80.0, 0.0]
|
||||
reso = 5.1
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.LEFT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.UP,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(ox, oy, reso,
|
||||
moving_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.MovingDirection.RIGHT,
|
||||
sweeping_direction=grid_based_sweep_coverage_path_planner.SweepSearcher.SweepDirection.DOWN,
|
||||
)
|
||||
self.assertTrue(len(px) >= 5)
|
||||
Reference in New Issue
Block a user