Skip to content

Commit 02f14e4

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in SLAM/EKFSLAM/ekf_slam.py
1 parent f1926bd commit 02f14e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SLAM/EKFSLAM/ekf_slam.py

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

7777
dx = RFID[i, 0] - xTrue[0, 0]
7878
dy = RFID[i, 1] - xTrue[1, 0]
79-
d = math.sqrt(dx ** 2 + dy ** 2)
79+
d = math.hypot(dx, dy)
8080
angle = pi_2_pi(math.atan2(dy, dx) - xTrue[2, 0])
8181
if d <= MAX_RANGE:
8282
dn = d + np.random.randn() * Q_sim[0, 0] ** 0.5 # add noise

0 commit comments

Comments
 (0)