1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

TelloPyでTelloドローンをプログラム飛行した

Last updated at Posted at 2021-08-11

参考にしたサイト

実行画面

Terminal
electron@diynoMacBook-Pro Tello % pwd
/Users/electron/Desktop/MuAuan/Tello
electron@diyrofuminoMacBook-Pro Tello % 
Terminal
electron@diynoMacBook-Pro Tello % python3 tellopy_programmed_flight_wo_camera.py
Tello: 19:56:21.743:  Info: start video thread
========
Telloへの接続を開始します。(60秒間tryし続けます)
========
Tello: 19:56:21.744:  Info: send connection request (cmd="conn_req:9617")
Tello: 19:56:21.744:  Info: video receive buffer size = 524288
Tello: 19:56:21.744:  Info: state transit State::disconnected -> State::connecting
Tello: 19:56:21.758:  Info: LogData: UNHANDLED LOG DATA: id=   16, length=   4
Tello: 19:56:21.758:  Info: connected. (port=9617)
Tello: 19:56:21.758:  Info: send_time (cmd=0x46 seq=0x01e4)
Tello: 19:56:21.758:  Info: state transit State::connecting -> State::connected
========離陸します。========
Tello: 19:56:21.758:  Info: set altitude limit 30m
Tello: 19:56:21.759:  Info: takeoff (cmd=0x54 seq=0x01e4)
========3秒時間を置きます。========
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 1710, length=   6
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 1306, length=  22
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 1307, length=  16
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 1305, length=  37
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 2064, length=  64
Tello: 19:56:21.912:  Info: LogData: UNHANDLED LOG DATA: id= 2208, length=  40
Tello: 19:56:22.092:  Info: LogData: UNHANDLED LOG DATA: id= 1000, length=  44
Tello: 19:56:22.092:  Info: LogData: UNHANDLED LOG DATA: id= 1001, length=  16
Tello: 19:56:22.092:  Info: LogData: UNHANDLED LOG DATA: id=10086, length=   4
Tello: 19:56:22.093:  Info: LogData: UNHANDLED LOG DATA: id=10085, length=  80
Tello: 19:56:22.598:  Info: LogData: UNHANDLED LOG DATA: id= 1304, length=  34
Tello: 19:56:22.782:  Info: LogData: UNHANDLED LOG DATA: id=   12, length=  55
Tello: 19:56:22.985:  Info: LogData: UNHANDLED LOG DATA: id=10100, length=  21
Tello: 19:56:23.395:  Info: LogData: UNHANDLED LOG DATA: id= 1200, length=  24
Tello: 19:56:23.395:  Info: LogData: UNHANDLED LOG DATA: id= 1202, length=  33
Tello: 19:56:23.395:  Info: LogData: UNHANDLED LOG DATA: id= 1203, length=   7
Tello: 19:56:23.395:  Info: LogData: UNHANDLED LOG DATA: id= 1300, length= 137
Tello: 19:56:23.813:  Info: LogData: UNHANDLED LOG DATA: id= 1002, length=  27
Tello: 19:56:24.416:  Info: LogData: UNHANDLED LOG DATA: id= 1303, length=  64
========15前進します。========
Tello: 19:56:24.761:  Info: forward(val=15)
========3秒時間を置きます。========
========20右移動します。========
Tello: 19:56:27.764:  Info: right(val=20)
========3秒時間を置きます。========
========30上昇します。========
Tello: 19:56:30.766:  Info: up(val=30)
========3秒時間を置きます。========
========時計回りに90度回転します。========
Tello: 19:56:33.769:  Info: clockwise(val=90)
========着陸します。========
Tello: 19:56:33.769:  Info: land (cmd=0x55 seq=0x01e4)
========3秒時間を置きます。========
========drone.subscribe()します。========
========30droneインスタンスをquit()します。========
Tello: 19:56:36.772:  Info: quit
Tello: 19:56:36.772:  Info: state transit State::connected -> State::quit
Tello: 19:56:36.782:  Info: exit from the video thread.
Tello: 19:56:36.785:  Info: exit from the recv thread.
electron@diynoMacBook-Pro Tello % 

ソースコード

tellopy_programmed_flight_wo_camera.py
from time import sleep
import tellopy
import cv2
import av
import numpy

def handler(event, sender, data, **args):
    drone = sender
    #if event is drone.EVENT_FLIGHT_DATA:
    #    print(data)

def test():
    drone = tellopy.Tello()
    print("========\nTelloへの接続を開始します。(60秒間tryし続けます)\n========")
    drone.connect()
    drone.wait_for_connection(60.0)
    
    print("========離陸します。========")
    drone.takeoff()
    print("========3秒時間を置きます。========")
    sleep(3)
    print("========15前進します。========")
    drone.forward(15)
    print("========3秒時間を置きます。========")
    sleep(3)
    print("========20右移動します。========")
    drone.right(20)
    print("========3秒時間を置きます。========")
    sleep(3)
    print("========30上昇します。========")
    drone.up(30)
    print("========3秒時間を置きます。========")
    sleep(3)
    print("========時計回りに90度回転します。========")
    drone.clockwise(90)
    print("========着陸します。========")
    drone.land()
    print("========3秒時間を置きます。========")
    sleep(3)
    print("========drone.subscribe()します。========")
    drone.subscribe(drone.EVENT_FLIGHT_DATA, handler)
    print("========30droneインスタンスをquit()します。========")
    drone.quit()

if __name__ == '__main__':
    test()

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?