mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-14 05:08:04 -05:00
fix scanning error (#339)
This commit is contained in:
@@ -2,8 +2,10 @@ import os
|
||||
import sys
|
||||
from unittest import TestCase
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../PathPlanning/GridBasedSweepCPP")
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/../Mapping/grid_map_lib")
|
||||
sys.path.append(os.path.dirname(
|
||||
os.path.abspath(__file__)) + "/../PathPlanning/GridBasedSweepCPP")
|
||||
sys.path.append(
|
||||
os.path.dirname(os.path.abspath(__file__)) + "/../Mapping/grid_map_lib")
|
||||
try:
|
||||
import grid_based_sweep_coverage_path_planner
|
||||
except ImportError:
|
||||
@@ -14,88 +16,109 @@ grid_based_sweep_coverage_path_planner.do_animation = False
|
||||
|
||||
class TestPlanning(TestCase):
|
||||
|
||||
RIGHT = grid_based_sweep_coverage_path_planner.\
|
||||
SweepSearcher.MovingDirection.RIGHT
|
||||
LEFT = grid_based_sweep_coverage_path_planner. \
|
||||
SweepSearcher.MovingDirection.LEFT
|
||||
UP = grid_based_sweep_coverage_path_planner. \
|
||||
SweepSearcher.SweepDirection.UP
|
||||
DOWN = grid_based_sweep_coverage_path_planner. \
|
||||
SweepSearcher.SweepDirection.DOWN
|
||||
|
||||
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
|
||||
resolution = 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, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.LEFT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.UP,
|
||||
)
|
||||
self.assertGreater(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)
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(
|
||||
ox, oy, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.UP,
|
||||
)
|
||||
self.assertGreater(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
|
||||
resolution = 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, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.LEFT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.UP,
|
||||
)
|
||||
self.assertGreater(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)
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(
|
||||
ox, oy, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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)
|
||||
resolution = 5.1
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(
|
||||
ox, oy, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.LEFT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(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, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.UP,
|
||||
)
|
||||
self.assertGreater(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)
|
||||
px, py = grid_based_sweep_coverage_path_planner.planning(
|
||||
ox, oy, resolution,
|
||||
moving_direction=self.RIGHT,
|
||||
sweeping_direction=self.DOWN,
|
||||
)
|
||||
self.assertGreater(len(px), 5)
|
||||
|
||||
Reference in New Issue
Block a user