Mentions légales du service

Skip to content
Snippets Groups Projects
Commit abcbfcce authored by AUTERNAUD Alex's avatar AUTERNAUD Alex
Browse files

optimal_path_2d stopping criteria

parent 853d5dc8
No related branches found
No related tags found
No related merge requests found
......@@ -103,8 +103,7 @@ def constraint_angle(angle, min_value=-np.pi, max_value=np.pi):
return new_angle
def optimal_path_2d(travel_time, starting_point, dx, coords, goal,
N=100, max_distance=None):
def optimal_path_2d(travel_time, starting_point, dx, coords, goal=None, max_d_orientation=None, N=100):
"""
Find the optimal path from starting_point to the zero contour
of travel_time. dx is the grid spacing
......@@ -163,9 +162,13 @@ def optimal_path_2d(travel_time, starting_point, dx, coords, goal,
for i in range(N):
# xp, vp = sym(x, v)
d = get_distance(x)
if ((max_distance is not None) and
(np.linalg.norm(goal - np.asarray(x)) < max_distance)):
d = get_distance(x)[0][0]
# if negative value d < 0, waypoint in an obstacle
if d < 0:
return False
# goal is implicit defined in the travel_time map but we need to test it explicitly because we can not really trust d
if ((goal is not None and max_d_orientation is not None) and
(np.linalg.norm(goal - np.asarray(x)) < max_d_orientation)):
if dl:
break
xl.append(x[0])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment