-
Notifications
You must be signed in to change notification settings - Fork 0
/
simu_test.jl
35 lines (28 loc) · 1.02 KB
/
simu_test.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
include("UAVLanding.jl")
include("visual.jl")
POMCPOW_solver = POMCPOWSolver(max_depth = 1000, # the deeper, the more oscillations on heading angles.
tree_queries=1000,
criterion=MaxUCB(10.0),
enable_action_pw=true,
check_repeat_obs=false,
rng=MersenneTwister(2))
my_pomdp = UAVchasePOMDP()
policyPOMCPOW = POMCPOWPlanner(POMCPOW_solver, my_pomdp)
hr = HistoryRecorder(show_progress=true, max_steps=400)
up = SIRParticleFilter(my_pomdp, 400)
hist = simulate(hr, my_pomdp, policyPOMCPOW, up)
# view the simulation history:
# for (s, b, a, r, sp, o) in view(hist, 145:145)
# @show s, a, r, o
# end
print(" Number of steps: ")
print(length(hist))
# plot a static plot showing the UAV and target trace:
# plt_static = plot3d(my_pomdp, hist)
# create a gif
gr()
frames = Frames(MIME("image/png"), fps=5)
@showprogress "Creating gif..." for i in 1:30
push!(frames, plot3d(my_pomdp, view(hist, 1:i)))
end
write("out.gif", frames)