diff --git a/src/Active-Lane-Keeping-Assistant/agent.py b/src/Active-Lane-Keeping-Assistant/agent.py index 18a0706b7a..a3db79b20d 100644 --- a/src/Active-Lane-Keeping-Assistant/agent.py +++ b/src/Active-Lane-Keeping-Assistant/agent.py @@ -1,8 +1,8 @@ from __future__ import annotations +import os import matplotlib.pyplot as plt import numpy as np -import os class Agent(): """Agent that outputs the desired behaviour given @@ -128,7 +128,7 @@ def get_actions(self, detection_surface_area:float, """ if (self.check_surface_area(detection_surface_area)): steer = 0 - if len(self.errors) > 0: + if self.errors: self.errors.append(self.errors[-1]) else: self.errors.append(0) diff --git a/src/Active-Lane-Keeping-Assistant/world.py b/src/Active-Lane-Keeping-Assistant/world.py index 37b7d25488..1639fd8e67 100644 --- a/src/Active-Lane-Keeping-Assistant/world.py +++ b/src/Active-Lane-Keeping-Assistant/world.py @@ -109,7 +109,8 @@ def reset(self) -> tuple[float, float, np.ndarray, bool]: self.collision_sensor = self.world.spawn_actor(blueprint, carla.Transform(), attach_to=self.vehicle) self.collision_detected = False - self.collision_sensor.listen(lambda e: {self._set_collision()}) + # Remove redundant set brackets + self.collision_sensor.listen(lambda e: self._set_collision()) self.initialized = True return 0.0, 0.0, np.zeros((self.image_height, self.image_width, 3)), False