Merge pull request #1528 from carla-simulator/fix/rotuer_float_imprecision

Fixed out of domain input problem
This commit is contained in:
germanros1987 2019-04-11 10:36:52 -07:00 committed by GitHub
commit 4ec09d262e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -261,8 +261,8 @@ class GlobalRoutePlanner(object):
sv = select_edge['net_vector']
cross_list.append(np.cross(cv, sv)[2])
next_cross = np.cross(cv, nv)[2]
deviation = math.acos(np.dot(cv, nv) /\
(np.linalg.norm(cv)*np.linalg.norm(nv)))
deviation = math.acos(np.clip(
np.dot(cv, nv)/(np.linalg.norm(cv)*np.linalg.norm(nv)), -1.0, 1.0))
if not cross_list:
cross_list.append(0)
if deviation < threshold: