Hello Tello!
Join our DJI Tello community & remove this banner.
Sign up

Tello Drone Swarm

Joined
May 4, 2018
Messages
5
Likes
4
#1
Hello i plan to do a drone swarm with tello drones.

All tello drones have address (192.168.10.1, 8889), how can i change the second tello's to say 192.168.10.2 ?

Note: We are using multiple USB wifi adapters to connect to all the drones we have.

EDIT: It is possible to create a drone swarm using multiple Wifi usb adapters. Video:
 
Last edited:
Joined
May 4, 2018
Messages
5
Likes
4
#3
interested as well
I was able to control multiple drones by using the computers built in wifi and an additional usb wifi adapter. You need to be connected to both drones.

Put the following code into (.py) files and run the python files through the terminal. I am not a network computer scientist, my B.Eng was in systems engineering so i dont know much about this.

Here is code to take off:

import socket
import time


sock1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock1.setsockopt(socket.SOL_SOCKET, 25, 'wlp3s0'.encode())


sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock2.setsockopt(socket.SOL_SOCKET, 25, 'wlx00e04c12c93d'.encode())


sock1.sendto('command'.encode(), 0, ('192.168.10.1', 8889))
sock2.sendto('command'.encode(), 0, ('192.168.10.1', 8889))


sock1.sendto('takeoff'.encode(), 0, ('192.168.10.1', 8889))
sock2.sendto('takeoff'.encode(), 0, ('192.168.10.1', 8889))


Code to land:

import socket
import time


sock1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock1.setsockopt(socket.SOL_SOCKET, 25, 'wlp3s0'.encode())


sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock2.setsockopt(socket.SOL_SOCKET, 25, 'wlx00e04c12c93d'.encode())


sock1.sendto('command'.encode(), 0, ('192.168.10.1', 8889))
sock2.sendto('command'.encode(), 0, ('192.168.10.1', 8889))


sock1.sendto('land'.encode(), 0, ('192.168.10.1', 8889))
sock2.sendto('land'.encode(), 0, ('192.168.10.1', 8889))



To run a python file type "python <nameoffile>.py" into the terminal or try "sudo python <nameoffile>.py". Let me know if it works. Im on Ubuntu Linux 16.04.
 
Joined
May 4, 2018
Messages
5
Likes
4
#4
wlp3s0 and wlx00e04c12c93d are network interfaces, they are probably different for you. Go into terminal and type in ifconfig and copy and paste the strings as they are for you.
 

redruff

Active member
Joined
Apr 26, 2018
Messages
35
Likes
13
#5
Wow....thank you!
Man I'm at a crux..
I've been playing with:

DroneBlocks/Scratch
GoBot
and now Python....

I think I gotta pick one and stick with a language! I'm leaning towards python.
On the bright side, it is exciting to see so much SDK development so quickly with this drone.
 
Joined
May 4, 2018
Messages
5
Likes
4
#6
Wow....thank you!
Man I'm at a crux..
I've been playing with:

DroneBlocks/Scratch
GoBot
and now Python....

I think I gotta pick one and stick with a language! I'm leaning towards python.
On the bright side, it is exciting to see so much SDK development so quickly with this drone.
You are welcome. My professor purchased 5 wifi usb adapters & 5 tello drones. I will let everyone here know how the drone swarm goes.

Also you can edit the standard Tello3.py code that is provided by Ryze to make it work with multiple drones very easily. You can make the drones do everything such as flip together and so on all in one .py file.
 

zhaoshirong

Well-known member
Joined
Apr 8, 2018
Messages
45
Likes
3
#7
But you still need one drone per network interface.
What we do need is what you asked for originally, to be able to change the IP address of a drone so we can control multiple drones from one network interface.
 
Joined
May 4, 2018
Messages
5
Likes
4
#8
But you still need one drone per network interface.
What we do need is what you asked for originally, to be able to change the IP address of a drone so we can control multiple drones from one network interface.
Yes that would be a better solution. My goal was to make a drone swarm. I couldn't figure out how to change the IP unfortunately.
 

yiupa

New member
Joined
May 8, 2018
Messages
4
Likes
5
#10
Yes that would be a better solution. My goal was to make a drone swarm. I couldn't figure out how to change the IP unfortunately.

DJI had just announced a new one 'tello edu' intended for educational purpose.
大疆创新针对企业级用户推出Tello Edu教育编程无人机 进军STEAM教育市场 (in Chinese)
DJI - The World Leader in Camera Drones/Quadcopters for Aerial Photography (in English)
1) a new drone, may be the same hardware but different firmware, 2) a different app
One paragraph inside in Chinese when translated to English is:

"Tello EDU supports Wi-Fi AP mode, which overturns the common one-to-one control mode, enabling multiple Tello Edus to connect to a WiFi router at the same time, receive computer instructions from the same subnet and provide feedback, thus achieving multi-machine status Synchronization, collaborative control. It is easier for students to achieve multi-machine formation flight while providing the technical basis for team games, multi-machine confrontation and other competition methods in the design of competitions."

They said more information will be announced in June. It is OK to use multiple wifi interface to control multiple tello and this may be the only way by now.
 

dce126

New member
Joined
May 16, 2018
Messages
2
Likes
0
#11
Does anyone know how to find out what the names of the network devices are on windows for this python script?

sock1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock1.setsockopt(socket.SOL_SOCKET, 25, 'wlp3s0'.encode())

sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock2.setsockopt(socket.SOL_SOCKET, 25, 'wlx00e04c12c93d'.encode())
 

TerryKim

New member
Joined
Jul 31, 2018
Messages
1
Likes
0
#13
I am also carrying out a mission using the Tello drone about drone swarm. Many people are developing on Linux, but we want to use it on Windows.
When Python has coded as mentioned above, it is difficult to set the name of the network devices.
How should I name my network devices in Windows?

Python:
# This example script demonstrates how use Python to create custom flight behaviors with Tello
# This script is part of our course on Tello drone programming
# https://learn.droneblocks.io/p/tello-drone-programming-with-python/

# Import the necessary modules
import socket
import threading
import time

# IP and port of Tello
tello_address1 = ('192.168.10.1', 8889)
tello_address2 = ('192.168.10.1', 8889)

# IP and port of local computer
local_address1 = ('', 9000)
local_address2 = ('', 9000)

# Create a UDP connection that we'll send the command to
sock1 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock1.setsockopt(socket.SOL_SOCKET, 25, 'wlan0')
sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock2.setsockopt(socket.SOL_SOCKET, 25, 'wlp2s0')

# Bind to the local address and port
sock1.bind(local_address1)

# Send the message to Tello and allow for a delay in seconds
def send(message, delay):
  # Try to send the message otherwise print the exception
  try:
    sock1.sendto(message.encode(), tello_address1)
    sock2.sendto(message.encode(), tello_address2)
    print("Sending message: " + message)
  except Exception as e:
    print("Error sending: " + str(e))

  # Delay for a user-defined period of time
  time.sleep(delay)

# Receive the message from Tello
def receive():
  # Continuously loop and listen for incoming messages
  while True:
    # Try to receive the message otherwise print the exception
    try:
      response, ip_address1 = sock1.recvfrom(128)
      response, ip_address2 = sock2.recvfrom(128)
      print("Received message: " + response.decode(encoding='utf-8'))
    except Exception as e:
      # If there's an error close the socket and break out of the loop
      sock1.close()
      sock2.close()
      print("Error receiving: " + str(e))
      break

# Create and start a listening thread that runs in the background
# This utilizes our receive functions and will continuously monitor for incoming messages
receiveThread = threading.Thread(target=receive)
receiveThread.daemon = True
receiveThread.start()

def command():
  send("command", 3)
# Initiate command mode and takeoff
def takeoff():
  send("takeoff", 5)

# Land
def land():
  send("land", 5)

# Tello commands respond with an OK when sucessful. This means Tello recognizes
# the command, but the instruction hasn't completed. OK is Tello saying "I got
# the message" but not necessarily saying "I completed the command"
# This means we need to calculate how long the spin will take before we execute the next command.
# Based on our tests a single 360 rotation takes 7 seconds. We'll use this in our spin function to delay
# before the next command. Your rotation time may vary. You can calculate this by
# sending a "cw 360" or "ccw 360" command and measuring the rotation time.

# 7 seconds per rotation
rotationTime = 7

# Spin right or left X number of times
def spin(direction, times):
  # One rotation is 360 degrees
  oneRotation = 360

  # Convert the number of rotations to degrees
  rotations = oneRotation * times

  # Calculate the delay to let the spin function complete
  delay = rotationTime * times

  # Spin right (cw) or left (ccw)
  if (direction == "right"):
    send("cw " + str(rotations), delay)
  elif (direction == "left"):
    send("ccw " + str(rotations), delay)

# Use 20 cm/sec as vertical speed
verticalSpeed = 20.0

def bounce(distance, times):

  bounceDelay = distance/verticalSpeed

  for i in range(times):
    send("down " + str(distance), bounceDelay)
    send("up " + str(distance), bounceDelay)
    
command()
# Takeoff
takeoff()

# Spin right 2 times
#spin("right", 2)

# Bounce up and down 60 cm and repeat 3 times
#bounce(60, 3)

# Spin left 3 times
#spin("left", 3)

# Land
land()

# Close the socket
sock1.close()
sock2.close()
 
Last edited:

New Threads

Forum statistics

Threads
1,124
Messages
7,318
Members
2,381
Latest member
lloydpearsoniv