Getting Started
Product Related
General SDK
turnMode
, when will it take effect?Android
iOS
Becoming a DJI developer is easy. Please see here for details.
All documentation can be found on the DJI developer website.
The SDK can be downloaded from the website .
All sample code referenced in the tutorials is available on Github .
Several tutorials for Android and iOS are available.
You can use the following methods to get help:
StackOverFlow
Post questions in StackOverFlow with DJI SDK tag: dji-sdk
Send Email
If you prefer email, please send to dev@dji.com for help.
The following two links from the documentation can help here:
The first time the application is initialized after installation, it connects to a DJI Server to verify it's authorized to use the DJI Mobile SDK by sending the Application Key. This process is called registration. Reasons for why it might fail include:
Yes, you can use a USB cable to connect between DJI Products and your computer to access the SD card data directly. Each product's manual illustrates the location of the USB port on the product.
Each product's web page at www.dji.com has a firmware installation manual in the Downloads section.
The aircraft is in Travel Mode during delivery. In this mode, the landing gear is half way between the retracted (up) and deployed (down) state. The landing gear needs to be deployed to attach a camera. Follow these steps to deploy the landing gear (put the aircraft in Landing Mode):
Note:
- If you have purchased the dual remote controller version, you must use the Master remote controller to deactivate Travel Mode.
- Be sure to remove the camera from the aircraft before switch from Landing Mode to Travel Mode.
- The ultrasonic sensor underneath the aircraft is used to determine when the landing gear is at the right position. Smooth reflective surfaces will work better than rough, sound-absorbing surfaces (e.g. carpet).
The remote controller is linked to your aircraft before delivery. Linking is only required when using a remote controller with an aircraft it did not ship with for the first time. Follow these steps to link a new remote controller:
Note: The remote controller will un-link itself from an aircraft if a new remote controller is linked to the same aircraft.
DJI products use WGS84 as the coordinate system.
Almost all of the functionality found in DJI GO is exposed in the Mobile SDK.
Yes, a flight simulator is available for all products and can be used both as visual verification that flight behavior is correct, and as an automated tool for CI systems.
Documentation describing setup and use of the simulator.
For more details of using the simulator, please refer to this tutorial: Aircraft Simulator.
The Phantom 4 uses a different simulator application compared to Phantom 3, Inspire and Matrice series of aircraft.
The Phantom 4 simulator can be downloaded from here and an explanation of how to use it can be found here.
Waypoint missions have two flight path modes:
The curve is formed using a quadratic Bezier curve. The corner radius defines the start point of the Bezier curve.
This is a firmware bug. Virtual stick yaw angle can be set with either angle or angular velocity commands. This behavior is seen when using angle mode. As a temporary workaround, angular velocity can be used instead.
iOS:
|
Android:
|
When yaw is controlled by angular velocity, the aircraft's yaw position can be controlled precisely by using a PID controller algorithm.
No, the minimum number of waypoints allowed in a DJIWaypointMission is 2.
turnMode
, when will it take effect?When the headingMode
value of DJIWaypointMission is set to DJIWaypointMissionHeadingUsingWaypointHeading
(iOS) or UsingWaypointHeading
(android), the turnMode
of Waypoint N takes effect when flying between Waypoint N and Waypoint N+1.
The Waypoint Mission automates the aircraft to fly through a list of waypoints, visiting one after the other. A limitation of the mission is that consecutive waypoints must have a separation of less than 2km and greater than 0.5m. In addition, the first and last waypoint of the mission must also have a separation of less than 2km and greater than 0.5m. If the separation of any consecutive waypoints or the separation of the first and last waypoint is larger than 2km, then this error will be raised.
For a waypoint mission, the total planned flight distance must be less than 40km. The total planned flight distance includes the sum of the:
Please check the following diagram for more details:
Note: The blue line represents "Distance 1", red line represents "Distance 2", and green line represents "Distance 3".
The home location can be set using:
- (void)setHomeLocation:(CLLocationCoordinate2D)homePoint |
- (void)setHomeLocationUsingAircraftCurrentLocationWithCompletion:(DJICompletionBlock)completion; |
public abstract void setHomeLocation (DJILocationCoordinate2D homePoint, DJICommonCallbacks.DJICompletionCallback callback) |
public abstract void setHomeLocationUsingAircraftCurrentLocation (DJICommonCallbacks.DJICompletionCallback callback) |
For iOS, the DJISDKMissionError will be DJISDKMissionErrorMissionTotalDistanceTooLarge
, and for Android, the DJIMissionManagerError will be MISSION_RESULT_WAYPOINT_TOTAL_TRACE_TOO_LONG
.
Generally the total distance couldn't be larger than 40km, if that error occurs, it might be something related to the improper settings for the homepoint.
The following tutorial can help here: Run Android Sample Application.
Since in the Android SDK 4.4.1, some of the SDK classes now need to be loaded before using. Loading process is done by Helper.install()
. Developer needs to call this method before using any SDK functionality. Failing to do so will result in unexpected crashes.
Please make sure you don't miss the following steps:
In your project's build.gradle file, please add the packagingOptions
to avoid unexpected crashes, and also add the compile
and provided
dependencies to to import the DJI Android SDK maven dependency as shown in this Integrate SDK into Application tutorial.
Create a new MApplication
class and invoke the install()
method of Helper
class to load the SDK classes before using any SDK functionality. Failing to do so will result in unexpected crashes. Also, you should initialize SDK class objects (Like BaseProduct.BaseProductListener
, BaseComponent.ComponentListener
and DJISDKManager.SDKManagerCallback
) inside the onCreate()
method. For more details, please check the Creating a Camera Application tutorial.
DJI Products that connect to Android mobile devices over USB do so through the AOA (Android Open Accessory) protocol. DJI GO, and DJI Mobile SDK applications support this protocol. When a USB accessory (DJI Product) is connected to the Android mobile device, Android will automatically open the application which supports it, or has been designated the default application for that accessory.
If there is more than one application that supports the accessory, and no application has been designated as the default, then the user will be given an option for which application to open. Usually, the user will also be able to select whether the application should only be opened for this connection, or should be considered the default application going forward.
Once an application is tied as the default application to an accessory, no other applications will be able to use that accessory. For example, if DJI GO is the default application, then no other SDK based application will work the DJI products.
To solve this, the default behavior needs to be removed for the accessory. For example, if the DJI GO is the default application, navigate in Android to Settings->Apps->DJI GO->Open by default and you should see a similar screen to this:
Click on the CLEAR DEFAULTS button.
If you want to change the default application from DJI GO to the SDK-based app, make sure both applications are completely terminated. Then, after clearing defaults as above, reconnect the remote controller and Android should ask which application to open and whether to make it default or not.
DJI Products that connect to Android mobile devices over USB do so through the AOA (Android Open Accessory) protocol. DJI GO, and DJI Mobile SDK applications support this protocol. When a USB accessory (DJI Product) is connected to the Android mobile device, Android will automatically open the application which supports it, or has been designated the default application for that accessory.
If there is more than one application that supports the accessory, and no application has been designated as the default, then the user will be given an option for which application to open. Usually, the user will also be able to select whether the application should only be opened for this connection, or should be considered the default application going forward. However, some Samsung devices do not give this additional option, and will instead make the selected application the default application.
Once an application is tied as the default application to an accessory, no other applications will be able to use that accessory. For example, if DJI GO is the default application, then no other SDK based application will work the DJI products.
To solve this, the default behavior needs to be removed for the accessory. For example, if the DJI GO is the default application, navigate in Android to Settings->Apps->DJI GO->Set as default and you should see a similar screen to this:
Click on the CLEAR DEFAULTS button. The next time the DJI product is connected to the mobile device, the user will be given the option to select the application to open with it.
Please update your application‘s Android SDK to the latest 3.2.2 version. You can download it from here .
For more details, please check the Importing and Activating DJI SDK in Android Studio Project tutorial.
Runtime Permissions are a new feature of Android 6.0.
You can add the following code to request permissions before you connect to the internet to register your application to use the DJI SDK:
// When the compile and target version is higher than 22, request the following permissions at runtime. |
Then build and run your application, press "Allow" in the permission request alert as shown below:
After restarting the application, it should now. This process only needs to be completed once.
Yes, DJI iOS SDK supports CocoaPods. You can check this link for details: https://cocoapods.org/pods/DJI-SDK-iOS.
Please try to turn on the Data Protection in Capabilities of your Xcode project using Xcode 8 as shown below:
If you use the same project's Bundle Identifier in multiple Macs, please try to change it to a different one and try again.
Remember to do a clean test:
We have a temporary way to enable bitcode in the iOS Sample Project:
Then you can compile the demo with bitcode enabled to your mobile device. However, there will be error when compiling the demo with this setting to the iPhone simulator. So if you want to debug your application on the iPhone simulator, please use the original setting. We will keep looking for a better way to do this.
Yes, the DJI Mobile SDK for iOS does support Swift. Swift sample code is available here.
The DJI Remote Logger allows iOS applications to log remotely. Field testing is critical in application development, and remote logging allows simple ways to log events in real time to a remote server. For more details, see the DJI Remote Logger Tutorial.
If the connection between mobile device and DJI Aircraft is USB, the “Supported external accessory protocols” must be added and will enable your SDK-based Application to connect to the MFI compatible remote controller of the DJI Aircraft. For WiFi connection product, like Phantom 4K, this setting is not necessary to be added to info.plist file.