class AERPF(Block): """ Simple particle filter """ Block.alias('aer_pf') Block.input('track_log') Block.output('particles', 'All particles') Block.output('hps', 'A list of coherent hypotheses') Block.config('min_track_dist', 'Minimum distance between tracks') Block.config('max_vel', 'Maximum velocity') Block.config('max_bound', 'Largest size of the uncertainty') Block.config('max_hp', 'Maximum number of hypotheses to produce.') def init(self): params = dict(max_vel=self.config.max_vel, min_track_dist=self.config.min_track_dist, max_bound=self.config.max_bound) self.pdm = ParticleTrackerMultiple(**params) def update(self): tracks = self.input.track_log self.pdm.add_observations(tracks) particles = self.pdm.get_all_particles() if len(particles) > 0: self.output.particles = particles max_hp = self.config.max_hp hps = self.pdm.get_coherent_hypotheses(max_hp) self.output.hps = hps
def init(self): params = dict(max_vel=self.config.max_vel, min_track_dist=self.config.min_track_dist, max_bound=self.config.max_bound) self.pdm = ParticleTrackerMultiple(**params)