forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_bridge.py
executable file
·38 lines (26 loc) · 1009 Bytes
/
run_bridge.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
#!/usr/bin/env python
import argparse
from typing import Any
from multiprocessing import Queue
from openpilot.tools.sim.bridge.metadrive.metadrive_bridge import MetaDriveBridge
def parse_args(add_args=None):
parser = argparse.ArgumentParser(description='Bridge between the simulator and openpilot.')
parser.add_argument('--joystick', action='store_true')
parser.add_argument('--high_quality', action='store_true')
parser.add_argument('--dual_camera', action='store_true')
return parser.parse_args(add_args)
if __name__ == "__main__":
q: Any = Queue()
args = parse_args()
simulator_bridge = MetaDriveBridge(args)
p = simulator_bridge.run(q)
if args.joystick:
# start input poll for joystick
from openpilot.tools.sim.lib.manual_ctrl import wheel_poll_thread
wheel_poll_thread(q)
else:
# start input poll for keyboard
from openpilot.tools.sim.lib.keyboard_ctrl import keyboard_poll_thread
keyboard_poll_thread(q)
simulator_bridge.shutdown()
p.join()