-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
31 lines (24 loc) · 884 Bytes
/
main.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
import argparse
from selfcar.common import Vehicle, Tank, Driver
from selfcar.manual import ManualDriver
from selfcar.simulator import Simulator
parser = argparse.ArgumentParser(description='Some description.')
parser.add_argument('vehicle', default='vehicle')
parser.add_argument('driver', default='driver')
parser.add_argument('--file_name', dest='file_name', default='misc/simulator.mp4')
args = parser.parse_args()
if args.vehicle == 'tank':
vehicle = Tank()
elif args.vehicle == 'simulator':
vehicle = Simulator(args.file_name)
elif args.vehicle == 'vehicle':
vehicle = Vehicle()
else:
raise ValueError('Unknown vehicle type: {}'.format(args.vehicle))
if args.driver == 'manual':
driver = ManualDriver()
elif args.driver == 'driver':
driver = Driver()
else:
raise ValueError('Unknown driver type: {}'.format(args.driver))
driver.drive(vehicle)