Source Code Deployment Steps

2024-09-09
No Rating

Register as a DJI Developer

Register for a DJI Developer account hereopen in new window.

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 Centeropen in new window

  • 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-npmopen in new window

Launch Front-end Source Code

  1. Sample code: https://github.com/dji-sdk/Cloud-API-Demo-Webopen in new window

  2. Open the source code using the IDE.

    image-20220321170752012

  3. 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:

  1. If the live stream function is not used, only baseURL and websocketURL need to be set first.
  2. If the map is in need, you should apply for amapKey on the official website of Gaode Map.
  3. rtmp parameter is the stream server address.

image-20220321172025515

  1. Open the console at the root of the project and run the command to install the dependencies.

    npm install
    
  2. If the installation is complete you will see a node_modules directory in the root directory.

  3. Run the command to start the service.

    npm run serve
    

    image-20220321173716171

Build Back-end Service Environment

Install Java

Installation tutorial: https://www.java.com/en/download/help/index_installing.htmlopen in new window

Install EMQX

Installation tutorial: https://www.emqx.io/docs/en/v4.4/open in new window

Install MySQL

Installation tutorial:https://dev.mysql.com/doc/refman/8.0/en/installing.htmlopen in new window

Install Redis

Installation tutorial:https://redis.io/docs/getting-started/open in new window

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

  1. Sample code: https://github.com/dji-sdk/DJI-Cloud-API-Demoopen in new window

  2. Open the source code using the IDE.

    GTScreenshot_20220320_202255

  3. As Lombok is used in the project, the Lombok plugin needs to be installed in IDEA's Plugin Marketplace.

    • ​ Open Preferences

      image-20220322185756393.png

    • Then select Plugins -> Marketplace, search for Lombok to install, and restart the project after installation.

      image-20220322190132872

  4. 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.

image-20220623182157396

  1. Configuring startup.

    image-20220320213028442

    image-20220320210908780

  2. Launch project.

    image-20220320211902117

Login in Pilot 2

  1. Open pilot 2, go to the main page and click on Cloud Services to access it.

    GTScreenshot_20220321_232931.png

  2. Click Open Platforms in the bottom right-hand corner.GTScreenshot_20220321_233150.png

  3. 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.

    GTScreenshot_20220321_233344.png

  4. Click the Login button to log in.

    username: pilot

    password: pilot123

    GTScreenshot_20220321_233736.png

  5. 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.

    GTScreenshot_20220321_233859.png

  6. 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.

    GTScreenshot_20220321_234607.png

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

If you have any comments or confusion about our documentation, you can click here to give feedback and we will get back to you as soon as possible.