Archimonde666 / Challenge-drone-EA

GNU General Public License v3.0
0 stars 1 forks source link

Exception: [WinError 10054] when attempting to connect to the real UAV #8

Closed pbag47 closed 2 years ago

pbag47 commented 2 years ago

Even with WiFi connected and firewall disabled, the Tello front LED still blinks in yellow and the software can't connect to the drone.

[INFO] tello.py - 130 - Tello instance was initialized. Host: '127.0.0.1'. Port: '8889'.
[INFO] tello.py - 436 - Send command: 'command'
[ERROR] tello.py - 163 - [WinError 10054] Une connexion existante a dû être fermée par l’hôte distant
Traceback (most recent call last):
pbag47 commented 2 years ago

Unlikely to be our code modification : it still bugs with the original program from ENSMA. It might be caused by the local PC configuration.

Archimonde666 commented 2 years ago

After some testing it might be some weird socket in use : i managed to make it works with good repetability by changing the IP adress in tello_sensors from "192.168.10.1" to "192.168.10.2", launching the code which bugged. turing it back to "192.168.10.1" solved the problem.

Archimonde666 commented 2 years ago

Therefore some other problems at startup seems to occur :

[INFO] tello.py - 130 - Tello instance was initialized. Host: '192.168.10.1'. Port: '8889'.
[INFO] tello.py - 436 - Send command: 'command'
- [ERROR] tello.py - 457 - 'utf-8' codec can't decode byte 0xcc in position 0: invalid continuation byte
[INFO] tello.py - 436 - Send command: 'command'
[INFO] tello.py - 461 - Response command: 'ok'
[INFO] tello.py - 436 - Send command: 'streamoff'
[INFO] tello.py - 461 - Response streamoff: 'ok'
[INFO] tello.py - 436 - Send command: 'streamon'
[INFO] tello.py - 461 - Response streamon: 'ok'
- non-existing PPS 0 referenced
- non-existing PPS 0 referenced
- decode_slice_header error
- no frame!
- non-existing PPS 0 referenced
- non-existing PPS 0 referenced
- decode_slice_header error
- no frame!
[INFO] tello.py - 470 - Send command (no response expected): 'rc 0 0 0 0'
[INFO] tello.py - 470 - Send command (no response expected): 'rc 0 0 0 0'
[INFO] tello.py - 470 - Send command (no response expected): 'rc 0 0 0 0'
[INFO] tello.py - 470 - Send command (no response expected): 'rc 0 0 0 0'
pbag47 commented 2 years ago

Opened_sockets_relics

@Archimonde666 It seems that the UDP/TCP socket used to communicate with the Tello is not released at the end of the program in REAL environment. This results in a relic that runs forever as soon as the program is stopped (shown in the attached picture).

By then, any program launch fails (both REAL and SIMULATION evironments) because it tries to create a socket that already exists and that is already active.

The only solution I found in order to remove this relic socket was to reboot the PC.

Archimonde666 commented 2 years ago

Really ? I did actually try to reboot my PC and that did not solve the thing at least once.

If it's that we need to figure out a way to release that socket when the program fails [just encapsulate the main into a try catch] or is stopped.

pbag47 commented 2 years ago

After further investigations, this issue appeared to come from a random exception which caused the program to be stopped before running the Tello.end() method. It results in a never-ending network socket beeing forever active, even though the program is stopped. Then, any connection attempt is blocked by this relic.

To be able to connect to the UAV again, the solution would be to inspect the active sockets and to force the release of this relic. However, it requires the admin privileges and some windows command skills (but Google is your friend).

An easier fix discovered by @Archimonde666 is to change the IP address of the UAV to a dummy one in the program, run it until it fails to connect, then switch back to the correct IP address and the program should work fine.

To avoid this issue, make sure that the Tello.end() method is always triggered at the end of your programs, no matter what (errors, exceptions, connection loss)