Application development requires extensive testing, profiling and debugging. DJI provides tools including an aircraft simulator, a wireless bridge application and remote logging functionality to make development faster and more convenient.
DJI aircraft products include a simulator that resides in the aircraft Flight Controller that can:
This allows both manual and automated flights to be simulated without actually flying the aircraft.
DJI provides tools for Windows and Mac which can be used to initialize the simulator, and visualize the aircraft behavior based on the state information provided by the simulator:
Additionally, simulator initialization, monitoring and termination can be controlled directly through the SDK allowing for application development in continuous integration environments.
The DJI Assistant 2 tool is built specifically for SDK developers and can initialize, terminate and provide visualization of the aircraft simulator running in the Flight Controller of the DJI aircraft. DJI Assistant 2 connects to the aircraft through USB.
Note: Windows 10 is not officially supported, but generally does work.
On launch, a window asking for connection of DJI Assistant 2 to the Aircraft will appear.
Connect the aircraft to the Mac or PC with a USB cable.
Turn on the remote controller and then turn on the aircraft. After a few seconds, the application will detect the aircraft.
Select "Mavic Pro" in the connected devices page, and select the Simulator tab on the left side. The following screen should be seen:
Press the Open button and enter the desired starting latitude and longitude and wind speed desired.
Press the Start Emulating button. The connected product will be shown, as well as some of the position and speed state information.
Note: Positive World X, Y and Z are North, East and Up directions respectively.
Take-off and fly with the remote controller to experiment with the simulator.
The view angle can be changed by left-clicking and dragging in the visualization window. Scrolling within the window will zoom in and out.
While flying, the flight path can be traced by right clicking on the visualization and selecting Setup.
Then select show trace under the simulator UI Config tab to display the flight trace, as shown below:
The flight path trace will then be added to the visualization.
The DJI PC Simulator tool is built specifically for SDK developers and can initialize, terminate and provide visualization of the aircraft simulator running in the Flight Controller of the DJI aircraft. The DJI PC Simulator tool connects to the aircraft through USB.
Note: Windows 10 is not officially supported, but generally does work.
Download the DJI PC Simulator Installer and User Manual and WIN Driver Installer from this page: http://developer.dji.com/mobile-sdk/downloads/
Run the Win Driver Installer
Run the DJI PC Simulator Installer
The DJI PC Simulator can either be run on a Windows PC or on a virtual machine (like Parallels or VMWare) on a Mac.
First connect the Windows PC to the aircraft using USB and turn on the aircraft.
Start DJI PC Simulator to configure and initialize the aircraft simulator. Set latitude and longitude for simulation.
Note: The aircraft will not take off if the latitude and longitude is too close to or inside a GEO Zone .
If the aircraft is on and connected to the PC, then the serial number should be displayed in the SN: text view.
Select show log window under the Log Settings tab to display the log window.
Back in the Simulator Control tab, press Start Simulation to start the aircraft simulator. At this point the aircraft will simulate flight without actually starting the motors.
Press Display Simulation to start the visualization.
Take-off and fly with the remote controller to experiment with the simulator.
The visualization will show the connected product (in this case an Inspire 1), as well as some of the position and speed state information.
Note: Positive World X, Y and Z are North, East and Up directions respectively.
The view angle can be changed by left-clicking and dragging in the visualization window. Scrolling within the window will zoom in and out.
While flying, the flight path can be traced by right clicking on the visualization and selecting Setup.
Then select show trace under the simulator UI Config tab to display the flight trace, as shown below:
The flight path trace will then be added to the visualization.
In the Simulator Config window, Stop Simulation can be pressed to stop the simulation.
Important: To stop midway through a Waypoint Mission, stop the mission from the application, then stop the simulator. Otherwise the simulator may run the previous waypoint mission when restarted.
For more info about DJI PC Simulator, check the User Manual pdf file included in the download of DJI PC Simulator.
DJI Assistant 2 and DJI PC Simulator both provide visualization of the aircraft simulator which requires a PC or Mac to be connected to the aircraft.
If visualization is not required, the DJI SDK can be used to start and stop the simulator. This means simulation can be performed without aircraft connection to a Mac or PC, allowing for automated testing in continuous integration environments.
The DJISimulator
class in DJIFlightController
is used to control the simulation. The class provides the ability to:
Sample code is provided on using the simulator in a project here: iOS | Android.
For both Android and iOS, application development is most efficient when the mobile device is connected directly to Android Studio or Xcode through a USB cable.
However, some DJI aircraft require direct connection between the aircraft's remote controller and mobile device. This means the application cannot be connected to the development environment directly through USB.
For Android, ADB over WiFi can be used to enable real time development, however there is no such option for iOS.
Therefore, DJI provides a Wireless Bridge Application, or Bridge App.
Note: If only one mobile device is available, the Bridge App can also be run with the iOS simulator. In this case the mobile device would host the bridge app, while the developer application runs on the iOS simulator.
The SDK Bridge App is provided by DJI, you can download it from Apple App Store.
A tutorial describing how to use the DJI Bridge App is here.
When testing an application in the field some form of logging is often required to understand behavior.
For iOS, the DJI Mobile SDK can be setup to allow remote logging. If the mobile device has an internet connection, messages can be logged to a remote server as they are generated during flight.
A tutorial describing how to use Remote Logging is here.