mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-02-16 23:25:46 -05:00
Replaced sqrt(x**2+y**2) with hypot in PathPlanning/ClosedLoopRRTStar/closed_loop_rrt_star_car.py
This commit is contained in:
@@ -6,7 +6,6 @@ author: AtsushiSakai(@Atsushi_twi)
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -119,9 +118,8 @@ class ClosedLoopRRTStar(RRTStarReedsShepp):
|
|||||||
print("final angle is bad")
|
print("final angle is bad")
|
||||||
find_goal = False
|
find_goal = False
|
||||||
|
|
||||||
travel = sum([abs(iv) * unicycle_model.dt for iv in v])
|
travel = unicycle_model.dt * sum(np.abs(v))
|
||||||
origin_travel = sum([math.sqrt(dx ** 2 + dy ** 2)
|
origin_travel = sum(np.hypot(np.diff(cx), np.diff(cy)))
|
||||||
for (dx, dy) in zip(np.diff(cx), np.diff(cy))])
|
|
||||||
|
|
||||||
if (travel / origin_travel) >= self.invalid_travel_ratio:
|
if (travel / origin_travel) >= self.invalid_travel_ratio:
|
||||||
print("path is too long")
|
print("path is too long")
|
||||||
|
|||||||
Reference in New Issue
Block a user