forked from AtsushiSakai/PythonRobotics
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_space_time_astar.py
More file actions
34 lines (26 loc) · 835 Bytes
/
test_space_time_astar.py
File metadata and controls
34 lines (26 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from PathPlanning.TimeBasedPathPlanning.GridWithDynamicObstacles import (
Grid,
ObstacleArrangement,
Position,
)
from PathPlanning.TimeBasedPathPlanning import SpaceTimeAStar as m
import numpy as np
import conftest
def test_1():
start = Position(1, 11)
goal = Position(19, 19)
grid_side_length = 21
grid = Grid(
np.array([grid_side_length, grid_side_length]),
obstacle_arrangement=ObstacleArrangement.ARRANGEMENT1,
)
m.show_animation = False
planner = m.SpaceTimeAStar(grid, start, goal)
path = planner.plan(False)
# path should have 28 entries
assert len(path.path) == 31
# path should end at the goal
assert path.path[-1].position == goal
assert planner.expanded_node_count < 1000
if __name__ == "__main__":
conftest.run_this_test(__file__)