damiafuentes / DJITelloPy

DJI Tello drone python interface using the official Tello SDK. Feel free to contribute!
MIT License
1.25k stars 490 forks source link

set_video_direction function doesnt work #111

Closed maashon closed 2 years ago

maashon commented 3 years ago

I want to access the downward camera but the function set_video_direction(Tello.CAMERA_DOWNWARD) does not work for my drone. this is the response : Traceback (most recent call last): File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\first.py", line 10, in print(tello.send_command_with_return(Tello.CAMERA_DOWNWARD)) File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 53, in wrapper check_types(spec, *args, **kwargs) File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 45, in check_types raise TypeError("Unexpected type for '{}' (expected {} but found {})" TypeError: Unexpected type for 'command' (expected <class 'str'> but found <class 'int'>) [INFO] tello.py - 437 - Send command: 'streamoff' [WARNING] tello.py - 447 - Aborting command 'streamoff'. Did not receive a response after 7 seconds [INFO] tello.py - 437 - Send command: 'streamoff' [WARNING] tello.py - 447 - Aborting command 'streamoff'. Did not receive a response after 7 seconds [INFO] tello.py - 437 - Send command: 'streamoff' [WARNING] tello.py - 447 - Aborting command 'streamoff'. Did not receive a response after 7 seconds Exception ignored in: <function Tello.del at 0x000001CBB39BDAF0> Traceback (most recent call last): File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\tello.py", line 1019, in del File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\tello.py", line 1008, in end File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\tello.py", line 599, in streamoff File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\tello.py", line 486, in send_control_command File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\venv\lib\site-packages\djitellopy\tello.py", line 528, in raise_result_error Exception: Command 'streamoff' was unsuccessful for 4 tries. Latest response: 'Aborting command 'streamoff'. Did not receive a response after 7 seconds'

M4GNV5 commented 3 years ago

Hey, your exception reads:

Traceback (most recent call last):
File "D:\Users\Parsa\Desktop\Study materials\thesis\tello tutorils\first.py", line 10, in
print(tello.send_command_with_return(Tello.CAMERA_DOWNWARD))
[...]
TypeError: Unexpected type for 'command' (expected <class 'str'> but found <class 'int'>)

It seems like your code includes

print(tello.send_command_with_return(Tello.CAMERA_DOWNWARD))

which does not make sense. You are trying to send a command but are passing it a direction instead of a command. It does not seem like you are calling set_video_direction, but rather send_command_with_return.

Your code should instead be something like:

tello.set_video_direction(Tello.CAMERA_DOWNWARD)
maashon commented 3 years ago

raise Exception("Command '{}' was unsuccessful for {} tries. Latest response:\t'{}'" Exception: Command 'downvision 1' was unsuccessful for 4 tries. Latest response: 'unknown command: downvision'

I tried the command you suggested(tello.set_video_direction(Tello.CAMERA_DOWNWARD)) and I still get this error. as the set_video_direction function uses self.send_control_command(cmd) and passes "downvision" as the input parameter, it raises the error. this also happens when I try to use tello.turn_motor_on() function to cool down my drone while programming.

M4GNV5 commented 3 years ago

You probably need to update your tello firmware (using the official Tello App). The commands you are trying to use are commands newly introduced in the new SDK 3.0 which requires Tello firmware v02.05.01.17 released 2021-05-18. The error unknown command: downvision indicates your drone runs an old firmware which does not know of these new commands.

maashon commented 3 years ago

I tried to update the firmware but there is an error in the app.my drone's firmware version is old but when I try to update the firmware, it downloads version v02.05.01.17 and when I press update, the app gives me the prompt : latest firmware! and it wont update.I tried flushing the apps cahce and data, also removing the app and reinstalling again but it just doesnt work.

maashon commented 3 years ago

You probably need to update your tello firmware (using the official Tello App). The commands you are trying to use are commands newly introduced in the new SDK 3.0 which requires Tello firmware v02.05.01.17 released 2021-05-18. The error unknown command: downvision indicates your drone runs an old firmware which does not know of these new commands.

I still can not update usnig the official app as the app keeps telling me the tello version is the latest

M4GNV5 commented 3 years ago

Do you have an Tello EDU or regular Tello? Maybe the new SDK commands only work on the EDU versions? I have not yet tried to verify this though. You porbably need to contact Ryze support when you have trouble with the official app or the drone. I cannot really help you with that.