-
Notifications
You must be signed in to change notification settings - Fork 3
/
pytorcs.py
34 lines (28 loc) · 1.34 KB
/
pytorcs.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
import subprocess
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="pyTORCS: TORCS-based environment for simple autonomous driving simulations.")
parser.add_argument("--config", help="Path to the yaml config file.", default="config/sim_ddpg.yaml", type=str)
parser.add_argument("-v", "--verbose", help="Set verbose.", default=False, action="store_true")
parser.add_argument("--privileged", help="Set privileged. Attempts to solve the NVML runtime docker issue.", default=False, action="store_true")
parser.add_argument("-c", "--console", help="Your console of choice.", default="", type=str)
args = parser.parse_args()
launch_command = []
if args.console != "":
# konsole, xterm
execute = "-e"
if args.console == "terminator" or args.console == "gnome-terminal":
# terminator, gnome-terminal
execute = "-x"
launch_command.extend([args.console, execute])
launch_command.extend(["python", "driver/launch.py", "--config", args.config])
if args.verbose == True:
launch_command.append("--verbose")
if args.privileged == True:
launch_command.append("--privileged")
if args.console != "":
# detach
subprocess.Popen(launch_command)
else:
# synchronous
subprocess.call(launch_command)