From c308016208a317c523d8317c53686084fe4606bb Mon Sep 17 00:00:00 2001 From: David Gasinski Date: Tue, 9 Sep 2025 18:56:23 +0100 Subject: [PATCH 1/4] fixed incorrect scenario format within hillclimb --- algorithms/hill_climb.py | 2 +- srunner/tools/test_buffer.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 srunner/tools/test_buffer.txt diff --git a/algorithms/hill_climb.py b/algorithms/hill_climb.py index 0dbc1a5..bb1576a 100644 --- a/algorithms/hill_climb.py +++ b/algorithms/hill_climb.py @@ -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/test_buffer.txt b/srunner/tools/test_buffer.txt new file mode 100644 index 0000000..d9720b4 --- /dev/null +++ b/srunner/tools/test_buffer.txt @@ -0,0 +1 @@ +[{"timestamp": 6568.323070647, "value": 1},{"timestamp": 6569.324404588, "value": 2},{"timestamp": 6570.325707452, "value": 3},{"timestamp": 6571.327077733, "value": 4},{"timestamp": 6572.328110327, "value": 5},{"timestamp": 6573.329134138, "value": 6},{"timestamp": 6574.330370886, "value": 7},{"timestamp": 6575.331684624, "value": 8},{"timestamp": 6576.332867031, "value": 9},{"timestamp": 6577.334178855, "value": 10},] From 6441f40a63d059887961c828f4ada7c4c57c5db5 Mon Sep 17 00:00:00 2001 From: David Gasinski Date: Tue, 9 Sep 2025 18:56:43 +0100 Subject: [PATCH 2/4] removed test_buffer --- srunner/tools/test_buffer.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 srunner/tools/test_buffer.txt diff --git a/srunner/tools/test_buffer.txt b/srunner/tools/test_buffer.txt deleted file mode 100644 index d9720b4..0000000 --- a/srunner/tools/test_buffer.txt +++ /dev/null @@ -1 +0,0 @@ -[{"timestamp": 6568.323070647, "value": 1},{"timestamp": 6569.324404588, "value": 2},{"timestamp": 6570.325707452, "value": 3},{"timestamp": 6571.327077733, "value": 4},{"timestamp": 6572.328110327, "value": 5},{"timestamp": 6573.329134138, "value": 6},{"timestamp": 6574.330370886, "value": 7},{"timestamp": 6575.331684624, "value": 8},{"timestamp": 6576.332867031, "value": 9},{"timestamp": 6577.334178855, "value": 10},] From b0885e7bfe0546bb460d139081338a18bf8d9f62 Mon Sep 17 00:00:00 2001 From: David Gasinski Date: Wed, 10 Sep 2025 10:22:18 +0100 Subject: [PATCH 3/4] hillclimb; fixed IndexError if reached last waypoint --- algorithms/hill_climb.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/algorithms/hill_climb.py b/algorithms/hill_climb.py index bb1576a..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 From 55acf8c42a1b0b232ae830a642953bddcf384475 Mon Sep 17 00:00:00 2001 From: David Gasinski Date: Wed, 10 Sep 2025 10:25:03 +0100 Subject: [PATCH 4/4] removed daemon flag from MetricsCollector thread --- srunner/tools/metrics_collector.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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