Skip to content

Commit 60387ee

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/DynamicWindowApproach/dynamic_window_approach.py
1 parent 367c2c6 commit 60387ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

PathPlanning/DynamicWindowApproach/dynamic_window_approach.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def main(gx=10.0, gy=10.0, robot_type=RobotType.circle):
279279
plt.pause(0.0001)
280280

281281
# check reaching goal
282-
dist_to_goal = math.sqrt((x[0] - goal[0]) ** 2 + (x[1] - goal[1]) ** 2)
282+
dist_to_goal = math.hypot(x[0] - goal[0], x[1] - goal[1])
283283
if dist_to_goal <= config.robot_radius:
284284
print("Goal!!")
285285
break

0 commit comments

Comments
 (0)