Skip to content

Commit e289d1f

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in Localization/ensemble_kalman_filter/ensemble_kalman_filter.py
1 parent f66a10f commit e289d1f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Localization/ensemble_kalman_filter/ensemble_kalman_filter.py

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

4545
dx = RFID[i, 0] - xTrue[0, 0]
4646
dy = RFID[i, 1] - xTrue[1, 0]
47-
d = math.sqrt(dx ** 2 + dy ** 2)
47+
d = math.hypot(dx, dy)
4848
angle = pi_2_pi(math.atan2(dy, dx) - xTrue[2, 0])
4949
if d <= MAX_RANGE:
5050
dn = d + np.random.randn() * Q_sim[0, 0] ** 0.5 # add noise

0 commit comments

Comments
 (0)