Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions algorithms/hill_climb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion srunner/tools/metrics_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down