Skip to content

Commit c54b95a

Browse files
refator
1 parent 1680b66 commit c54b95a

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/HL/Car.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from Camera import Camera
1515

1616
class Car:
17-
def __init__(self, driving_strategy=Driver().farthest_distants):
17+
def __init__(self, driver):
1818
"""Initialize the car's components."""
1919

2020
def _initialize_speed_limits():
@@ -96,9 +96,7 @@ def _initialize_camera():
9696

9797
_initialize_camera()
9898

99-
self.driving = driving_strategy
100-
101-
99+
self.driver = driver
102100

103101
log.info("Car initialization complete")
104102

@@ -174,7 +172,7 @@ def main(self):
174172
lidar_data = self.lidar.rDistance
175173
camera_data = self.camera.camera_matrix() # just some random size
176174
t0 = time.time()
177-
angle, vitesse = self.driving(lidar_data, camera_data)
175+
angle, vitesse = self.driver.ai(lidar_data, camera_data)
178176
t = time.time()
179177
print("ai duration", t-t0)
180178

@@ -194,7 +192,7 @@ def main(self):
194192
log.info("Obstacle rouge détecté")
195193
if color == 1:
196194
log.info("Obstacle vert détecté")
197-
angle= -color*MAX_ANGLE*1.5
195+
angle= -color*MAX_ANGLE
198196
self.set_direction_degre(angle)
199197
self.recule()
200198

0 commit comments

Comments
 (0)