JuliaPOMDP / ParticleFilters.jl
Showing 1 of 1 files from the diff.

@@ -27,9 +27,9 @@
Loading
27 27
plt = plot_terrain_ac_particles(0,4,particles)
28 28
savefig(plt,"test_terrain.png")
29 29
"""
30 -
function plot_terrain_ac_particles(xpos,ypos,particles)
30 +
function plot_terrain_ac(xpos,ypos)
31 31
#@show "terrain plotter being called"
32 -
	X = xpos[1] - 0.6 .+ [-1,     -0.1,   -0.09,    0.3,  0.7, 0.8, 0.7, 0.3, -0.09,  -0.1, -1];
32 +
	X = xpos[1] - 0.6 .+ [-1,-0.1,-0.09,0.3,0.7,0.8,0.7, 0.3, -0.09,  -0.1, -1];
33 33
	Y = ypos .+ [-0.05, -0.05, -0.4, -0.05, -0.05,0, 0.05, 0.05, 0.4, 0.05, 0.05];
34 34
35 35
	# Here are the mountains
@@ -40,9 +40,9 @@
Loading
40 40
	# Call the ground function on the x locations that are deemed as mountain above
41 41
	Mountains = map.(ground,plotVectorMountains)
42 42
43 -
	plt = plot(plotVectorMountains,Mountains,leg=false) # Plot the terrain
44 -
	plot!(X,Y,leg=false) # Plot the aircraft
45 -
	scatter!(particles,4*ones(length(particles)),leg=false)
43 +
	plt = plot(plotVectorMountains,Mountains,label="Terrain") # Plot the terrain
44 +
	plot!(X,Y,label="Aircraft") # Plot the aircraft
45 +
	
46 46
	return plt
47 47
end
48 48
@@ -51,13 +51,12 @@
Loading
51 51
Take input array of plots and convert to gif animation
52 52
"""
53 53
function write_particles_gif(plots)
54 -
@show "Making gif"
54 +
	print("\n Making gif\n")
55 55
	frames = Frames(MIME("image/png"), fps=5)
56 56
	for plt in plots
57 -
	    print(".")
58 57
	    push!(frames, plt)
59 58
	end
60 -
	write("fjord.gif", frames)
59 +
	write("../img/Fjord/26June/fjord.mp4", frames)
61 60
	return nothing
62 61
end # End of the reel gif writing function
63 62
@@ -68,7 +67,7 @@
Loading
68 67
	dt = 0.1 # time step
69 68
70 69
	ypos = 4 # Height of the aircraft stays constant
71 -
	meas_stdev = 0.1
70 +
	meas_stdev = 2
72 71
	A = [1]
73 72
	B = [0]
74 73
	f(x, u, rng) = x #+ [1.0] # Investigating fixed state
@@ -77,39 +76,51 @@
Loading
77 76
78 77
	model = ParticleFilterModel{Vector{Float64}}(f, g)
79 78
80 -
	N = 1000  # Rpb: Was 1000 before
79 +
	N = 50  # Rpb: Was 1000 before
81 80
82 81
	filter_sir = SIRParticleFilter(model, N) # This was originally present
83 82
	filter_cem = CEMParticleFilter(model, N) # This is the cem filter
84 83
85 -
	b = ParticleCollection([[80.0*rand(1)[1]-40.0] for i in 1:N])
84 +
	b_sir = ParticleCollection([[80.0*rand(1)[1]-40.0] for i in 1:N])
85 +
	b_cem = b_sir
86 86
87 87
	x = [-25.0]
88 88
89 89
	plots = []
90 -
plt = plot_terrain_ac_particles(x,ypos,particles(b))
91 -
push!(plots,plt)
90 +
	
91 +
	plt = plot_terrain_ac(x,ypos)
92 +
	scatter!([p[1] for p in particles(b_sir)],[ypos for p in particles(b_sir)],label="SIR",xlim=(-30,30),color=:blue)
93 +
94 +
	scatter!([p[1] for p in particles(b_cem)],[ypos for p in particles(b_cem)],label="CEM",xlim=(-30,30),color=:green)
95 +
96 +
#	scatter!(particles(b_sir),4*ones(length(particles(b_sir))),label="SIR",xlim=(-30,30),color=:blue)
97 +
# 	scatter!(particles(b_cem),4*ones(length(particles(b_cem))),label="CEM",xlim=(-30,30),color=:green)
98 +
	push!(plots,plt)
92 99
	for i in 1:50    #RpB: was 100 before
93 -
	    print(".")
94 -
	    u = 1
95 -
	    x = f(x, u, rng)
96 -
#@show x
97 -
	    y = h(x, rng)
98 -
#@show y
99 -
	    b = update(filter_cem, b, u, y)
100 -
101 -
#@show particles(b)
100 +
		#print(".")
101 +
		u = 1
102 +
		x = f(x, u, rng)
103 +
		y = h(x, rng)
104 +
		b_sir = update(filter_sir, b_sir, u, y)
105 +
102 106
		# RpB: This is the update_cem
103 -
		#b_cem = update(filter_cem,b,u,y)
104 -
#@show particles(b_cem)
105 -
	    plt = plot_terrain_ac_particles(x,ypos,particles(b))
106 -
	    push!(plots, plt)
107 +
		b_cem = update(filter_cem,b_cem,u,y)
108 +
109 +
		plt = plot_terrain_ac(x,ypos)
110 +
111 +
	scatter!([p[1] for p in particles(b_sir)],[ypos for p in particles(b_sir)],label="SIR",xlim=(-30,30),color=:blue)
112 +
113 +
	scatter!([p[1] for p in particles(b_cem)],[ypos for p in particles(b_cem)],label="CEM",xlim=(-30,30),color=:green)
114 +
115 +
#		scatter!(particles(b_sir),4*ones(length(particles(b_sir))),label="SIR",xlim=(-30,30),color=:blue)
116 +
#		scatter!(particles(b_cem),4*ones(length(particles(b_cem))),label="CEM",xlim=(-30,30),color=:green)
117 +
	
118 +
		push!(plots, plt)
107 119
	end
108 120
	return plots
109 121
end # End of the runexp function
110 122
111 123
112 -
113 124
@show "Sandbox says: Calling runexp"
114 125
plots = runexp()
115 126
Files Coverage
src 20.76%
Project Totals (16 files) 20.76%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading