SMerrony / tello

The tello Go (golang) package is an unofficial, easy-to-use, standalone API for the Ryze Tello® drone.
MIT License
81 stars 21 forks source link

Picture is not transferred correctly when any chunk is received twice #10

Closed Anty0 closed 5 years ago

Anty0 commented 5 years ago

Expected Behavior

Picture is successfully received even when flying in area with heavy signal interference.

Current Behavior

It is almost impossible to capture picture in locations with high signal interference, due to bug I have discovered and fixed in this commit. (But unfortunately this commit contains also another improvements for communication, so it isn't easy to see, where exactly the fix is.)

Current implementation of picture transfer is counting every received chunk and rejects all chunks when piece already have received 8 chunks. In situation, where any chunk is received twice, there will be some chunks missing in that piece. As result whole image is not saved.

Possible Solution

Move this line in tello.go (on line 347): tello.fileTemp.pieces[thisChunk.pieceNum].numChunks++

To the inside of if body on line 342: if !already {

This causes only properly received chunks to be counted and (so far during my testing) every image to be received.

Steps to Reproduce (for bugs)

  1. Connect to tello
  2. Take some pictures (10+)
  3. Save pictures
  4. Disconnect from tello
  5. Some pictures might be missing based on interference between drone and your WiFi adapter

Your Environment

SMerrony commented 5 years ago

Thanks so much for this report and fix suggestion. Just committed it and will test soon and do a release forthwith.

Would you like to share any of the other comms improvements?

Anty0 commented 5 years ago

I was thinking about sharing my improvements since I started working on them. Unfortunately I didn't have enough time to do so yet... Once I find some time, I'll recommit them in separate and more clean commits and create pull requests, but feel free to use some obvious changes on your own, in case you find some time faster then me. :)