The Protocal Frame is the smallest unit for transmission. It contains the Header, Data and the Tail as follows:
|<---------------------Header-------------------------->|<--Data-->|<--Tail-->| |
Field | Index (byte) | Size (bit) | Description |
---|---|---|---|
SOF | 0 | 8 | starting byte, fixed to be 0xAA |
LEN | 1 | 10 | len of frame |
VER | 6 | version of the frame header, set to be 0 | |
SESSION | 3 | 5 | session ID |
ACK | 1 | frame type
|
|
RES0 | 2 | reserved, fixed to be 0 | |
PADDING | 4 | 5 | len of padding data used by the Data encryption |
ENC | 3 | encryption type
|
|
RES1 | 5 | 24 | reserved, fixed to be 0 |
SEQ | 8 | 16 | frame sequence num |
CRC16 | 10 | 16 | CRC16 frame header checksum |
DATA | 12 | variable size | frame data |
CRC32 | variable size | 32 | CRC32 whole frame checksum |
Note: After CRC16 encryption, developers should update the
PADDING
andLEN
part in your frame header before doing CRC32 encryption.
There are two types of frames.
Frame Type | Data Type | Transmission Direction | Content |
---|---|---|---|
CMD frame | CMD frame data | Onboard Embedded System (OES) <=> Autopilot | flight control related CMDs |
ACK frame | ACK frame data | Autopilot <=> Onboard Embedded System (OES) | ACK related data |
|<------CMD frame data------>| |
Field | Index (byte) | Size (byte) |
---|---|---|
CMD SET | 0 | 1 |
CMD ID | 1 | 1 |
CMD VAL | 2 | vary by CMDs |
|<-ACK frame data->| |
Field | Index (byte) | Size (byte) |
---|---|---|
ACK VAL | 0 | vary by ACKs |
SEQ field in ACK frame is the same as the one in corresponding CMD frame. Developers can use the SEQ field of the ACK frame to match the corresponding CMD frame.
The session mechanism has been used in order to prevent the exceptions such as package loss. 3 kinds of session have been introduced:
Type | SESSION | Description |
---|---|---|
0 | 0 | Sender doesn't need ACKs. |
1 | 1 | Sender needs ACKs but can be tolerated. |
2 | 2-31 | Sender needs ACKs.* |
Note: Type 1 and Type 2 can ONLY be applied to the CMDs which have ACKs.
Since type 2 is designed to be reliable. Developers should implement the package loss & resending mechinism based on the current SEQ and SESSION fields. When package loss is found from the sender, the sender can send the CMD frame again with the same SEQ and SESSION lost previously to retrieve back the ACK frame.
DJI designs encryption interface in communication between OES and autopilot, considering it is possible that developer implement the communication with unsafe channel, for example various types of wireless transparent transmission module.
AES encrypting is designed only for data part of a frame. And developers can encrypt their own data with a key which is despatched when they register the APP ID, and encryption function in DJI_LIB
.
Due to encryption process, data need to be aligned into blocks and each one contains 16 bytes. 'PADDING' in frame header is the length of additional data generated in this progress. Also 'LEN' need to be caclulated again, and 'ENC' need to be set to '1'. For more details about encryption algorithm, please refer to sdk_encrypt_interface
in DJI_Codec.cpp
.
On the other hand, there is no need to encrypt data, when developers use a serial cable to connect OES and autopilot. In this case, just set 'ENC' to '0'.
Note: By default, encryption is turned OFF in the SDK. Enable it by going to DJI_Config.h and uncommenting the USE_ENCRYPT macro.
Each CMD Set contains some CMD IDs for different operations.
CMD Set | CMD ID | Function |
---|---|---|
0x00 Initialization CMD Set |
0x00 | Get Protocal Version |
0x01 | Activation | |
0x10 | Set 'Flight Data' frequency | |
0xFE | Data Transparent Transmission From Onboard SDK to Mobile SDK |
|
0x01 Control CMD Set |
0x00 | Obtain/Release Control Authorization |
0x01 | Switch Flight Mode | |
0x02 | Request Switch Result | |
0x03 | Movement Control | |
0x05 | Arm/Disarm | |
0x1A | Gimbal Control in Rate | |
0x1B | Gimbal Control in Position | |
0x20 | Take Photo | |
0x21 | Start Recording Video | |
0x22 | Stop Recording Video | |
0x02 Push Data CMD Set |
0x00 | Flight Data |
0x01 | Lost of Flight Control | |
0x02 | Data Transparent Transmission From Mobile SDK to Onboard SDK |
|
0x03 | Ground Station State | |
0x04 | Waypoint Event | |
0x03 Ground Station CMD Set Waypoint |
0x10 | Upload Waypoint Mission Settings |
0x11 | Upload Waypoint Data | |
0x12 | Start/Stop waypoint | |
0x13 | Pause/Resume waypoint | |
0x14 | Read Waypoint Init Status (Available In 3.2 Release) | |
0x15 | Read Single Waypoint Status (Available In 3.2 Release) | |
0x16 | Set idle speed | |
0x17 | Get idle speed | |
0x03 Ground Station CMD Set Hotpoint |
0x20 | Start hotpoint |
0x21 | Stop hotpoint | |
0x22 | Pause/Resume hotpoint | |
0x23 | Set idle speed | |
0x24 | Set radius | |
0x25 | Reset yaw | |
0x26 | Read HotPoint info from flight controller | |
0x27 | Set Auto Radius | |
0x03 Ground Station CMD Set Follow Me |
0x30 | Start follow me |
0x31 | Stop follow me | |
0x32 | Pause/Resume follow me | |
0x33 | Set target pos info | |
0x04 Sync signal CMD Set |
0x00 | Set Sync signal output frequency |
0x05 Virual RC CMD Set |
0x00 | Virual RC request |
0x01 | Virual RC data |
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | arbitrary num |
ACK Val | 0 | 2 | Return Code
|
2 | 4 | The CRC val of the protocal version | |
6 | 32 | protocal version |
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 4 | app_id, app unique identifer |
8 | 4 | Fixed value:
A3: 0x03016400 |
|
12 | 32 | Fixed string, "12345678901234567890123456789012" | |
ACK Val | 0 | 2 | Return Code:
|
M100:
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | time stamp |
1 | 1 | attitude quaternion | |
2 | 1 | linear acceleration | |
3 | 1 | linear velocity | |
4 | 1 | angular velocity | |
5 | 1 | GPS location, altitude and height | |
6 | 1 | magnetometer | |
7 | 1 | remote controller data | |
8 | 1 | roll, pitch and yaw of gimbal | |
9 | 1 | flight status | |
10 | 1 | battery info | |
11 | 1 | control device | |
12 | 4 | reserved | |
ACK Val | 0 | 2 | Return Code
|
A3:
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | time stamp |
1 | 1 | attitude quaternion | |
2 | 1 | linear acceleration | |
3 | 1 | linear velocity | |
4 | 1 | angular velocity | |
5 | 1 | GPS location, altitude and height | |
6 | 1 | GPS detailed information | |
7 | 1 | RTK detailed information | |
8 | 1 | magnetometer | |
9 | 1 | remote controller data | |
10 | 1 | roll, pitch and yaw of gimbal | |
11 | 1 | flight status | |
12 | 1 | battery info | |
13 | 1 | control device | |
14 | 2 | reserved | |
ACK Val | 0 | 2 | Return Code
|
Val | Freq |
---|---|
0 | 0Hz |
1 | 1Hz |
2 | 10Hz |
3 | 50Hz |
4 | 100Hz |
5 | Last freq |
Please make sure the following conditions have been met:
Due to the consideration of safety, all requests of obtain control and release control need to be sent twice and the first ACK will be fail. In our official library, we have already implemented this feature.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01: request to obtain control authorization 0x00: request to release control authorization |
ACK Val | 0 | 2 | Return Code
|
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | CMD Sequence Number |
1 | 1 |
0x01 : return to home(RTH) 0x04 : auto take off 0x06 : auto landing |
|
ACK Val | 0 | 2 | Return Code
|
Note: auto takeoff only works when motor isn't running
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | CMD Sequence Number |
ACK Val | 0 | 2 | Return Code
|
For more info about Movement Control, please refer to the Onboard SDK source code files.
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | --- | Control mode byte |
1 | 4 | float32 | Roll or X-axis control value | |
5 | 4 | float32 | Pitch or Y-axis control value | |
9 | 4 | float32 | Throttle or Z-axis control value | |
13 | 4 | float32 | Yaw control value | |
ACK Val | --- | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01 : Arm 0x00 : Disarm |
ACK Val | 0 | 2 | Return Code
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 2 | int16_t | Yaw in rate unit 0.1º/s, input range[-1800,1800] |
2 | 2 | int16_t | Roll in rate unit 0.1º/s, input range[-1800,1800] |
|
4 | 2 | int16_t | Pitch in rate unit 0.1º/s, input range[-1800,1800] |
|
6 | 1 |
|
|
|
ACK Val | --- | --- | --- | N/A |
Note: M600 with A3 only supports Ronin-MX/Zenmuse X5 Series/Zenmuse X3/Zenmuse XT when operating gimbal control in rate.
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 2 | int16_t | Yaw angle unit 0.1º, input range [-3200,3200] |
2 | 2 | int16_t | Roll angle unit 0.1º, input range [-350,350] |
|
4 | 2 | int16_t | Pitch angle unit 0.1º, input range [-900,300] |
|
6 | 1 | --- | control flag byte
|
|
7 | 1 | uint8_t | Command completion time unit 0.1s, for example 20 means gimbal will reach the commended postition in 2 seconds rotate rate beyond 400º/s is not recommand |
|
ACK Val | --- | --- | --- | N/A |
The relationship bewteen the angle reference in absolute control mode and gimbal mode configuration in DJI Go App
Gimbal Mode | Roll | Pitch | Yaw | Gimbal Follow UAV's Head |
---|---|---|---|---|
Follow | Ground | Ground | Body | Y |
FPV | N/A | Ground | N/A | Y |
Free | Ground | Ground | Ground | N |
Note: Rotating 90 degree in pitch
direction will cause gimbal lock problem, in which the value of roll
and yaw
are not reliable.
Note: M600 with A3 only supports Ronin-MX/Zenmuse X5 Series/Zenmuse X3/Zenmuse XT when operating gimbal control in angle.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | arbitrary number |
ACK Val | --- | --- | N/A |
Note: M600 with A3 only supports Zenmuse Series when operating camera control.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | arbitrary number |
ACK Val | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | arbitrary number |
ACK Val | --- | --- | N/A |
Note: M600 with A3 only supports Zenmuse Series when operating camera control.
The flight data from the Autopilot can be configured by the DJI assistant software. More info about Flight Data, please refer to the Onboard SDK source code files.
Data Type | Size (byte) | Description |
---|---|---|
CMD Val | 2 | item presence byte, Bit with value 1 means this flight data contains corresponding data item M100:
|
9 | Time stamp | |
16 | Attitude quaternion | |
12 | Linear acceleration | |
13 | Linear velocity | |
12 | Angular velocity | |
25 | GPS position, altitude, height and healthiness | |
68 | GPS detailed information (A3 only) | |
74 | RTK detailed information (A3 only) | |
6 | Magnetometer data | |
12 | Remote controller channels | |
13 | Roll, pitch and yaw of Gimbal | |
1 | Flight status | |
1 | Battery percentage | |
2 | Control device |
Note: The actual offset of data item in the flight data should be calculated by the flags of 'item presence byte'.
OES has the lowerest control priority. Its control authorization can be taken over by remote controller and Mobile Device. Once the flight control is lost from the OES, a push data will be sent by the Autopilot.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 | Fixed value, set to be 0x04 |
ACK Val | --- | --- | N/A |
For more info about Ground Station, please refer to the Onboard SDK source code files.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 6 | Ground Station State package |
ACK Val | --- | --- | N/A |
For more info about Ground Station, please refer to the Onboard SDK source code files.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 6 | Waypoint Event package |
ACK Val | --- | --- | N/A |
For more info about Ground Station, please refer to the Onboard SDK source code files.
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 51 | WayPointInitData | waypoint mission information |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | waypoint index |
1 | 90 | WayPointData | waypoint information | |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
0 | 1 | uint8_t | waypoint index | |
3 | 90 | WayPointData | waypoint index information |
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01 : Stop waypoint 0x00 : Start waypoint |
ACK Val | 0 | 1 | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01 : Resume waypoint 0x00 : Pause waypoint |
ACK Val | 0 | 1 | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
1 | 51 | WayPointInitData | waypoint initialized mission information |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | waypoint index |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
2 | 1 | uint8_t | waypoint index | |
3 | 90 | WayPointData | waypoint index information |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | * | float32 | idle speed |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
1 | 2 | float32 | idle speed |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 51 | HotPointData | hotpoint mission settings |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01 : Resume hotpoint 0x00 : Pause hotpoint |
ACK Val | 0 | 1 | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | is clockwise |
1 | 4 | float32 | idle speed | |
ACK Val | --- | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 4 | float32 | radius |
ACK Val | --- | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | --- | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
1 | 51 | HotPointData | hotpoint mission settings |
Data Type | Offset(byte) | Length(byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | enable(1:start, 0:stop) |
1 | 1 | int8_t | rate(rate of radiu change) | |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 23 | FollowData | follow me settings |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 1 | uint8_t | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
0x01 : Resume follow me 0x00 : Pause follow me |
ACK Val | 0 | 1 | Return Code:
|
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 1 | uint8_t | arbitrary num |
ACK Val | 0 | 20 | FollowTarget | target information |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 4 | uint32_t | 0 means that a single sync signal output, other value indicates the frequency of sync signal output, unit hz |
ACK Val | --- | --- | --- | N/A |
For more info about virual RC, please refer to the Onboard SDK source code files.
Data Type | Offset (byte) | Size (byte) | Description |
---|---|---|---|
CMD Val | 0 | 1 |
bit 0:
0 Request close
0 No switches,execute disconnect program
|
ACK Val | --- | --- | N/A |
Data Type | Offset (byte) | Size (byte) | Data Type | Description |
---|---|---|---|---|
CMD Val | 0 | 4 * 16 | uint32_t[16] | data of sixteen channels,range[1024-660, 1024+660] |
ACK Val | --- | --- | --- | N/A |