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

Python socket dying after takeoff command?

alerus

New member
Joined
Jan 1, 2021
Messages
2
Reaction score
0
Hi,

I'm experiencing an odd issue when connecting to the Tello over UDP sockets in Python in which the Tello stops responding to my commands. First here's what does work:

- I can successfully send a "command" message to start the SDK (and in fact receive an "ok" message) in response.
- I can poll the state data from port 8890 successfully and indefinitely.
- I can send the takeoff command and have it takeoff.

However, no command works after I send the "takeoff" message and I never receive an "ok" message in response to that command.

Perhaps most fascinating, however, is that if I use an application like packetsender for mac to send the message "land" (or anything else) after I've sent "command" and "takeoff" from my python socket, it *will* listen to the packetsender message. So this is rather confusing. Somehow my socket connection for commands must be dying?

In effort to simplify the process for debugging I simplified my code to the following (without any response reading for simplicity):

Python:
SINGLE_TELLO_IP = "192.168.10.1"
COMMAND_PORT: int = 8889
    
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

print("Send command")
s.sendto(b"command", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

print("Send takeoff")
s.sendto(b"takeoff", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

print("Attempting to send land command -- this won't work")
s.sendto(b"land", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

And this fails. I've tried repeatedly sending land in a loop in case there were drops or delays with no success.

I tried to get the SDK on my Tello with the "sdk?" message, but it tells me that's an unknown command so I'm not sure what to make of that :p

Does anyone with experience controlling in python see any obvious problems with the above simple code or why it might suddenly fail to receive my messages (yet still work if I send the message from a different network tool)?
 
We have limited experience with this and python programming. Mostly good at copy and post others programs . We had it working with a program by Dave Baldwin from github and youtube on swarm drones. It has the socket commands in it. All that we did was change the last part of the program an inserted mission Tello commands. You can see it working on our youtube channel mecatx with i believe with a Crowpi.
We have used it with other Pi's also. I can probably find the script and send it to you, if you can not find it. We did this last summer. I can be reached at [email protected]. Good luck.
 
We have limited experience with this and python programming. Mostly good at copy and post others programs . We had it working with a program by Dave Baldwin from github and youtube on swarm drones. It has the socket commands in it. All that we did was change the last part of the program an inserted mission Tello commands. You can see it working on our youtube channel mecatx with i believe with a Crowpi.
We have used it with other Pi's also. I can probably find the script and send it to you, if you can not find it. We did this last summer. I can be reached at [email protected]. Good luck.

Thanks Dan! I think I'm actually on to the issue after more prodding. It looks like the take-off command will eventually send an "ok" response, and it only responds to new commands if they are sent *after* it replies with ok. The problem is the ok response (presumably when it thinks it's "done" taking off) can be exceedingly slow, often longer than 8 seconds. This is a concerning delay for the command because if you don't send commands for 15 seconds, it auto lands and the 15-second clock seems to start when you last *sent* the command., rather than when the last command completed. Makes me worry it will on an occasion just eat all the time before it replies with ok. We'll see.

If this explanation is correct, then the reason I was able to subsequently send the land command after my program closed with something like packetsender is probably because by the time I got over to the app, the necessary long completion time had probably elapsed.

I'll do some more prodding to verify this and reply back in case anyone else runs into similar issues.
 
Hi,

I'm experiencing an odd issue when connecting to the Tello over UDP sockets in Python in which the Tello stops responding to my commands. First here's what does work:

- I can successfully send a "command" message to start the SDK (and in fact receive an "ok" message) in response.
- I can poll the state data from port 8890 successfully and indefinitely.
- I can send the takeoff command and have it takeoff.

However, no command works after I send the "takeoff" message and I never receive an "ok" message in response to that command.

Perhaps most fascinating, however, is that if I use an application like packetsender for mac to send the message "land" (or anything else) after I've sent "command" and "takeoff" from my python socket, it *will* listen to the packetsender message. So this is rather confusing. Somehow my socket connection for commands must be dying?

In effort to simplify the process for debugging I simplified my code to the following (without any response reading for simplicity):

Python:
SINGLE_TELLO_IP = "192.168.10.1"
COMMAND_PORT: int = 8889
   
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

print("Send command")
s.sendto(b"command", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

print("Send takeoff")
s.sendto(b"takeoff", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

print("Attempting to send land command -- this won't work")
s.sendto(b"land", (SINGLE_TELLO_IP, COMMAND_PORT))
time.sleep(2.)

And this fails. I've tried repeatedly sending land in a loop in case there were drops or delays with no success.

I tried to get the SDK on my Tello with the "sdk?" message, but it tells me that's an unknown command so I'm not sure what to make of that :p

Does anyone with experience controlling in python see any obvious problems with the above simple code or why it might suddenly fail to receive my messages (yet still work if I send the message from a different network tool)?
I think your problem is that you are not waiting long enough... Try 6 seconds...
 
Hello again. i found the original program with comments by Dave Baldwin, and a few of our modified programs that work for us. to do a square, keyboard commands etc. It include receive commands and imports treading. I can send them email to you. [email protected]
 
Hi,

just joined the forum as I'm facing exactly the same issues like Alerus reported. I'm using the SDK 1.3.0.0 with my ordinary Tello drone (not the Tello Edu!) with an ESP8266 under Arduino.
Repeatedly polling UDP packets results in wait times up to 10 seconds before I receive an 'ok' after sending 'takeoff'. But, it can be as 'fast' as 6 secs, too. It seems to depend on the ambient light and the surface pattern the Tello is started on. I assume the drone will not send an 'ok' until the firmware gets all checkmarks from its sensors, i.e. the downward facing 'obstacle/pattern' sensor, the barometer, etc. that the drone is hovering perfectly, i.e. 'takeoff' command mission completed.
The same I observed when issueing a 'land' command. Auto-Landing is initiated immediately, but 'ok' is sent only once the drone has landed and props shut off.

I wonder how others dealt with that. This can make your drone mission pretty slow, unless you're flying above perfect ground in good ambient light conditions.

Finally, a note to the 'sdk?' command not working: this command only works with SDK 2.0. And SDK 2.0 only works on the Tello Edu. Too bad for us 'old Tello' guys!
 

New Posts

Members online

Forum statistics

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

New Posts