Skip to content

Commit

Permalink
Fix memory corrupted size vs. prev_size (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
uhobeike authored Oct 31, 2023
1 parent 944fbc9 commit 57e0637
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ike_localization/src/mcl/resampling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ void Resampling::systematicSampling(std::vector<Particle> & particles)
std::vector<Particle> new_particles;
double systematic_sampling_start = calculateSystematicSamplingStart(1. / static_cast<double>(particle_size_));
double systematic_sampling_step = calculateSystematicSamplingStep();
while (new_particles.size() <= particle_size_) {
while (true) {
if (new_particles.size() == particle_size_) {
break;
}

if (systematic_sampling_start + step < particles_weight_sum[index]) {
new_particles.push_back(particles[index]);
step += systematic_sampling_step;
Expand Down

0 comments on commit 57e0637

Please sign in to comment.