調べていると DJITelloPy というモジュールが良さそうであることがわかりました。
とりあえず実行してみようと試みましたが、
今日は、SDK モードに入る command コマンドすらも上手く行かずに全くもって動かせず断念しました・・・
このままだと数日、エラーと戦うことになりそうな雰囲気を感じています。
今日の実行スクリプト
import cv2 from djitellopy import Tello tello = Tello() tello.connect() tello.streamon() frame_read = tello.get_frame_read() tello.takeoff() cv2.imwrite("picture.png", frame_read.frame) tello.land()
今日のエラー内容
[INFO] tello.py - 129 - Tello instance was initialized. Host: '192.168.10.1'. Port: '8889'. [INFO] tello.py - 438 - Send command: 'command' [ERROR] tello.py - 458 - 'utf-8' codec can't decode byte 0xcc in position 0: invalid continuation byte [INFO] tello.py - 438 - Send command: 'command' [INFO] tello.py - 462 - Response command: 'ok' Traceback (most recent call last): File "/home/zako/sources/tmp/tello/app.py", line 16, in <module> main() File "/home/zako/sources/tmp/tello/app.py", line 7, in main tello.connect() File "/home/zako/.anyenv/envs/pyenv/versions/tello/lib/python3.12/site-packages/djitellopy/enforce_types.py", line 54, in wrapper return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "/home/zako/.anyenv/envs/pyenv/versions/tello/lib/python3.12/site-packages/djitellopy/tello.py", line 547, in connect raise TelloException('Did not receive a state packet from the Tello') djitellopy.tello.TelloException: Did not receive a state packet from the Tello
Response command: ok
となっているので、コマンドは叩けているけど別のところでエラーになってそうな感じがありますね?
同じような問題に出会っている人が多そう
まとめ
Python のバージョンが高すぎるなどもあるでしょうか?とりあえずバッテリー情報が取得できることを目指しても良さそうですね。