Introduction to formation flight with Tello edu (Python)

Introduction

I feel like I missed the times, but I tried a formation flight with tello. Many people are doing it, but I haven't seen many people who have done it in Python, so I will summarize it for myself.

Reference site

Thank you very much for the following articles / sites. Thank you very much. Connect to wifi access point using Tello Edu as a slave unit [python] Challenge formation flight with DJI's educational toy drone TELLO EDU (2)

Tello settings

I referred to Connecting to wifi access point using Tello Edu as a slave unit [python] presented in the previous section. Please see here as well.

Confirmation of ip address

I may be the only one, but I have a little understanding of ip and I got stuck here. I was wondering if I should just throw the command at 192.168.10.1, but it wasn't.

First, make the tello connect to a hotspot on your PC. Then qiita.png The IP address will be displayed like this, so let's check it. You can find it by pressing the win key and checking with Mobile Hotspot.

Actual program

import socket
import time

drone1 = '192.168.137.125'
drone2 = '192.168.137.17'

tello_port = 8889

#udp socket
socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
drone1_address = (drone1 , tello_port)
drone2_address = (drone2 , tello_port)

#Enter command mode
socket.sendto('command'.encode('utf-8'),drone1_address)
socket.sendto('command'.encode('utf-8'),drone2_address)


time.sleep(3)

#take off
socket.sendto('takeoff'.encode('utf-8'),drone1_address)
socket.sendto('takeoff'.encode('utf-8'),drone2_address)

time.sleep(0.1)

#landing
socket.sendto('land'.encode('utf-8'),drone1_address)
socket.sendto('land'.encode('utf-8'),drone2_address)

It settles in a very simple shape. This will accommodate any number of drones. As a caveat, as I mentioned earlier, I think that the ip of the drone is different (I'm sorry if it is different), so please check it yourself. Please. The challenge is that as the number of drones increases, the code gets messy. As a future issue, would it be cool if it could be broadcast? ?? I'm thinking.

Recommended Posts

Introduction to formation flight with Tello edu (Python)
Introduction to Python Image Inflating Image inflating with ImageDataGenerator
[Introduction to Python] Let's use foreach with Python
[Python] Introduction to CNN with Pytorch MNIST
[Python] Easy introduction to machine learning with python (SVM)
Introduction to Artificial Intelligence with Python 1 "Genetic Algorithm-Theory-"
Markov Chain Chatbot with Python + Janome (1) Introduction to Janome
Markov Chain Chatbot with Python + Janome (2) Introduction to Markov Chain
Introduction to Artificial Intelligence with Python 2 "Genetic Algorithm-Practice-"
Introduction to OpenCV (python)-(2)
Introduction to Python with Atom (on the way)
Introduction to Generalized Linear Models (GLM) with Python
[Introduction to Udemy Python3 + Application] 9. First, print with print
[Introduction to Python] How to iterate with the range function?
[Chapter 5] Introduction to Python with 100 knocks of language processing
An introduction to Python distributed parallel processing with Ray
Introduction to Mathematics Starting with Python Study Memo Vol.1
Reading Note: An Introduction to Data Analysis with Python
[Chapter 3] Introduction to Python with 100 knocks of language processing
[Chapter 2] Introduction to Python with 100 knocks of language processing
[Chapter 4] Introduction to Python with 100 knocks of language processing
Connect to BigQuery with Python
Introduction to Python Django (2) Win
Connect to Wikipedia with Python
Introduction to RDB with sqlalchemy Ⅰ
Introduction to serial communication [Python]
Switch python to 2.7 with alternatives
Write to csv with Python
[Introduction to Python] <list> [edit: 2020/02/22]
Introduction to Python (Python version APG4b)
An introduction to Python Programming
Introduction to Python For, While
Introduction to her made with Python ~ Tinder automation project ~ Episode 6
20200329_Introduction to Data Analysis with Python Second Edition Personal Summary
Introduction to her made with Python ~ Tinder automation project ~ Episode 5
Introduction to Python for VBA users-Calling Python from Excel with xlwings-
[Raspi4; Introduction to Sound] Stable recording of sound input with python ♪
[Introduction to Python] How to get data with the listdir function
[Introduction to Udemy Python3 + Application] 51. Be careful with default arguments
[Introduction to Udemy Python 3 + Application] 58. Lambda
[Introduction to Udemy Python 3 + Application] 31. Comments
Python: How to use async with
Link to get started with python
Introduction to Python Numerical Library NumPy
Practice! !! Introduction to Python (Type Hints)
[Introduction to Python3 Day 1] Programming and Python
[Python] Write to csv file with Python
Create folders from '01' to '12' with python
Nice to meet you with python
[Introduction to Python] <numpy ndarray> [edit: 2020/02/22]
[Introduction to Udemy Python 3 + Application] 57. Decorator
Try to operate Facebook with Python
Introduction to Python Hands On Part 1
[Introduction to Python3 Day 13] Chapter 7 Strings (7.1-7.1.1.1)
Output to csv file with Python
[Introduction to Python] How to parse JSON
[Introduction to Udemy Python 3 + Application] 56. Closure
[Introduction to Python3 Day 14] Chapter 7 Strings (7.1.1.1 to 7.1.1.4)
Introduction to Protobuf-c (C language ⇔ Python)
MP3 to WAV conversion with Python
To do tail recursion with Python2