Skip to content

Commit

Permalink
Add animation movie support
Browse files Browse the repository at this point in the history
  • Loading branch information
petercorke committed Apr 18, 2019
1 parent c0b95c1 commit 64c0cb7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions ParticleFilter.m
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
opt.seed = [];
opt.history = true;
opt.x0 = [];
opt.movie = [];



opt = tb_optparse(opt, varargin);
Expand Down Expand Up @@ -203,10 +203,8 @@
if opt.x0
pf.x0 = opt.x0;
end


if ~isempty(opt.movie)
pf.anim = Animate(opt.movie);
end
end


Expand Down Expand Up @@ -249,8 +247,11 @@ function run(pf, niter, varargin)
% cleared.

opt.plot = true;
opt.movie = [];
opt = tb_optparse(opt, varargin);

anim = Animate(opt.movie);

pf.init();
pf.sensor.map.plot();
a = axis;
Expand All @@ -263,15 +264,15 @@ function run(pf, niter, varargin)
set(pf.h, 'Tag', 'particles');

pf.robot.plot();

if ~isempty(pf.anim)
pf.anim.add();
end

% iterate over time
for i=1:niter
pf.step(opt);
anim.add();

end

anim.close();
end

function step(pf, opt)
Expand Down

0 comments on commit 64c0cb7

Please sign in to comment.