-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.jl
57 lines (44 loc) · 1.21 KB
/
main.jl
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
include("lib/types.jl")
include("lib/astar.jl")
include("lib/maps.jl")
include("lib/ocv.jl")
# TODO: stepwise animation
# *----------------------------------------------------------------------------*
# Start And Goal
A::Point = (7, 10)
B::Point = (1, 5)
# Obstacle Map -> Distance Matrix
W::Matrix{Float64} = distMap(Maps.M1)
# Get Shortest Path
Z::MutableLinkedList{Point} = AStar(A, B, W)
# Visualization
cDraw(
Maps.M1 => :black, # Obstacles
Z => :yellow, # Result
A => :green, # Start
B => :red # Goal
) |> cPlot
# *----------------------------------------------------------------------------*
A, B = (1, 1), (11, 10)
W = distMap(Maps.M2)
Z = AStar(A, B, W)
cDraw(
Maps.M2 => :black, # Obstacles
Z => :yellow, # Result
A => :green, # Start
B => :red # Goal
) |> cPlot
# *----------------------------------------------------------------------------*
A, B = (2, 2), (80, 40)
W = distMap(Maps.M3)
Z = AStar(A, B, W)
S = cDraw(
Maps.M3 => :black, # Obstacles
Z => :yellow, # Result
A => :green, # Start
B => :red # Goal
)
# Plot With Specific Window Size
cPlot(S, (800, 400))
# Save Result To File
# cSave(S, "imgs/path.png")