Search Unity

DJI SDK Unity Plugin

Discussion in 'Assets and Asset Store' started by stanislav-osipov, May 6, 2019.

  1. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    Do you guys want to have a Unity plugin for a DJI SDK?
    If so, what kind of features are you interested in?
     
  2. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,394
    Would this be built on top of the new Windows SDK from DJI?
     
  3. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    I was thinking more of a cross-platfrom plugin that will be built on top of iOS, Android & Windows DJI SDK.
     
  4. hameed11

    hameed11

    Joined:
    Aug 7, 2016
    Posts:
    6
    Yes, of course if it's possible to make DJI sdk for unity that can use the video output as camera reference for tensor-flow to detect specific objects, and build it as android app, so the android app is the controller and the view port for what does the camera sees and make several things with it to unlock the opportunities !
     
  5. ds-shoaib

    ds-shoaib

    Joined:
    Mar 16, 2020
    Posts:
    4
    Hi, I'm Muhammad. I am working on DJI - UNITY integration. Need help
     
  6. bussek

    bussek

    Joined:
    Oct 26, 2016
    Posts:
    2
    Hi Muhammad, I am just investigating the possibilities of such integration of DJI drones (spark, mavic) into Unity. From what I have learned, I assume that there is no ready to paste some dll solution into Unity project in order to read the data directly from the drone. To solve this, I am thinking about three possible approaches (just ideas, don't know if that would work):
    1. Make a Unity project and do all Unity related stuff there --> export it to Android Studio project (or iOS) --> include the DJI Mobile SDK and bind the data to your Unity stuff in Android Studio --> deploy your app to your mobile device
      OR
    2. Create some data pre-processing application in Android Studio using the DJI Mobile SDK --> forward the drone data from mobile device over some websocket API to the Unity application
      OR
    3. Create an Android plugin for Unity containing the DJI SDK (don't have experience with building plugins, so I don't know how difficult that would be)
    What are your thoughts? Have you advanced somehow or have some ideas to share?
     
    Last edited: May 25, 2020
  7. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    This can be done the same way as any native plugin.
    All you need to do is just place all the native SDK into the Unity project. You can even use Play service resolver for that.
    Once it's done you can make a function for every SDK API endpoint and then control it with C# code from Unity.

    It's pretty straight forward, unfortunately not many people are expensive need in this, thanks to why I decided not to work on it atm.
    The only tricky part is the video stream, the drone will give you encoded frames data, and you will have to decode it yourself.
     
  8. bussek

    bussek

    Joined:
    Oct 26, 2016
    Posts:
    2
    Ok, I have downloaded the SDKs (in AAR format) from the MVNRepository and placed them into my Unity project. As far as I understand, now I have to write some C# wrapper inside the Unity, using the AndroidJavaClass and AndroidJavaObject and their methods. Am I correct?

    For instance:

    Code (CSharp):
    1. public class DroneVideoFeed : MonoBehaviour
    2. {
    3.     private AndroidJavaObject DJISDKManager;
    4.  
    5.     void Start() {
    6.         DJISDKManager = new AndroidJavaObject("dji.sdk.sdkmanager.DJISDKManager");
    7.  
    8.         DJISDKManager.Call("some_java_method_of_the_DJISDKManager");
    9.     }
    10. }
    The code will create me an DJISDKManager instance, through which I am able to call the DJISDKManager related methods. So if I want to recreate for instance this Camera application from the DJI tutorials projects for Android in Unity, I have to manually create the AndroidJavaObject/AndroidJavaClass for every java class of the SDK I want to work with inside the Unity. Is this the correct approach? Or is there something more convenient?
     
  9. stanislav-osipov

    stanislav-osipov

    Joined:
    May 30, 2012
    Posts:
    1,790
    It takes a lot of boilerplate code to manipulate java classes from the Unity C#.
    I would rather recommend making own android plugin.
    Btw I made a helper package for making the Android plugins feel free to check it out:
    https://github.com/StansAssets/com.stansassets.android
     
  10. mfarina_unity

    mfarina_unity

    Joined:
    May 29, 2021
    Posts:
    2
    Hi
    I have a project to develop an application using AR Foundation in Unity 3D, and I would like to get the data from the sensors of a DJI UAV, using the DJI Mobile SDK, but I am not getting it. I saw that you are already in a much more advanced stage of knowledge than I am.


    I would like help with this project, if it really can be implemented.



    Thanks for listening.
     
    tzverg likes this.
  11. jharring4

    jharring4

    Joined:
    Aug 2, 2018
    Posts:
    1
    I am looking to control a virtual camera in Unity by panning and tilting a physical tripod with a Force Pro attached. Is this possible with the DJI SDK? Has anyone tried this yet?
     
  12. Ebonicus

    Ebonicus

    Joined:
    Oct 31, 2016
    Posts:
    158

    I have a training app, and dji users would like to use their controller instead of screensticks or bt Xbox.

    How difficult is it to access dji joysticks that are connected to mobile devices using USB cable?