diff --git a/algorithms/hill_climb.py b/algorithms/hill_climb.py index 0dbc1a5..49a3480 100644 --- a/algorithms/hill_climb.py +++ b/algorithms/hill_climb.py @@ -23,10 +23,10 @@ def _scenario_callback( # pass in route id waypoints = scenario_definition["routes"][0]["route"]["waypoints"] - if self.prev_ds is not None: - if not driving_score >= self.prev_ds: - if self.waypoint_index == 0: - previouse_index = len(waypoints) + if self.prev_ds is not None: # not first run + if not driving_score >= self.prev_ds: # worse DS + if self.waypoint_index == 0: # if spawn point + previouse_index = len(waypoints) - 1 # pick last point else: previouse_index = self.waypoint_index - 1 waypoints[previouse_index] = self.prev_waypoints @@ -40,7 +40,7 @@ def _scenario_callback( self.prev_waypoints = waypoints[self.waypoint_index] - if self.waypoint_index + 1 > len(waypoints): + if self.waypoint_index + 1 >= len(waypoints): self.waypoint_index = 0 else: self.waypoint_index += 1 @@ -70,7 +70,7 @@ def __find_new_neighbour_point(self, current_point: dict) -> dict: else: random_point = random.choice(points_in_radius) - return {"positions": {"x": random_point[0], "y": random_point[1]}} + return {"position": {"x": random_point[0], "y": random_point[1], "z": 0.0}} def __get_all_lanelet_points(self) -> set[tuple[int, int]]: map = lanelet2.io.load(self.lanelet_path, lanelet2.io.Origin(0, 0)) diff --git a/srunner/tools/metrics_collector.py b/srunner/tools/metrics_collector.py index a5fff7f..1471ef2 100644 --- a/srunner/tools/metrics_collector.py +++ b/srunner/tools/metrics_collector.py @@ -80,7 +80,7 @@ def fetch_state(cls) -> Any: @classmethod def _start_thread(cls) -> None: cls._running = True - cls._thread = threading.Thread(target=cls._thread_target, daemon=True) + cls._thread = threading.Thread(target=cls._thread_target) cls._thread.start() @classmethod