kinivi / tello-gesture-control

Control DJI Tello 🛸 using hand gesture recognition on drone`s camera video-stream. Feel free to contribute!
Apache License 2.0
282 stars 86 forks source link

Error when trying to land #3

Closed xingruic closed 3 years ago

xingruic commented 3 years ago

Installation is successful there are no problems when I start the main.py. The problem occurs when I hit the spacebar to take off, then hit it again to land. It takes off perfectly, but when it tries to land, the window shows Not Responding and there is an error. Full Output

I can use the Tello_Video example (it has controls, video stream, and picture functions) from the official repository just fine.

kinivi commented 3 years ago

@NevGithub0823 Seems that problem with the command sending. I am not able to run it on Windows, but ... can you check which version of Tello SDK wrapper are you using (https://github.com/damiafuentes/DJITelloPy)?

xingruic commented 3 years ago

I am using Tello_Video from this repository. It looks like it is using python 2.7 instead of 3 and djitellopy instead of djitellopy2.

xingruic commented 3 years ago

I might try it on osx and see if it works there.

kinivi commented 3 years ago

@NevGithub0823 I am using djitellopy v1. Also, djitellopy is based on official SDK that you have shared a link to, so this can be a problem. But I think the problem in the different version of djitellopy

xingruic commented 3 years ago

It works on osx. I can take off and land perfectly fine.

xingruic commented 3 years ago

I don't think we are using different versions of djitellopy. It did work on osx for some reason.

xingruic commented 3 years ago

I think it might be the djitellopy module. This code

from djitellopy import Tello
tello=Tello()
tello.connect()
tello.takeoff()
tello.land()

sometimes takes off but doesn't land, and gives this output:

Send command: command
Response: b'ok'
Send command: takeoff
Timeout exceed on command takeoff
Command takeoff was unsuccessful. Message: False
Send command: land
Response: b'ok'

To me, it looks like the module is accepting the reply from the tello.takeoff() as the reply for tello.land(), and isn't actually landing, but only taking off (which is exactly what it's doing).

xingruic commented 3 years ago

if i do a lot of stuff with it in osx it also fails with

Traceback (most recent call last):
  File "main.py", line 160, in <module>
    main()
  File "main.py", line 112, in main
    tello.takeoff()
  File "/Users/chenxingrui/opt/miniconda3/envs/tello-gesture/lib/python3.7/site-packages/djitellopy/tello.py", line 233, in takeoff
    return self.send_control_command("takeoff")
  File "/Users/chenxingrui/opt/miniconda3/envs/tello-gesture/lib/python3.7/site-packages/djitellopy/decorators.py", line 34, in new_f
    return f(*args, **kwds)
  File "/Users/chenxingrui/opt/miniconda3/envs/tello-gesture/lib/python3.7/site-packages/djitellopy/tello.py", line 174, in send_control_command
    response = self.send_command_with_return(command)
  File "/Users/chenxingrui/opt/miniconda3/envs/tello-gesture/lib/python3.7/site-packages/djitellopy/decorators.py", line 34, in new_f
    return f(*args, **kwds)
  File "/Users/chenxingrui/opt/miniconda3/envs/tello-gesture/lib/python3.7/site-packages/djitellopy/tello.py", line 110, in send_command_with_return
    response = self.response.decode('utf-8')
AttributeError: 'NoneType' object has no attribute 'decode'
xingruic commented 3 years ago

I think I fixed the problem with an extra try except in the controls