更新 Spawn_Fahrzeuge_Nna.py

This commit is contained in:
Liyuan Zhu 2025-02-26 14:34:46 +00:00
parent d725a43610
commit 958e97c918

View File

@ -1,3 +1,4 @@
# Fahrzeugeimplementierung
import carla
import random
import time
@ -67,7 +68,7 @@ map_name = world.get_map().name
print("Loaded map name:", map_name)
# Vorfahrtregeln festlegen
# Define uncontrolled intersections (add more coordinates if needed)
INTERSECTION_ZONES = [
carla.Location(x=100, y=200, z=0),
@ -129,7 +130,7 @@ def manage_uncontrolled_intersections():
# The Code try to adjusts the position of two colliding vehicles to separate them.
collision_status = {} # Statut de collision entre véhicules
def has_collision(vehicle1, vehicle2):
@ -222,8 +223,12 @@ def communicate_with_other_vehicle(vehicle):
vehicle.stop()
other.move()
# detection la ligne d'arret en avance
# The code based of the speed and stop_time of vehicles
# check if vehicles has 0.0 m/s speed and
# stop_time ist more than 30 seconds
# that means the vehicle is blocked and
# will be removed
STOP_DISTANCE = 10 # Distance avant la ligne d'arrêt
def detect_stop_line(vehicle,stop_line_position):
@ -256,7 +261,7 @@ def ensure_correct_stop(vehicle):
# The code adjust the position of ambulance
# Classe représentant un camion
class Truck:
def __init__(self, vehicle):