9 def handler(event, sender, data, **args):
13 if event
is drone.EVENT_LOG_DATA:
15 path =
'%s/Desktop/tello-%s.csv' % (
17 datetime.datetime.now().strftime(
'%Y-%m-%d_%H%M%S'))
18 file = open(path,
'w')
20 file.write(
'%s\n' % data.format_cvs_header())
22 file.write(
'%s\n' % data.format_cvs())
23 if event
is drone.EVENT_FLIGHT_DATA
or event
is drone.EVENT_LOG_DATA:
24 print(
'record_log: %s: %s' % (event.name, str(data)))
29 drone.subscribe(drone.EVENT_FLIGHT_DATA, handler)
30 drone.subscribe(drone.EVENT_LOG_DATA, handler)
31 drone.record_log_data()
34 drone.wait_for_connection(60.0)
47 except Exception
as ex:
52 if __name__ ==
'__main__':
def handler(event, sender, data, args)