NOTE This article is Machine-Translated. If you have any questions about this article, please send an E-mail to DJI, we will correct it in time. DJI appreciates your support and attention.
After registering the account, please download the sample and supplement the application information, after compiling, debugging and burning, the developer could run the application, With the help of those samples, the developer would know how to develop the application.
NOTE DJI's sample are developed on Manifold 2 and STM3241G-EVAL using Linux and FreeRTOS. If you need to port the sample code to other operating systems or hardware platforms, please refer to Porting.
After obtaining the sample code, please create an application in User Center and obtain the application ID and application key, as shown in Figure 1.
Figure 1. Fill in the application information
NOTE To improve your development efficiency, please fill in application name, ID, Key and user account in the sample code correctly, otherwise the compiled sample program Will not function properly.
It is recommended to use Ubuntu 16.04 and Manifold 2 to running the Linux sample code.
NOTE The Linux sample code uses Manifold 2-C and also could run on Manifold 2-G.
app_id: //Developer ID
NOTE Developer need to configure
acm_portwhen using OSDK 4.0, here default is
Before compiling the sample code, please use the
ls -l/dev/xxx command on the terminal to check the access rights of the serial port (UART) of the hardware platform. Otherwise, you can use the command
sudo chmod 777 /dev/xxx obtain the access permissions of the hardware.
NOTE xxx is the name of the serial port.
Enter the directory of the sample code:
onboard-sdk, and use the following command to compile the sample code into a sample program:
mkdir build && cd build;
cmake .. -DADVANCED_SENSING=ON(use visual function);
Copy the configuration file
UserConfig.txt to the bin file:
cp ../sample/platform/linux/common/UserConfig.txt bin/
The following is execute the "Flight Control":
./djiosdk-flightcontrol-sample UserConfig.txt UserConfig.txt
Enter B from the keyboard to run the sample program
Figure 2. Run The Sample(Linux)
After using the above command to create a workspace, please copy the OSDK sample code in the
1. In the
catkin_ws directory, use the
catkin_make command to compile the OSDK sample code.
2. Configure the current workspace
Edit the configuration file
XXXX.launch and replace the ID, Key, and baud rate of the application.
$ rosed dji_osdk_ros dji_vehicle_node.launch
$ rosed dji_osdk_ros dji_sdk_node.launch
- OSDK ROS 4.0 node configuration file path is
- OSDK ROS 3.8 node configuration file path is
If you use the dji_sdk_node version 3.8.0, you need to place the
UserConfig.txtwhich in the OSDK package to the specified path:
- If you use the command
UserConfig.txtfile needs to be placed to the current running directory;
- If you use the command
UserConfig.txtfile needs to be placed to the
roslaunch dji_osdk_ros dji_vehicle_node.launch
roslaunch dji_osdk_ros dji_sdk_node.launch
catkin_wsdirectory, and use the following command to configure the workspace (take the Flight Control as an example)
$ source devel/setup.bash
NOTE To use advanced vision features, please run the advanced_sensing_node example program.
NOTE The RTOS‘s sample code uses STM32F407IGH6-EVAL to develop the application.
Use Keil to open the project file
OnBoardSDK_STM32.uvprojx located in the
Replace the ID and key of the application in the
OnBoardSDK_STM32.uvprojxlocated in the
Figure 3. Run The Sample(STM32)
NOTE If you need to debug the sample program, please set the baud rate of the serial debugging tool. The default baud rate of USART3 port is 921600; the default baud rate of USART2 port is 115200.
When executing the application which develope based on OSDK on the first time, developer need log in the DJI Assistant 2 with developer’s account and obtain the authorization license from DJI's server to activate the application.