We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 119400e commit 9ec9a1fCopy full SHA for 9ec9a1f
SLAM/FastSLAM1/fast_slam1.py
@@ -60,15 +60,15 @@ def normalize_weight(particles):
60
61
sumw = sum([p.w for p in particles])
62
63
- if sumw <= 0.0000001:
+ try:
64
+ for i in range(N_PARTICLE):
65
+ particles[i].w /= sumw
66
+ except ZeroDivisionError:
67
for i in range(N_PARTICLE):
68
particles[i].w = 1.0 / N_PARTICLE
69
70
return particles
71
- for i in range(N_PARTICLE):
- particles[i].w /= sumw
-
72
73
74
0 commit comments