mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-01-14 01:28:23 -05:00
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/DynamicWindowApproach/dynamic_window_approach.py
This commit is contained in:
@@ -279,7 +279,7 @@ def main(gx=10.0, gy=10.0, robot_type=RobotType.circle):
|
||||
plt.pause(0.0001)
|
||||
|
||||
# check reaching goal
|
||||
dist_to_goal = math.sqrt((x[0] - goal[0]) ** 2 + (x[1] - goal[1]) ** 2)
|
||||
dist_to_goal = math.hypot(x[0] - goal[0], x[1] - goal[1])
|
||||
if dist_to_goal <= config.robot_radius:
|
||||
print("Goal!!")
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user