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:
Below is the simplified version of my main code:
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: