Skip to content

Commit 1d03241

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

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SLAM/FastSLAM2/fast_slam2.py

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

305305
dx = RFID[i, 0] - xTrue[0, 0]
306306
dy = RFID[i, 1] - xTrue[1, 0]
307-
d = math.sqrt(dx ** 2 + dy ** 2)
307+
d = math.hypot(dx, dy)
308308
angle = pi_2_pi(math.atan2(dy, dx) - xTrue[2, 0])
309309
if d <= MAX_RANGE:
310310
dn = d + np.random.randn() * Q_sim[0, 0] ** 0.5 # add noise

0 commit comments

Comments
 (0)