-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
31 lines (24 loc) · 787 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import glob
import os
import sys
import time
import cv2
import random
try:
sys.path.append(glob.glob('../carla/PythonAPI/carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
import carla, re
client = carla.Client('127.0.0.1', 2000)
client.set_timeout(10.0)
world = client.get_world()
vehicle_blueprints = world.get_blueprint_library().filter('vehicle')
location = random.choice(world.get_map().get_spawn_points()).location
for bp in vehicle_blueprints:
transform = carla.Transform(location, carla.Rotation(yaw=-45.0))
vehicle = world.spawn_actor(bp, transform)
print("\"{}\",".format(vehicle.type_id))
vehicle.destroy()