Giter Site home page Giter Site logo

dji_cloud_api_minimal's Introduction

Minimal DJI Cloud API example

Minimal working example using DJI Cloud API.

Setup

  1. Install dependencies: pip install -r ./requirements.txt
  2. Install docker and setup emqx (MQTT server)
    • docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx:5.0.20
    • open http://localhost:18083/ to setup admin account l: admin p: public
    • create user account (I am not sure whether it is needed, you can use admin account)
  3. Connect your DJI Smart Controller to the same local network your PC is in (in case of laptop I recommend creating local hotspot).
  4. Set env variable HOST_ADDR, USERNAME, PASSWORD to your IP which will be visible for controller and run ./cloud_api.http.py
  5. Set env variable HOST_ADDR and run ./cloud_api_mqtt.py

Conecting the controller

  1. Open DJI Pilot App
  2. Go to Cloud Service -> Other platforms
  3. Write url http://HOST_ADDR:5000/login and connect
  4. Press Login.

Now app cloud_api_mqtt.py should show you some telemetry from drone

expected example:

📨Got msg: thing/product/1ZNBK7LC00AB/osd
🌍Status: Lat: 0 Lon: 0 height: 16.160583 att_head 10.4 att_pitch -0.4 att_roll 0.2
{'61-0-0': {'gimbal_pitch': 0,
            'gimbal_roll': 0,
            'gimbal_yaw': 117.8,
            'measure_target_altitude': 0,   
            'measure_target_distance': 4.2,
            'measure_target_error_state': 3,
            'measure_target_latitude': 0,
            'measure_target_longitude': 0,
            'payload_index': '61-0-0',
            'version': 1},
 'elevation': 0,
 'firmware_version': '03.31.0000',
 'gear': 1,
 'home_distance': 0,
 'horizontal_speed': 0,
 'longitude': 0,
 'mode_code': 0,
 'position_state': {'gps_number': 0,
                    'is_fixed': 0,
                    'quality': 0,
                    'rtk_number': 0},
 'storage': {'total': 24434700, 'used': 7723000},
 'total_flight_distance': 0,
 'total_flight_time': 0,
 'track_id': '',
 'vertical_speed': 0,
 'wind_direction': 0,
 'wind_speed': 0}

dji_cloud_api_minimal's People

Contributors

pktiuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dji_cloud_api_minimal's Issues

DJI Cloud API related query

Thanks for sharing the DJI cloud api minimal repo.
I am trying to fetch the telemetry data using your code. I have small confusion regarding the HOST_ADDR. I'm using my local network IP address and using that HOST_ADDR to connect in dji pilot 2 app for the testing. will it work if i am using my local network IP.

Please suggest, will it work for me to fetch the telemetry data from drone.

IP: my local network IP
http://HOST_ADDR:5000/login

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.