comoc / TelloForUnity

Ryze Tech/DJI Tello application development resources for Unity
The Unlicense
40 stars 20 forks source link

TelloLib Update #5

Closed carter-james89 closed 6 years ago

carter-james89 commented 6 years ago

First off, let me say, thanks a lot for this. I'm a unity developer and I have all sorts of plans for my tello in Unity. This project is great and already has me flying around with my rift and thrustmaster joystick. That said, I really need the most recent version of tellolib.

I need the positional data that has been added to flight data since you created this. Vel,pos, and quat. I've tried a couple different things to accomplish this on my own.

I've tried creating my own unity project which does not motify tellolib, but can't figure out the NAL decoding after you get the frame. It would be nice to keep up with the tellolib updates without having to make changes to tello.cs every time.

I'm currently trying to update tellolib in this repo myself, but I think it would be much quicker you could do it, seeing as you already know how it works. Essentially I'm trying to duplicate your changes with the newest version.

My last option is going to be to try and add the new tellolib changes into this repo, instead of trying to replace the whole thing.

Edit:

Ok so I got it working with the newest version of telloLib working with video. Instead of using Tello.Start/Stop I just called Tello.startConnecting and everything works just fine. Curious why you started the task in a separate function, and what heartbeat and updatelisteners are for

joshferns commented 6 years ago

Hi @carter-james89 how did you update to the newest version of TelloLib? Did you just replace the CRC.cs, Tello.cs and UDP.cs scripts? Did the video work out of the box?

Thanks

carter-james89 commented 6 years ago

Yeah I just replaced the whole tellolib folder, but unfortunately it will not work without some modifications to tello.cs/tellocontroller.cs.

@comoc seems to be controlling the thread processes himself, I assume because they will continue to run in the editor after you exit play mode. However I have gotten it to work by making disconnect() public, and just calling that OnApplicationQuit(); That means even via my method, tello.cs must be changed, albeit only line. I'm sure a request to the tellolib dev could get that function made public.

As far as I can tell, we are doing the same thing in different ways, but I may be wrong about that. I'm not 100% the reasoning behind comocs original changes regarding Start()/Stop() & updateHeartbeat().

I'll wait a day or two for comocs input, else just upload my project.

comoc commented 6 years ago

Hey guys,

Thank you for checking. I'm trying to integrate the latest TelloLib right now. And I am expecting that it will takes about 3-4 days. @carter-james89 Could you share your project? I'd like to refer your implementations.

Thanks

carter-james89 commented 6 years ago

Here's my project. The only thing left of yours @comoc is the video streaming. I'd love to know your reasoning for using SingletonMonobehavior / the functions you added to Tello.cs. I eliminated the SMB inheritance and interacted with Tello.cs via startConnecting() and Disconnect().

My project has oculus rift/touch support, and all keyboard inputs go through the input manager. Let me know if you have any questions.

Please read the readme and know this is barely tested.

TelloLib-For-Unity(https://github.com/carter-james89/TelloLib-for-Unity)

comoc commented 6 years ago

Thanks @carter-james89 .

I forked the latest Kragrathea/TelloLib and a bit modified them to adapt the life cycle of Unity. Here it is: https://github.com/comoc/TelloLib/tree/for_unity

And I pushed my latest changes. In this commit, I moved the video server functionality from C++ side to C# side.

carter-james89 commented 6 years ago

@comoc Thanks a lot for the update. I have a ton of plans for this but I need a stable platform first. The project I posted above works, but the editor crashes every 7 or so plays. It has to to with unity destroying the tello plugin on play I'm pretty sure.

Anyway I'm trying to install your newest version but I'm getting this error about the plugin. Curious how I'm supposed to install this. Last time it only worked when I imported the included package. Am I supposed to do something with TelloVideoDecoder?

I even tried using the old version with the package, then installing that and updating the newest push by hand, but no luck.

2018-09-10 20_41_46-unity 2018 2 4f1 personal 64bit - master unity - tellounitydemo - pc mac li

comoc commented 6 years ago

Hi @carter-james89. Thanks for trying. I checked my Unity project and changed the DLL import settings. I pushed above changes into the master branch. Could you try it again? Thanks,

carter-james89 commented 6 years ago

Hi @carter-james89. Thanks for trying. I checked my Unity project and changed the DLL import settings. I pushed above changes into the master branch. Could you try it again? Thanks,

Still no luck. Again all I'm doing is pulling a fresh copy of the repo and trying to open TelloUnityDemo as a unity project. (with the tellolib fork)

Also I can't open my fork locally because git says I don't have permission. Do you have to enable something for me to access my fork? 2018-09-11 17_24_17-window

comoc commented 6 years ago

Could you check the following settings. (for Editor) The CPU and OS settings should be x86_64 and Windows. image

Otherwise,

carter-james89 commented 6 years ago

Not at my PC but I'm sure those values are correct.

comoc commented 6 years ago

Oh, I see. The TelloVideoDecoder.dll whch I've pushed was a debug version. I think it is the cause. Now I pushed its release version. Could you try it again? Thanks,

joshferns commented 6 years ago

Hi guys, I'm a little confused. What's the difference between https://github.com/comoc/TelloLib/tree/for_unity and https://github.com/comoc/TelloForUnity ?

Which one is being tested?

comoc commented 6 years ago

Hi @joshferns

TelloForUnity is the main Unity project. And it is depending on TelloLib. So both are being tested.

In my former commit, the TelloLib (is my forked version) was completely integrated into the TelloForUnity repository. But now, I made the TelloLib as a submodule of the TelloForUnity for easy to track the original TelloLib's update. I mean the original TelloLib is Kragrathea/TelloLib .

joshferns commented 6 years ago

Hi. I'm still getting the error screenshot 381

carter-james89 commented 6 years ago

2018-09-12 08_48_08-tellounitydemo

comoc commented 6 years ago

Thank you @joshferns and @carter-james89 Could you try to replace the TelloVideoDecoder.dll with this one. Multi-threaded-runtime.zip At this time, the TelloVideoDecoder.dll which in my repo is using multi-threaded dll C/C++ runtime. And the dll that I attached in this comment is just multi-threaded.

In addition to the result of above, if you are familiar with Dependency Walker, and if you will be able to send me the image file, it would be helpful for me to identify the cause of this problem.

Thanks,

joshferns commented 6 years ago

Error Log with the new dll screenshot 382

I've also attached the Dependency Walker Image files. (I just open the dll, hope this is the correct way to use it)

Also, I've noticed that the .dll in your repo is only 1KB, whereas the one you attached in the zip file is around 800KB.

DependencyWalkerFiles13092018.zip

joshferns commented 6 years ago

Okay, I re-downloaded the whole project, now the dll is 400 kb and it seems to work without any errors

edit: not sure what changed between yesterday and today

Edit 2: Today I cloned the repo using sourcetree(also used recursive submodules to pull TelloLib), yesterday I directly downloaded the zip from github, possibly the zip files takes time to update and had the old dll?

comoc commented 6 years ago

@joshferns Many thanks!

I've noticed that the .dll in your repo is only 1KB, Oh, that's it!

I started to use Git LFS to manage dll files, But I think you are not using the LFS. So I have just pushed every dlls without LFS again.

Could you try to pull or newly clone them and check the size of TelloVideoDecoder.dll one more time? The size should be 400KB.

joshferns commented 6 years ago

@comoc Yes It works now. Yesterday I downloaded the zip directly from the github website, today I cloned the repo using sourcetree, I guess sourcetree resolved the LFS issue.

Thanks a lot.

comoc commented 6 years ago

Thank you so much @joshferns and @carter-james89 !

carter-james89 commented 6 years ago

Just wanted to confirm this works. I pulled the repo from github desktop and it fired right up. Thanks a lot @comoc this is a great platform.