forked from dji-sdk/Tello-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtello_test.py
More file actions
32 lines (25 loc) · 695 Bytes
/
tello_test.py
File metadata and controls
32 lines (25 loc) · 695 Bytes
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
from tello import Tello
import sys
from datetime import datetime
import time
start_time = str(datetime.now())
file_name = sys.argv[1]
f = open(file_name, "r")
commands = f.readlines()
tello = Tello()
for command in commands:
if command != '' and command != '\n':
command = command.rstrip()
if command.find('delay') != -1:
sec = float(command.partition('delay')[2])
print 'delay %s' % sec
time.sleep(sec)
pass
else:
tello.send_command(command)
log = tello.get_log()
out = open('log/' + start_time + '.txt', 'w')
for stat in log:
stat.print_stats()
str = stat.return_stats()
out.write(str)