Source Code Deployment Steps
Register as a DJI Developer
Register for a DJI Developer account here.
During the registration process, email information and a credit card or phone number will need to be supplied to verify the registration. Any credit card information given will only be used for verification and will not be charged.
Generate a License
When calling a Cloud API interface, you first need to verify the interface through license to ensure the availability of subsequent interfaces. The program only needs to call it once at the beginning, and then all the interfaces can be used.
To create a license for an application:
Go to the DJI developer Developer Center
- Select the "Apps" tab on the left.
- Select the "Create App" button on the right.
- Select App Type as Cloud API, enter APP Name, Catagory and Description.
- An application activation email will be sent to complete license generation.
- The App ID, App Key and App License will appear in the developer center and can be copied and pasted into the frontend configuration file (src/api/http/config.ts).
Build Front-end Service Environment
Install Node.js and Npm
Installation tutorial: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
Launch Front-end Source Code
Sample code: https://github.com/dji-sdk/Cloud-API-Demo-Web
Open the source code using the IDE.
Modify the parameters in the configuration file (src/api/http/config.ts) and enter the appId, appKey and appLicense applied for on the developer website.
Note:
- If the live stream function is not used, only baseURL and websocketURL need to be set first.
- If the map is in need, you should apply for amapKey on the official website of Gaode Map.
- rtmp parameter is the stream server address.
Open the console at the root of the project and run the command to install the dependencies.
npm install
If the installation is complete you will see a node_modules directory in the root directory.
Run the command to start the service.
npm run serve
Build Back-end Service Environment
Install Java
Installation tutorial: https://www.java.com/en/download/help/index_installing.html
Install EMQX
Installation tutorial: https://www.emqx.io/docs/en/v4.4/
Install MySQL
Installation tutorial:https://dev.mysql.com/doc/refman/8.0/en/installing.html
Install Redis
Installation tutorial:https://redis.io/docs/getting-started/
Initialize the Database
Login MySQL.
mysql -u username -p
Import the initialization file "cloud_sample.sql" from the sql directory in the source code.
source "path to cloud_sample.sql file"
Launch Back-end Source Code
Sample code: https://github.com/dji-sdk/DJI-Cloud-API-Demo
Open the source code using the IDE.
As Lombok is used in the project, the Lombok plugin needs to be installed in IDEA's Plugin Marketplace.
Open Preferences
Then select Plugins -> Marketplace, search for Lombok to install, and restart the project after installation.
Open the configuration file (src/main/resources/application.yml) and modify the MySQL configuration, the MQTT configuration, and the Redis configuration in the configuration file. If you don't use the media library and wayline library, you can do so without configuring an object storage server.
Note:
If MQTT does not use anonymous login, you will also need to change the MQTT account name and password in the database, in the manage_user table.
Configuring startup.
Launch project.
Login in Pilot 2
Open pilot 2, go to the main page and click on Cloud Services to access it.
Click Open Platforms in the bottom right-hand corner.
Enter the front-end access address (default: http://ip:8080/pilot-login), and click on the Connect button in the top right-hand corner to access it.
Click the Login button to log in.
username: pilot
password: pilot123
If the main page shows Connected, you are successfully logged in, and the remote control is connected to the emqx server and is pushing data. Now that the demo is up and running, you can click the back button on the remote control to return to the main page, as long as you don't click the exit button in the upper right corner, you will still be logged in.
You can already see the information on the workspace on the main page. As long as the font is dark black, it means that you are still logged in, and the data of the remote control and the drone will be continuously pushed. If you want to exit the workspace, you only need to click enter again, and then click the Log Out button in the upper right corner to exit, and the remote control and the drone will no longer push data.
Login on Web Page
Default login page: http://ip:8080/project , ip
should be changed to the real IP address that users are actually using.
username: adminPC
password: adminPC