Created
November 16, 2018 21:20
-
-
Save winding-lines/f17bcf849f370ecaf1038c8f6f7beeaa to your computer and use it in GitHub Desktop.
Generate png for AA228
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generate_output(pomdp, belief_updater) | |
@printf("Entering\n") | |
Random.seed!(2) | |
# reset the policy | |
p = ToEnd(0) # here, the argument sets the time-steps elapsed to 0 | |
# run the simulation | |
c = CairoRGBSurface(700, 500); | |
cr = CairoContext(c); | |
for (t, step) in enumerate(stepthrough(pomdp, p, belief_updater, max_steps=100)) | |
# @printf("timestep %d\n", t) | |
# the following lines render the room, the particles, and the roomba | |
set_source_rgb(cr,1,1,1) | |
paint(cr) | |
render(cr, pomdp, step) | |
# render some information that can help with debugging | |
# here, we render the time-step, the state, and the observation | |
move_to(cr,300,400) | |
show_text(cr, @sprintf("t=%d, state=%s, o=%.3f",t,string(step.s),step.o)) | |
write_to_png(c,@sprintf("output/main-%02d.png", t)); | |
sleep(0.1) # to slow down the simulation | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment