Skip to content

Commit 127d505

Browse files
committed
fix: harmonisation dans les constante et suppression de toute trace de pwm dans car (car géré par l'asservissement)
1 parent 7889a63 commit 127d505

2 files changed

Lines changed: 3 additions & 25 deletions

File tree

src/HL/Autotech_constant.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
MAX_SOFT_SPEED = 6000 # en milimetre par secondes
55
MIN_SOFT_SPEED = -4000
6-
MAX_ANGLE = 120
7-
MIN_ANGLE = 60
6+
MAX_ANGLE = 30
87
CRASH_DIST = 110
98
REAR_BACKUP_DIST = 100 #mm Distance at which the car will NOT reverse due to the obstacle behind it
109
LIDAR_DATA_AMPLITUDE = 1
@@ -15,20 +14,6 @@
1514
MODEL_PATH = os.path.join(script_dir, "model_CNN1D.onnx") # Allows the model to be loaded from the same directory as the script regardless of the current working directory (aka where the script is run from)
1615

1716

18-
PWM_PROP = {
19-
"direction_prop": 1,
20-
"pwm_stop_prop": 7.37,
21-
"point_mort_prop": 0.5,
22-
"delta_pwm_max_prop": 1.1 # PWM at which the maximum speed is reached
23-
}
24-
25-
PWM_DIR = {
26-
"direction": -1, # 1 for angle_pwm_min to the left, -1 for angle_pwm_min to the right
27-
"angle_pwm_min": 6.91,
28-
"angle_pwm_max": 10.7,
29-
"angle_pwm_centre": 8.805
30-
}
31-
3217
SOCKET_ADRESS = {
3318
"IP": '192.168.0.10',
3419
"PORT": 10940

src/HL/Car.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616

1717
# Import constants from HL.Autotech_constant to share them between files and ease of use
18-
from Autotech_constant import MAX_SOFT_SPEED, MAX_ANGLE, CRASH_DIST, MODEL_PATH, PWM_DIR, PWM_PROP, SOCKET_ADRESS, REAR_BACKUP_DIST, LIDAR_DATA_SIGMA, LIDAR_DATA_AMPLITUDE, LIDAR_DATA_OFFSET
18+
from Autotech_constant import MAX_SOFT_SPEED, MAX_ANGLE, CRASH_DIST, MODEL_PATH, SOCKET_ADRESS, REAR_BACKUP_DIST, LIDAR_DATA_SIGMA, LIDAR_DATA_AMPLITUDE, LIDAR_DATA_OFFSET
1919
from Driver import Driver
2020
from Lidar import Lidar
2121
from Camera import Camera
@@ -27,11 +27,6 @@ def __init__(self, driver):
2727
self.vitesse_milimetres_s = 0 # Speed in millimeters per second
2828
self.angle_degre = 0 # Steering angle in degrees
2929

30-
def _initialize_speed_limits():
31-
"""Set the car's speed limits."""
32-
self.vitesse_max_m_s_hard = 6000 # Maximum hardware speed
33-
self.vitesse_max_m_s_soft = MAX_SOFT_SPEED # Maximum software speed
34-
3530
def _initialize_ai():
3631
"""Initialize the AI session."""
3732
try:
@@ -73,8 +68,6 @@ def _initialize_tof():
7368
log.error(f"Error initializing ToF: {e}")
7469
raise
7570

76-
# Initialize speed limits
77-
_initialize_speed_limits()
7871

7972
# Initialize AI session
8073
_initialize_ai()
@@ -131,7 +124,7 @@ def turn_around(self):
131124

132125
self.set_vitesse_m_s(0)
133126
self.set_direction_degre(MAX_ANGLE)
134-
self.set_vitesse_m_s(-2)
127+
self.set_vitesse_m_s(-2) #blocing call
135128
time.sleep(1.8) # Wait for the car to turn around
136129
if self.camera.is_running_in_reversed():
137130
self.turn_around()

0 commit comments

Comments
 (0)