Skip to content

Commit 1fcfa72

Browse files
committed
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/ClosedLoopRRTStar/closed_loop_rrt_star_car.py
1 parent 00f8fd3 commit 1fcfa72

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

PathPlanning/ClosedLoopRRTStar/closed_loop_rrt_star_car.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
"""
88

9-
import math
109
import os
1110
import sys
1211

@@ -119,9 +118,8 @@ def check_tracking_path_is_feasible(self, path):
119118
print("final angle is bad")
120119
find_goal = False
121120

122-
travel = sum([abs(iv) * unicycle_model.dt for iv in v])
123-
origin_travel = sum([math.sqrt(dx ** 2 + dy ** 2)
124-
for (dx, dy) in zip(np.diff(cx), np.diff(cy))])
121+
travel = unicycle_model.dt * sum(np.abs(v))
122+
origin_travel = sum(np.hypot(np.diff(cx), np.diff(cy)))
125123

126124
if (travel / origin_travel) >= self.invalid_travel_ratio:
127125
print("path is too long")

0 commit comments

Comments
 (0)