You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1009 B
38 lines
1009 B
#!/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()
|
|
|