-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathplanning.py
60 lines (53 loc) · 1.71 KB
/
planning.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import json
import csv
from re import split
def to_float(input: str):
return float(input) if input else 0.
steps = []
with open('planning/october.csv') as csv_file:
reader = csv.DictReader(csv_file)
fieldnames = reader.fieldnames
ground = None
for row in reader:
row_ground = split('[^a-z]', row['ground'])[0]
if ground is None:
ground = row_ground
if row_ground != ground:
ground = row_ground
steps.append({
'texts': ['a burst of flames, a flash of burning fire'],
'x_velocity': to_float(row['x']),
'y_velocity': to_float(row['y']),
'z_velocity': to_float(row['z']),
'pan_velocity': to_float(row['pan']),
'tilt_velocity': to_float(row['tilt']),
'roll_velocity': to_float(row['roll']),
'upscale': True,
'interpolate': True,
'epochs': 5,
'iterations': 150,
'transition': 5,
})
steps.append({
'texts': [row['text']],
'styles': ['%s | %s' % (row['ground'], row['style'])],
'x_velocity': to_float(row['x']),
'y_velocity': to_float(row['y']),
'z_velocity': to_float(row['z']),
'pan_velocity': to_float(row['pan']),
'tilt_velocity': to_float(row['tilt']),
'roll_velocity': to_float(row['roll']),
'upscale': True,
'interpolate': True,
'epochs': 42,
'iterations': 75,
})
print(json.dumps({
"spec": {
"videos": [
{
"steps": steps
}
]
}
}))