From d112c3bfeda699762ce79cab6c329d6b19d4daca Mon Sep 17 00:00:00 2001 From: Bernd Gassmann Date: Fri, 24 Sep 2021 10:13:06 +0200 Subject: [PATCH] Fix global route planner python agent Ensure waypoint.right_lane_marking/left_lane_marking exist before accessing --- PythonAPI/carla/agents/navigation/global_route_planner.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonAPI/carla/agents/navigation/global_route_planner.py b/PythonAPI/carla/agents/navigation/global_route_planner.py index 2e7f73af8..56c3b6de2 100644 --- a/PythonAPI/carla/agents/navigation/global_route_planner.py +++ b/PythonAPI/carla/agents/navigation/global_route_planner.py @@ -227,7 +227,7 @@ class GlobalRoutePlanner(object): if not segment['entry'].is_junction: next_waypoint, next_road_option, next_segment = None, None, None - if waypoint.right_lane_marking.lane_change & carla.LaneChange.Right and not right_found: + if waypoint.right_lane_marking and waypoint.right_lane_marking.lane_change & carla.LaneChange.Right and not right_found: next_waypoint = waypoint.get_right_lane() if next_waypoint is not None \ and next_waypoint.lane_type == carla.LaneType.Driving \ @@ -240,7 +240,7 @@ class GlobalRoutePlanner(object): exit_waypoint=next_waypoint, intersection=False, exit_vector=None, path=[], length=0, type=next_road_option, change_waypoint=next_waypoint) right_found = True - if waypoint.left_lane_marking.lane_change & carla.LaneChange.Left and not left_found: + if waypoint.left_lane_marking and waypoint.left_lane_marking.lane_change & carla.LaneChange.Left and not left_found: next_waypoint = waypoint.get_left_lane() if next_waypoint is not None \ and next_waypoint.lane_type == carla.LaneType.Driving \