From 1408f6de53a57541263c3ba5da9d6ac1de571921 Mon Sep 17 00:00:00 2001 From: Guillermo Date: Fri, 2 Jul 2021 11:37:20 +0200 Subject: [PATCH] Minor fixes --- PythonAPI/carla/agents/navigation/global_route_planner.py | 6 ++++-- PythonAPI/carla/agents/navigation/local_planner.py | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/PythonAPI/carla/agents/navigation/global_route_planner.py b/PythonAPI/carla/agents/navigation/global_route_planner.py index a292fce0d..c467213fa 100644 --- a/PythonAPI/carla/agents/navigation/global_route_planner.py +++ b/PythonAPI/carla/agents/navigation/global_route_planner.py @@ -33,7 +33,9 @@ class GlobalRoutePlanner(object): This method traces a route between a starting and ending point. IF 'with_options' is True (deafult behavior), returns a list of [carla.Waypoint, RoadOption], being RoadOption a high level represnetation of what the direction of the route. - If 'with_options' is False, the road options are computed, returning a list of carla.Waypoint + If 'with_options' is False, the road options are computed, returning a list of carla.Waypoint. + This might be interseting, for example, when computing a route in chunks, getting all the waypoint + first and then adding the options :param origin (carla.Waypoint): starting point of the route :param destination (carla.Waypoint): ending point of the route @@ -120,7 +122,7 @@ class GlobalRoutePlanner(object): else: dot = 1 - if 0 < dot < math.cos(math.radians(45)): + if dot < math.cos(math.radians(45)): if lane_change_type: # Last lane change waypoint new_option = lane_change_type diff --git a/PythonAPI/carla/agents/navigation/local_planner.py b/PythonAPI/carla/agents/navigation/local_planner.py index 542898029..86174fe25 100644 --- a/PythonAPI/carla/agents/navigation/local_planner.py +++ b/PythonAPI/carla/agents/navigation/local_planner.py @@ -308,13 +308,13 @@ def _retrieve_options(list_waypoints, current_waypoint): # the beggining of an intersection, therefore the # variation in angle is small next_next_waypoint = next_waypoint.next(3.0)[0] - link = compute_connection(current_waypoint, next_next_waypoint) + link = _compute_connection(current_waypoint, next_next_waypoint) options.append(link) return options -def compute_connection(current_waypoint, next_waypoint, threshold=35): +def _compute_connection(current_waypoint, next_waypoint, threshold=35): """ Compute the type of topological connection between an active waypoint (current_waypoint) and a target waypoint (next_waypoint).