-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.py
55 lines (50 loc) · 1.55 KB
/
create.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import carla
import pygame
from src.ecarla.creator import ScenarioCreator
from typing import Any, Dict, List, Tuple, Callable
class CreateScenario():
"""Creates scenario.
"""
def __init__(
self,
client: Any,
resolution: Tuple[int, int],
out_path: str,
world_map: str = None,
world_weather: str = None,
vehicle_type: str = "vehicle.tesla.cybertruck",
record_start_time: float = 20.0,
record_delta_time: float = 60.0,
num_vehicles: int = None,
num_peds: int = None
) -> None:
# Create required actors for scenario creator
cam_transform = carla.Transform(
carla.Location(x=-5.5, z=2.8), carla.Rotation(pitch=-15)
)
sensors = [{
"name": "rgb",
"type": "sensor.camera.rgb",
"options": {},
"transform": cam_transform,
"converter": None
}]
# Run scenario creator
scenario_creator = ScenarioCreator(
client=client,
resolution=resolution,
out_path=out_path,
sensors=sensors,
start_time=0.0,
delta_time=0.04,
world_map=world_map,
world_weather=world_weather,
client_timeout=5.0,
init_sleep=0.0,
vehicle_type=vehicle_type,
record_start_time=record_start_time,
record_delta_time=record_delta_time,
num_vehicles=num_vehicles,
num_peds=num_peds
)
scenario_creator.loop()