forked from dsadigh/driving-interactions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vis
executable file
·35 lines (33 loc) · 999 Bytes
/
vis
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
#!/usr/bin/env python
import sys
import getopt
import world
import theano as th
import visualize
th.config.optimizer_verbose = True
th.config.allow_gc = False
if __name__ == '__main__':
optlist, args = getopt.gnu_getopt(sys.argv, 'w:m:o:c:s:')
opts = dict(optlist)
filename = args[1]
if '-w' in opts:
the_world = getattr(world, opts['-w'])
else:
the_world = getattr(world, (filename.split('/')[-1]).split('-')[0])
the_world = the_world()
magnify = 1.
if '-m' in opts:
magnify = float(opts['-m'])
vis = visualize.Visualizer(0.2, name='Visualizer', magnify=magnify)
if '-o' in opts:
vis.camera_center = list(eval(opts['-o']))
if '-c' in opts:
colors = opts['-c'].split()
for i, c in enumerate(colors):
the_world.cars[i].color = c
if '-s' in opts:
output = opts['-s']
vis.output = output
vis.use_world(the_world)
vis.main_car = the_world.cars[0]
vis.run(filename)