Skip to content

Commit f1926bd

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in SLAM/FastSLAM2/fast_slam1.py
1 parent 1d03241 commit f1926bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SLAM/FastSLAM1/fast_slam1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def observation(xTrue, xd, u, RFID):
279279

280280
dx = RFID[i, 0] - xTrue[0, 0]
281281
dy = RFID[i, 1] - xTrue[1, 0]
282-
d = math.sqrt(dx ** 2 + dy ** 2)
282+
d = math.hypot(dx, dy)
283283
angle = pi_2_pi(math.atan2(dy, dx) - xTrue[2, 0])
284284
if d <= MAX_RANGE:
285285
dn = d + np.random.randn() * Qsim[0, 0] ** 0.5 # add noise

0 commit comments

Comments
 (0)