Skip to content

Commit

Permalink
Bug Fix: Total particle weight becomes zero leading to infinity weigh…
Browse files Browse the repository at this point in the history
…ts of particles during further resampling
  • Loading branch information
nehagarg committed Sep 10, 2016
1 parent 8c433b8 commit c796361
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/belief.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,16 @@ void ParticleBelief::Update(int action, OBS_TYPE obs) {
for (int i = 0; i < initial_particles_.size(); i ++)
particles_.push_back(model_->Copy(initial_particles_[i]));
}

//Update total weight so that effective number of particles are computed correctly
total_weight = 0;
for (int i = 0; i < particles_.size(); i++) {
State* particle = particles_[i];
total_weight = total_weight + particle->weight;
}
}


double weight_square_sum = 0;
for (int i = 0; i < particles_.size(); i++) {
State* particle = particles_[i];
Expand Down

0 comments on commit c796361

Please sign in to comment.