DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

Using existing SDK for mini 2 possible?

surfbird

Well-Known Member
Joined
Jan 31, 2019
Messages
303
Reactions
163
I wonder if it would be possible to use the existing MSDK with mini2. Have anyone done something similar in the past?

I mean, it can't be that different, since Dji Fly can do both.

Videofeed seems to work out of the box, but nothing else. Communication with the drone on low level is exactly the same as air 2( except for missing features)

Makes me wondering why DJI delay the MSDK for so long each time. What is the reason?
 
  • Like
Reactions: h8id
It’s a lot different. Just the addition of occusynch makes it a completely different beast.
 
It’s a lot different. Just the addition of occusynch makes it a completely different beast.
I don't think so. Occusync is on lower layer (more of a transport layer), the protocol is the same of what I've seen. It was even the same when they moved from lightbridge.

Anyway I got virtualstick and takeoff to work, now the drone stops at 100m or so from takeoff point, refuses to go further. Don't know how to fix this though :).

Funny thing is that the ascending speed seems to be much faster compared to sport mode.
 
  • Like
Reactions: h8id
Any update from DJI when the SDK will be out?
"Currently, there is no plan supporting Mini 2 until Q2, 2021."

It's usually delayed even more. It's extremly little they have to change, so I never understood why they delay the sdk releases that much.

A wild guess would be Q3-Q4 2021, if they release it at all :-/
 
  • Like
Reactions: Jsaint and h8id
"Currently, there is no plan supporting Mini 2 until Q2, 2021."

It's usually delayed even more. It's extremly little they have to change, so I never understood why they delay the sdk releases that much.

A wild guess would be Q3-Q4 2021, if they release it at all :-/
I have seen a few people mention this (being able to get it to work, but having video issues and a weird proximity fence). I saw this on the developer pages: "If an application is not activated, the aircraft not bound (if required), or a legacy version of the SDK (< 4.1) is being used, all camera live streams will be disabled, and flight will be limited to a zone of 100m diameter and 30m height to ensure the aircraft stays within line of sight.". I wonder if your app would be affected by any of the mentioned conditions. Also, this is only supposed to apply in China, but I wonder if the droneID being used might contain some regional component... or maybe you are in China... Is there some way you can share your work surfbird?
 
  • Like
Reactions: Jsaint
I have seen a few people mention this (being able to get it to work, but having video issues and a weird proximity fence). I saw this on the developer pages: "If an application is not activated, the aircraft not bound (if required), or a legacy version of the SDK (< 4.1) is being used, all camera live streams will be disabled, and flight will be limited to a zone of 100m diameter and 30m height to ensure the aircraft stays within line of sight.". I wonder if your app would be affected by any of the mentioned conditions. Also, this is only supposed to apply in China, but I wonder if the droneID being used might contain some regional component... or maybe you are in China... Is there some way you can share your work surfbird?
Ok thanks for the info.
 
Last edited:
  • Like
Reactions: h8id
Ok thanks for the info.
I kind of gave up, and decided to wait for the SDK.
BUT now when it seems like the mini2 never will get any SDK, I did som testing with frida for the startup sequence of the air2. I think if we manage to reproduce this for the mini2 the fence will be gone.

It's the first time I use frida so I havn't got very far :)


What is unknown to me is :
DataRcSetRTC
DataCommonGetVersion.startForce
DataFlycActiveStatus.start



The startup (filtered) sequence is:

27487 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
27516 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
27522 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hgf>")
27757 ms DataCommonGetVersion.start("<instance: dji.midware.nhf.dgh, $className: dji.midware.upgradeComponent.ghu>", 1000, 20)
27759 ms | DataCommonGetDeviceInfo.start("<instance: dji.midware.nhf.dgh, $className: dji.midware.upgradeComponent.koy>", 1000, 20)
29018 ms DataCommonGetVersion.startForce("<instance: dji.midware.nhf.dgh, $className: dji.midware.component.dgh.gfd>", 1000, 3, true)
29312 ms DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.common.util.CallbackUtils$2>")
29312 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.common.util.CallbackUtils$2>", false)
29464 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.m>")
29479 ms DataCommonGetVersion.startForce("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.gimbal.uio>")
29505 ms DataFlycSetTimeZone.start(null)
29511 ms DataFlycSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29519 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29521 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29524 ms DataRcSetRTC.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29526 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29531 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29537 ms DataCommonSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29547 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29548 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29551 ms DataCommonSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29552 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29557 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.b>")
29556 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29567 ms DataCommonSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29569 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29573 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29576 ms DataCommonSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29578 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29579 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29583 ms DataCommonSetDate.start("<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29585 ms | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>")
29586 ms | | DataBase.start("<instance: dji.midware.fdd.gfd.fdd.dgh>", "<instance: dji.midware.nhf.dgh, $className: dji.sdk.sdkmanager.DJIGlobalService$SetTimerCallback>", false)
29600 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
29610 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
30086 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
30131 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.ghj>")
30531 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hgf>")
30651 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
31154 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.Fa>")
31186 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
31268 ms DataCommonGetVersion.startForce("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.dgh.p>")
31273 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
31621 ms DataCommonGetVersion.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.w>")
31623 ms | DataCommonGetVersion.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.w>", 500, 1)
31728 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
31758 ms DataCommonGetVersion.startForce("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.gfd.z>")
31875 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.Ka>")
31986 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.Ha>")
32023 ms DataFlycActiveStatus.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.F>")
32100 ms DataCommonGetVersion.startForce("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.gimbal.uio>")
32321 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.gfd.fdd$fdd>")
32440 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
32765 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
32869 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
33515 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
33544 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hgf>")
33921 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
34352 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
34611 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
34992 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
35694 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
35933 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
36052 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
36553 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hgf>")
36806 ms DataFlycDetection.start("<instance: dji.midware.nhf.dgh, $className: dji.sdksharedlib.hardware.abstractions.flightcontroller.pb>")
37207 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: dji.internal.diagnostics.hjn>")
37487 ms DataFlycGetParams.start("<instance: dji.midware.nhf.dgh, $className: nhf.ghu.dgh.ghu>")
Sweet, glad you are thinking of looking at this again. I don't have the drone yet... should be here Tuesday, but I do GIS for work and dabble in coding... I ASSUMED the sdk would be released and sometime soon there would be apps for setting up missions... the thing is just too easy compared to my other drones. Anyhow, I have messed around in Android Studio before... was just starting to look at this stuff and came across your post. Thank you for sharing.. once I get some time to play around I might have some actual useful input.
 
Today I mocked dronetype with frida to an air2.
And it worked!! Telemetry and video feed. No flight restrictions.

So, now I need some help how to mock the same function in runtime (without frida).
Bear in mind the class file is secneo encrypted, so it has to be done after the class is loaded.
I'm new to this, so I really need some help, I even struggled to get frida to mock the correct method.
 
Ah... your playing in iOS.. I tweaked a bit reading your code. I don't own any Apple stuff... same reason I haven't bought much DJI stuff. I have always thought of it as too "locked down". I am mostly interested in virtual sticks. Seeing as how its the same controller as the MA2 I almost except things triggered by the controller and not the app will work (sticks and camera trigger) using MA2 spoofing. It seems like there is no Android code for virtual sticks on GitHub though, there is a half built mission app, but it is based on waypoints. So I will either have to figure out the virtual sticks stuff in Android or get myself an Apple device.
 
Well, I got my delivery this morning.... so I can start trying to catch up with you. Great news that you are working in Android. Where are you finding an Android version of Frida? I had to Google frida to find out what it was, but I only see an iOS version on GitHub. I still think that DJI will eventually add the Mini 2 to the SDK code, but it is really odd there is no mention in the roadmap... concerning even. But if they aren't going to give me what I want I will do my best to find my own way.
 
Frida:
I rooted my phone with magisk.

Then it can be installed from the magiskmanager with a single click :)
There are probably more ways, but i found this way the most easy way.
I would say frida is a must if we should hack this. Its quite fun as well :)

Regarding not on dji's roadmap. Think about it, the mini2 is such a good drone so it could replace the bigger drones with a good app. To bad, since my findings seems like only one line of code needs to be added to the existing SDK.
 
  • Like
Reactions: h8id
Frida:
I rooted my phone with magisk.

Then it can be installed from the magiskmanager with a single click :)
There are probably more ways, but i found this way the most easy way.
I would say frida is a must if we should hack this. Its quite fun as well :)

Regarding not on dji's roadmap. Think about it, the mini2 is such a good drone so it could replace the bigger drones with a good app. To bad, since my findings seems like only one line of code needs to be added to the existing SDK.
Hi guys, Surfbird.
I and my friend are trying to follow you, to do a same, go from air 2 to mini 2 and build some simple app first then to go further. Also for surfing. Can you drop some recommendations, steps , in order to build the toolchain and start doing things? Can we go direct even ([email protected]). Will appreciate any help here.
Thanks
 
  • Like
Reactions: h8id
Hi guys, Surfbird.
I and my friend are trying to follow you, to do a same, go from air 2 to mini 2 and build some simple app first then to go further. Also for surfing. Can you drop some recommendations, steps , in order to build the toolchain and start doing things? Can we go direct even ([email protected]). Will appreciate any help here.
Thanks
Sounds like you guys are maybe in the same boat as me... I need to catch up with Surfbird. Need to root my phone I guess... done it before, but I need to do all the backup stuff and I haven't had any time during the week. Long weekend... hoping to get some stuff done anyways... Super happy to see others that are interested.. I'm used to dealing with Mission Planner/ArduCopter/Mavlink.. and might go that route as I see there some integration with other code I see on GitHub (The1only/rosettadrone).
 
Frida:
I rooted my phone with magisk.

Then it can be installed from the magiskmanager with a single click :)
There are probably more ways, but i found this way the most easy way.
I would say frida is a must if we should hack this. Its quite fun as well :)

Regarding not on dji's roadmap. Think about it, the mini2 is such a good drone so it could replace the bigger drones with a good app. To bad, since my findings seems like only one line of code needs to be added to the existing SDK.
So, ended up just installing a prerooted rom with Magisk and added "MagiskFrida"... I think I understand the role it will play here, but as with the other guys... going to need some more guidance getting this working so I can get to the actual problem. Which at this point I am not sure what that even is... it sounds like you have it working using Frida and you want to try and eliminate that layer... but it essentially works. I'm way behind you in understanding how to go about this... so likely I am misunderstanding something.
 
Hi guys, Surfbird.
I and my friend are trying to follow you, to do a same, go from air 2 to mini 2 and build some simple app first then to go further. Also for surfing. Can you drop some recommendations, steps , in order to build the toolchain and start doing things? Can we go direct even ([email protected]). Will appreciate any help here.
Thanks
Hello Shlomo!

Welcome!
1
So the first obstacle is to hack the sdk to handle mini2.
I would say it's very very close.
If you want to do contribute to this, frida on android is the goto tool I would say.

2 The toolchain is androidstudio.
familiarize yourself with the example SDK
dji-sdk/Mobile-SDK-Android
For myself I don't think this is very effecient way of programming. So I ended up doing my own python ide app that lets you do everything in python,.


3 Start writing app.
There is a possibility that I can release my app for those who like to contribute with new features.
In this case everything is done in python, and will be released as opensource in the end.
Python interface for tensorflow and opencv is included. You can do image recognition on the fpv-image

We might start a slack channel for this, since most of the people here doesnt seem interested in getting the sdk to work for the mini2. Which I think is strange :) Its a fantastic drone, it almost got to good, that's why i suspect dji never will release sdk for it. I already have plenty of hacks for it, like smoother gimbal hacks, higher speeds... all included in my python api.
 
  • Like
Reactions: SimonJ and h8id
Hello Shlomo!

Welcome!
1
So the first obstacle is to hack the sdk to handle mini2.
I would say it's very very close.
If you want to do contribute to this, frida on android is the goto tool I would say.

2 The toolchain is androidstudio.
familiarize yourself with the example SDK
dji-sdk/Mobile-SDK-Android
For myself I don't think this is very effecient way of programming. So I ended up doing my own python ide app that lets you do everything in python,.


3 Start writing app.
There is a possibility that I can release my app for those who like to contribute with new features.
In this case everything is done in python, and will be released as opensource in the end.
Python interface for tensorflow and opencv is included. You can do image recognition on the fpv-image

We might start a slack channel for this, since most of the people here doesnt seem interested in getting the sdk to work for the mini2. Which I think is strange :) Its a fantastic drone, it almost got to good, that's why i suspect dji never will release sdk for it. I already have plenty of hacks for it, like smoother gimbal hacks, higher speeds... all included in my python api.
Surfbird
Sounds very good. So as I understand i shall use Android studio, and on top of it some python IDE? or to go straight to Python IDE? how this Python IDE interconnected with Mobile App for Android, including its debugging?
I probably am missing something here. I can use Kivi or BeeWare or Python-for-Android. Well as first stem I am trying to stabilize some tool chain in order to be able to compile and run the app on the phone. Then the next step will be to do small change and see it in work. then go to additional functionality, development, build an open source, and so on, as you mentioned. It is right direction.
For now i am on the first step. never built an app for drone, nor in Python, so here i need the help, with the toolchain, recommendations. Thanks
BTW, we can create a specific group dealing with this and sharing info, recommendations, solutions, and so on.
 
Last edited:
  • Like
Reactions: h8id
My suggestion is that you start with androidstudio.

You will be amazed how complicated things are :). But it's a good start to understand the MSDK-api
Start with the example I linked to. The other ones are not updated so they will fail.

A lot of people struggle with it to build. It's very important you choose "import project (gradle, eclipse etc)". Then it normally builds out of the box, if you lucky :)


You have to create a api key in dji developer site and add that in the manifest file.
 
  • Like
Reactions: h8id
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
131,085
Messages
1,559,678
Members
160,068
Latest member
Bahamaboy242