forked from zhuli90799/Fahrsimulator
更新 Spawn_Fahrzeuge_Nna.py
This commit is contained in:
parent
d725a43610
commit
958e97c918
@ -1,3 +1,4 @@
|
|||||||
|
# Fahrzeugeimplementierung
|
||||||
import carla
|
import carla
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
@ -67,7 +68,7 @@ map_name = world.get_map().name
|
|||||||
print("Loaded map name:", map_name)
|
print("Loaded map name:", map_name)
|
||||||
|
|
||||||
|
|
||||||
|
# Vorfahrtregeln festlegen
|
||||||
# Define uncontrolled intersections (add more coordinates if needed)
|
# Define uncontrolled intersections (add more coordinates if needed)
|
||||||
INTERSECTION_ZONES = [
|
INTERSECTION_ZONES = [
|
||||||
carla.Location(x=100, y=200, z=0),
|
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
|
collision_status = {} # Statut de collision entre véhicules
|
||||||
|
|
||||||
def has_collision(vehicle1, vehicle2):
|
def has_collision(vehicle1, vehicle2):
|
||||||
@ -222,8 +223,12 @@ def communicate_with_other_vehicle(vehicle):
|
|||||||
vehicle.stop()
|
vehicle.stop()
|
||||||
other.move()
|
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
|
STOP_DISTANCE = 10 # Distance avant la ligne d'arrêt
|
||||||
|
|
||||||
def detect_stop_line(vehicle,stop_line_position):
|
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
|
# Classe représentant un camion
|
||||||
class Truck:
|
class Truck:
|
||||||
def __init__(self, vehicle):
|
def __init__(self, vehicle):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user