-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay_carla_env.py
62 lines (43 loc) · 1.25 KB
/
play_carla_env.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
56
57
58
59
60
61
62
import argparse
import logging
import os
import sys
import time
from pathlib import Path
import cv2
import numpy as np
from carla_env import carla_env_playground
# Save the log to a file name with the current date
# logging.basicConfig(filename=f"logs/sim_log_debug",level=logging.DEBUG)
logger = logging.getLogger(__name__)
def main(config):
c = carla_env_playground.CarlaEnvironment(
config={"render": True, "save": True, "save_video": True, "max_steps": 10000}
)
for k in range(config.num_episodes):
while not c.is_done:
c.step()
data_ = c.get_data()
c.render(bev_list=[data_[f"bev_{k}"] for k in range(3)])
time.sleep(0.1)
c.reset()
c.close()
return True
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Collect data from the CARLA simulator"
)
parser.add_argument(
"--data_save_path",
type=str,
default="./data/ground_truth_bev_model_test_data_2",
help="Path to save the data",
)
parser.add_argument(
"--num_episodes",
type=int,
default=10,
help="Number of episodes to collect data from",
)
config = parser.parse_args()
main(config)