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

[question] Reading data from multiple Tello at the same time ?

Leon

New member
Joined
Jun 27, 2019
Messages
1
Reaction score
0
Hello,
I'm currently setting up an UAV swarm system with Tello.
So far, I'm able to send commends to two Tello at the same time,
using two WIFI interfaces(laptop built in WIFI and an USB WIFI adapter).
However, I can't mange to read their data at the same time.(only one at a time)
I thought it might be because there is only one port 8890 and port 11111,
so every time a new socket is established, the previous one would be erased.
Is there any solution to this problem?
or any workaround would be appreciated.

Thanks.


Below are the code of the socket setting part in my Tello class,
which is basically the tello.py in Tello-Python with minor adjustments:
Code:
        """

        wifi_spot is an argument

        set as ''wlp3s0' for PC bulit in WIFI,

        and 'wlxe84e0619c4ad' for USB  WIFI

        """

        #---------------Port setting---------------

        self.local_ip = ' '

        self.local_port = 8890

        self.local_video_port = 11111

        self.tello_ip='192.168.10.1'

        self.tello_port=8889

        self.tello_adderss = (self.tello_ip, self.tello_port)

        #---------------Socket setting---------------

        self.data_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        self.data_socket.setsockopt(socket.SOL_SOCKET, 25, wifi_spot.encode())     

        self.data_socket.bind((self.local_ip, self.local_port))



        self.video_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        self.video_socket.setsockopt(socket.SOL_SOCKET, 25, wifi_spot.encode())

        self.video_socket.bind((self.local_ip, self.local_video_port))

        #---------------Initiate---------------

        self.data_socket.sendto('command'.encode('utf-8'), self.tello_adderss)

        self.data_socket.sendto('streamon'.encode('utf-8'), self.tello_adderss)

        #---------------Threads---------------

        self.receive_thread = threading.Thread(target=self._receive_thread)

        self.receive_thread.daemon = True

        self.receive_thread.start()


        self.receive_video_thread = threading.Thread(target=self._receive_video_thread)

        self.receive_video_thread.daemon = True

        self.receive_video_thread.start()


Below is the simplified version of my main code:
Code:
def main1(wifi_spot):
    drone = tello.Tello(wifi_spot)
    while True:

            .

            .

        #sending commends, saving data to output.csv  and saving frames


def main2(wifi_spot):
    drone = tello.Tello(wifi_spot)
    while True:

            .

            .

        #sending commends, saving data to output.csv  and saving frames

if __name__ == "__main__":

    try:
        thread.start_new_thread( main1, ('wlp3s0', 'output1.csv', 'frame1'))
        thread.start_new_thread( main2, ('wlxe84e0619c4ad', 'output2.csv', 'frame2'))

    except:
        print "Error: unable to start thread"

    while True:
        pass
 
Last edited:
Hello,
I'm currently setting up an UAV swarm system with Tello.
So far, I'm able to send commends to two Tello at the same time,
using two WIFI interfaces(laptop built in WIFI and an USB WIFI adapter).
However, I can't mange to read their data at the same time.(only one at a time)
I thought it might be because there is only one port 8890 and port 11111,
so every time a new socket is established, the previous one would be erased.
Is there any solution to this problem?
or any workaround would be appreciated.

Thanks.


Below are the code of the socket setting part in my Tello class,
which is basically the tello.py in Tello-Python with minor adjustments:
Code:
        """

        wifi_spot is an argument

        set as ''wlp3s0' for PC bulit in WIFI,

        and 'wlxe84e0619c4ad' for USB  WIFI

        """

        #---------------Port setting---------------

        self.local_ip = ' '

        self.local_port = 8890

        self.local_video_port = 11111

        self.tello_ip='192.168.10.1'

        self.tello_port=8889

        self.tello_adderss = (self.tello_ip, self.tello_port)

        #---------------Socket setting---------------

        self.data_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        self.data_socket.setsockopt(socket.SOL_SOCKET, 25, wifi_spot.encode())   

        self.data_socket.bind((self.local_ip, self.local_port))



        self.video_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

        self.video_socket.setsockopt(socket.SOL_SOCKET, 25, wifi_spot.encode())

        self.video_socket.bind((self.local_ip, self.local_video_port))

        #---------------Initiate---------------

        self.data_socket.sendto('command'.encode('utf-8'), self.tello_adderss)

        self.data_socket.sendto('streamon'.encode('utf-8'), self.tello_adderss)

        #---------------Threads---------------

        self.receive_thread = threading.Thread(target=self._receive_thread)

        self.receive_thread.daemon = True

        self.receive_thread.start()


        self.receive_video_thread = threading.Thread(target=self._receive_video_thread)

        self.receive_video_thread.daemon = True

        self.receive_video_thread.start()


Below is the simplified version of my main code:
Code:
def main1(wifi_spot):
    drone = tello.Tello(wifi_spot)
    while True:

            .

            .

        #sending commends, saving data to output.csv  and saving frames


def main2(wifi_spot):
    drone = tello.Tello(wifi_spot)
    while True:

            .

            .

        #sending commends, saving data to output.csv  and saving frames

if __name__ == "__main__":

    try:
        thread.start_new_thread( main1, ('wlp3s0', 'output1.csv', 'frame1'))
        thread.start_new_thread( main2, ('wlxe84e0619c4ad', 'output2.csv', 'frame2'))

    except:
        print "Error: unable to start thread"

    while True:
        pass

Assuming I understand correctly what you're saying "there is only one port 8890 and port 11111". That's correct. There is only one UDP port 8890 and 11111 ON EACH DRONE. That means, if you have 5 drones, that's 5 pairs of ports, all on DIFFERENT IPs (you should have configured them via a router to autoconnect and get assigned a different IP, do note that tello typically doesn't show up on the list of devices and instead you have to scan the network to be able to find each tello's IP address).

But yes, once you have binded each IP address with its ports using UDP, you can give any random outgoing port from your system to bind each of the connections. Good examples would include anywhere from say port 8010-8999. The system typically auto-assigns an outgoing port so you'd probably not even have to do that, unless you want to specify I guess.
 
From what i know, to make a drone swarm you need to connect them all to the same wi-fi network as your machine (either making yourself the hotspot or using a standard router), after that the drones won't have the same IP as before, the ip will be given by the router (Usually via DHCP that give's 'random' IP each time) but if you want you can go to your router set up page usually on 192.168.1.0 and configure static IP for the drones so that you can recognize them again in the same way you did before with each drone with a single static IP
 
From what i know, to make a drone swarm you need to connect them all to the same wi-fi network as your machine (either making yourself the hotspot or using a standard router), after that the drones won't have the same IP as before, the ip will be given by the router (Usually via DHCP that give's 'random' IP each time) but if you want you can go to your router set up page usually on 192.168.1.0 and configure static IP for the drones so that you can recognize them again in the same way you did before with each drone with a single static IP

Thank you, I was wondering how this works and found your answer through the forum search.

I have an EDU and a friend has a normal Tello. Theoretically, we could make a little swarm by connecting the normal Tello and the PC to the EDU. Do you think this is possible? If so, what would be the IP address of the normal Tello? Any better idea than scanning the IP's with an IP scanner? (and being quick enough, as my EDU keeps shutting itself off when on the ground)
 

New Posts

Members online

No members online now.

Forum statistics

Threads
5,690
Messages
39,934
Members
17,023
Latest member
Repiv

New Posts