- Body Frame
- Ground Frame
- North - x axis
- East - y axis
- Down - z axis*
In general, in the ground frame, a general definition for the UAV orientation is North = 0 degree, East = 90 degree, West = -90 degree and South can be either 180 degree or -180 degree.
*The direction of ground frame is NOT natural for the presentation of height. For this, we adjust the direction of vertical control in order to make the height or vertical velocity to be positive upwards. In other words, given a positive velocity will make the UAV ascend. This adjustment does not effect the directions and the orders of the other two axis.
3 parts of control inputs can be used to control the movement of the UAV including horizontal control, vertical control and yaw control. Each part has several sub modules.
Control mode byte | bit 7:6 | 0b00: HORI_ATTI_TILT_ANG 0b01: HORI_VEL 0b10: HORI_POS |
bit 5:4 | 0b00: VERT_VEL 0b01: VERT_POS 0b10: VERT_THRUST |
|
bit 3 | 0b0: YAW_ANG 0b1: YAW_RATE |
|
bit 2:1 | 0b00: horizontal frame is ground frame 0b01: horizontal frame is body frame |
|
bit 0 | 0b0: yaw frame is ground frame 0b1: yaw frame is body frame |
###Control mode
We suggest developers do not use VERT_POS control mode indoor when your UAV does not have Guidance installed or the flight height is larger than 3 meters. Since in indoor environment, barometer can be inaccurate, the vertical controller may fail to keep the height of the UAV.
Please note that if the following conditions are met that the control mode is functional:
- Only when the GPS signal is good (health_flag >=3),horizontal position control (HORI_POS) related control modes can be used.
- Only when GPS signal is good (health_flag >=3),or when Gudiance system is working properly with N1 Autopilot,horizontal velocity control(HORI_VEL)related control modes can be used.
Category | Mode | Explanation |
---|---|---|
Vertical | VERT_POS | Control the height of UAV |
VERT_VEL | Control the vertical speed of UAV, upward is positive | |
VERT_THRUST | Directly control the thrust, the range is from 0% to 100% | |
Horizontal | HORI_ATTI_TILT_ANG* | Pitch & roll angle, need to be referenced to either the ground or body frame |
HORI_POS** | Position offsets of pitch & roll directions, need to be referenced to either the ground or body frame | |
HORI_VEL | Velocities on pitch & roll directions, need to be referenced to either the ground or body frame | |
Yaw | YAW_ANG | Yaw angle is referenced to the ground frame. In this control mode, Ground frame is enforeced in N1 Autopilot |
YAW_RATE | Yaw angular rate. It can either be referenced to either the ground frame or the body frame |
**The input of HORI_POS is a position offset instead of an actual position. This design aims to take both GPS flight and vision-based flight into consideration. If the developer wants to use GPS navigation, the GPS information sent by the UAV can be used to calculate position offset. While in vision-based flight application, developers should have their own positioning device (along with Gudiance or GPS to provide velocity measurement) to do position control. For example, xuhao1 SDK package implements a GPS-based position control where target position can be passed as GPS coordinate.
By specifying the control_mode_byte
, 14 control modes can be constructed :
Index | Combinations | Input Data Range (throttle/pitch&roll/yaw) |
control_mode_byte* |
---|---|---|---|
1 | VERT_VEL HORI_ATTI_TILT_ANG YAW_ANG |
-4 m/s ~ 4 m/s -30 degree ~ 30 degree -180 degree ~ 180 degree |
0b00000xx0 |
2** | VERT_VEL HORI_ATTI_TILT_ANG YAW_RATE |
-4 m/s ~ 4 m/s -30 degree ~ 30 degree -100 degree/s ~ 100 degree/s |
0b00001xxy |
3 | VERT_VEL HORI_VEL YAW_ANG |
-4 m/s ~ 4 m/s -10 m/s ~ 10 m/s -180 degree ~ 180 degree |
0b01000xx0 |
4 | VERT_VEL HORI_VEL YAW_RATE |
-4 m/s ~ 4 m/s -10 m/s ~ 10 m/s -100 degree/s ~ 100 degree/s |
0b01001xxy |
5 | VERT_VEL HORI_POS YAW_ANG |
-4 m/s ~ 4 m/s offset in meters (no limit) -180 degree ~ 180 degree |
0b10000xx0 |
6 | VERT_VEL HORI_POS YAW_RATE |
-4 m/s ~ 4 m/s offset in meters (no limit) -100 degree/s ~ 100 degree/s |
0b10001xxy |
7 | VERT_POS HORI_ATTI_TILT_ANG YAW_ANG |
0m to height limit -30 degree ~ 30 degree -180 degree ~ 180 degree |
0b00010xx0 |
8 | VERT_POS HORI_ATTI_TILT_ANG YAW_RATE |
0m to height limit -30 degree ~ 30 degree -100 degree/s ~ 100 degree/s |
0b00011xxy |
9 | VERT_POS HORI_VEL YAW_ANG |
0m to height limit -10 m/s ~ 10 m/s -180 degree ~ 180 degree |
0b01010xx0 |
10 | VERT_POS HORI_VEL YAW_RATE |
0m to height limit -10 m/s ~ 10 m/s -100 degree/s ~ 100 degree/s |
0b01011xxy |
11 | VERT_POS HORI_POS YAW_ANG |
0m to height limit offset in meters (no limit) -180 degree ~ 180 degree |
0b10010xx0 |
12 | VERT_POS HORI_POS YAW_RATE |
0m to height limit offset in meters (no limit) -100 degree/s ~ 100 degree/s |
0b10011xxy |
13 | VERT_THRUST HORI_ATTI_TILT_ANG YAW_ANG |
10 ~ 100 (use with precaution) -30 degree ~ 30 degree -180 degree ~ 180 degree |
0b00100xx0 |
14 | VERT_THRUST HORI_ATTI_TILT_ANG YAW_RATE |
10 ~ 100 (use with precaution) -30 degree ~ 30 degree -100 degree/s ~ 100 degree/s |
0b00101xxy |
*the lowest 3 bits in control_mode_byte decide the horizontal frame and yaw frame.
xx presents horizontal frame,00 means ground frame,01 means body frame.
y presents yaw frame,0 means ground frame,1 means body frame.
**In this combination,if all input data is '0', the UAV will brake and hold in a self-balance status at a fixed position.
Item Name | Variables | Data Type | Description | Unit | Default Frequency |
---|---|---|---|---|---|
Time Stamp | time | uint32_t | time stamp | 1/600s | 100Hz |
Quarternion | q0 | float32 | Attitude quaternion From ground frame to body frame |
--- | 100Hz |
q1 | float32 | ||||
q2 | float32 | ||||
q3 | float32 | ||||
Linear acceleration | agx | float32 | Linear acceleration (Raw/Fusion) | Ground: m/s2 Body: G |
100Hz |
agy | float32 | ||||
agz | float32 | ||||
Linear velocity | vgx | float32 | Linear velocity | m/s | 100Hz |
vgy | float32 | ||||
vgz | float32 | ||||
vgstatus | uint8_t | Status byte of linear velocity
|
--- | ||
Angular velocity | wx | float32 | Angular velocity (Raw/Fusion) | rad/s | 100Hz |
wy | float32 | ||||
wz | float32 | ||||
GPS and altitude | longti | double | GPS location | rad | 100Hz |
lati | double | ||||
alti | float32 | Altitude (Raw/Fusion) | m | ||
height | float32 | Height relatively to ground (Raw/Fusion) | m | ||
health_flag | uint8_t | GPS healthiness | 0-5, 5 is the best condition | ||
Magnetometer | mx | int16_t | Magnetometer data | Magnetometer data | 0Hz |
my | int16_t | ||||
mz | int16_t | ||||
Remote controller channel | roll | int16_t | roll channel | --- | 50Hz |
pitch | int16_t | pitch channel | |||
yaw | int16_t | yaw channel | |||
throttle | int16_t | throttle channel | |||
mode | int16_t | mode channel | |||
gear | int16_t | gear channel | |||
Gimbal | roll | float32 | roll, pitch and yaw of ground frame | º | 50Hz |
pitch | float32 | ||||
yaw | float32 | ||||
Flight status | status | uint8_t | Flight status | --- | 10Hz |
Battery | status | uint8_t | Battery percentage | % | 1Hz |
Source of Control | status | uint8_t | Control device
|
--- | 0Hz |
Raw/Fusion can be chosen by DJI N1 assistant software.
Because raw data is generated from actual sensor on UAV, this kind of data will not be available in simulator. Please choose Fusion when you use DJI simulator.
Item Name | Raw/Fusion | Description | Unit |
---|---|---|---|
Linear acceleration | Fusion(Ground) | Fusion data | m/s2 |
Fusion(Body) | Fusion data | G | |
Raw(Body) | Accelerometer data | G | |
Angular velocity | Fusion(Body) | Fusion data | rad/s |
Raw(Body) | Gyro data | ||
Altitude | Fusion | Barometer & IMU | m |
Raw | Barometer data | ||
Height* | Fusion | Barometer、IMU & Ultrasound | m |
Raw | Ultrasound data(within three meters vaild) |
If the flight plantform has no ultrasonic sensor, or its distance to the ground is higher than 3 meters, the height is supported by barometer and IMU only. Since the barometer is inaccurate being used indoor, height is unreliable in this case.
Flight status val | status name |
---|---|
1 | standby |
2 | take_off |
3 | in_air |
4 | landing |
5 | finish_landing |
flight status will enter the 'standby' state after 2s in 'finish_landing state'.
flight status will immediately enter 'in_air' state when UAV leave the ground.
Channel | Range | Description |
---|---|---|
roll | [-10000,10000] | Left: -10000 Right: 10000 |
pitch | [-10000,10000] | Down: -10000 Up: 10000 |
yaw | [-10000,10000] | Left: -10000 Right: 10000 |
throttle | [-10000,10000] | Down: -10000 Up: 10000 |
mode | -8000, 0, 8000 | P: -8000 A: 0 F: 8000 |
gear | -10000, -4545 | Gear down: -4545 Gear up: -10000 |