def start(): print('started') """ Starts sending commands to Tello. :param file_name: File name where commands are located. :return: None. """ start_time = str(datetime.now()) #with open(file_name, 'r') as f: #commands = f.readlines() commands = [ "command", "battery?", "takeoff", "delay 2", "left 25", "right 25", "command", "delay 2", "down 50", "delay 2", "land", "battery?" ] tello = Tello() for command in commands: #print("running thru commands") #if command != '' and command != '\n': #command = command.rstrip() #if there is a delay command if command.find('delay') != -1: sec = float(command.partition('delay')[2]) print(f'delay {sec}') time.sleep(sec) pass else: #if command == "streamon" or command == "streamoff": #tello.send_command(command, "cam") if 2 == 1: print("oh???") else: tello.send_command(command) #tello.send_command(command, "general") #print("asking for response") #response = tello.get_response() #print("Here is the drone response") #print(response) with open(f'log.{start_time}.txt', 'w') as out: log = tello.get_log() for stat in log: stat.print_stats() s = stat.return_stats() out.write(s)
start_time = str(datetime.now().strftime('%d%m%Y%H%M%S')) print("Time: " + start_time) file_name: str = './command.txt' print(file_name) 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/log_' + start_time + '.txt', 'x') for stat in log: stat.print_stats() str = stat.return_stats() out.write(str)
if input_cmd == "a": tello.send_command("takeoff") elif input_cmd == "b": tello.send_command("land") elif input_cmd == "c": tello.send_command("up 50") elif input_cmd == "d": tello.send_command("down 50") elif input_cmd == "e": tello.send_command("left 50") elif input_cmd == "f": tello.send_command("right 50") elif input_cmd == "g": tello.send_command("forward 50") elif input_cmd == "h": tello.send_command("back 50") elif input_cmd == "i": tello.send_command("cw 50") elif input_cmd == "j": tello.send_command("ccw 50") elif input_cmd == "k": tello.send_command("flip l") elif input_cmd == "l": tello.send_command("go 100 100 100 50") elif input_cmd == "m": tello.send_command("curve 100 100 100 500 500 500 50") else: tello.send_command(input_cmd) print_log(tello.get_log()) input_cmd = "" os.system("cls")