DJI Payload SDK  1.5.3
psdk_cmdset_gimbal.h
Go to the documentation of this file.
1 /**
2  ******************************************************************************
3  * @file psdk_cmdset_gimbal.h
4  * @version V1.0.0
5  * @date 2017/11/9
6  * @brief This file defines payload sdk gimbal command set.
7  *
8  * @copyright (c) 2017-2018 DJI. All rights reserved.
9  *
10  * All information contained herein is, and remains, the property of DJI.
11  * The intellectual and technical concepts contained herein are proprietary
12  * to DJI and may be covered by U.S. and foreign patents, patents in process,
13  * and protected by trade secret or copyright law. Dissemination of this
14  * information, including but not limited to data and other proprietary
15  * material(s) incorporated within the information, in any form, is strictly
16  * prohibited without the express written consent of DJI.
17  *
18  * If you receive this source code without DJI’s authorization, you may not
19  * further disseminate the information, and you must immediately remove the
20  * source code and notify DJI of its removal. DJI reserves the right to pursue
21  * legal actions against you for any loss(es) or damage(s) caused by your
22  * failure to do so.
23  *
24  * ******************************************************************************
25  */
26 
27 /* Define to prevent recursive inclusion -------------------------------------*/
28 #ifndef PSDK_CMD_SET_GIMBAL_H
29 #define PSDK_CMD_SET_GIMBAL_H
30 
31 /* Includes ------------------------------------------------------------------*/
32 #include <psdk_typedef.h>
33 #include <psdk_core.h>
34 
35 /** @addtogroup PSDK
36  * @{
37  */
38 
39 /** @addtogroup PSDK_Gimbal
40  * @{
41  */
42 
43 /* Exported constants --------------------------------------------------------*/
44 /* Exported macros -----------------------------------------------------------*/
45 /* Exported types ------------------------------------------------------------*/
46 
47 /** @defgroup Gimbal_Exported_Types Exported types
48  * @{
49  */
50 
51 /** @defgroup Gimbal_Command_Related Command Related
52  * @{
53  */
54 
55 /**
56  * @brief Gimbal Command ID
57  */
58 typedef enum {
59  PSDK_GIMBAL_CMD_ID_GET_GIMBAL_PARAM = 0x01, /*!< Get gimbal state command. */
60  PSDK_GIMBAL_CMD_ID_SET_GIMBAL_MODE = 0x02, /*!< Set gimbal mode command. */
61  PSDK_GIMBAL_CMD_ID_RETURN_HEAD = 0x03, /*!< Control gimbal return head command. */
62  PSDK_GIMBAL_CMD_ID_CONTROL_SPEED = 0x04, /*!< Control gimbal angle speed command. */
63  PSDK_GIMBAL_CMD_ID_CONTROL_ANGLE = 0x05, /*!< Control gimbal angle command. */
64  PSDK_GIMBAL_CMD_ID_CONTROL_JOINT_ANGLE = 0x06, /*!< Control gimbal joint angle command. */
65  PSDK_GIMBAL_CMD_ID_START_CALIBRATION = 0x07, /*!< Gimbal calibration command. */
66  PSDK_GIMBAL_CMD_ID_GET_CALIBRATION_PROGRESS = 0x08, /*!< Get gimbal calibration progress command. */
67  PSDK_GIMBAL_CMD_ID_GET_GIMBAL_ADDITIONAL_STATUS = 0x09, /*!< Get gimbal additional status command. */
68  PSDK_GIMBAL_CMD_ID_SUPPORT_STATE = 0xFF, /*!< Get gimbal function support state command. */
70 
71 /**
72  * @}
73  */
74 
75 /** @defgroup Gimbal_Related Gimbal Related
76  * @{
77  */
78 
79 /**
80  * @brief Gimbal mode.
81  */
82 typedef enum {
83  PSDK_GIMBAL_GIMBAL_MODE_FREE = 0, /*!< Free mode, Pitch, roll and yaw are all controllable. */
84  PSDK_GIMBAL_GIMBAL_MODE_FPV = 1, /*!< FPV mode, Only pitch is controllable. */
85  PSDK_GIMBAL_GIMBAL_MODE_YAW_FOLLOW = 2, /*!< Yaw follow mode, Pitch and roll are controllable. */
87 
88 /**
89  * @brief Gimbal calibration status.
90  */
91 typedef enum {
92  PSDK_GIMBAL_CALI_CMPL = 0, /*!< Calibration complete. */
93  PSDK_GIMBAL_CALI_PROC = 1, /*!< Calibration is processing. */
94  PSDK_GIMBAL_CALI_FAIL = 2, /*!< Calibration failed. */
96 
97 /**
98  * @}
99  */
100 
101 /** @addtogroup Gimbal_Command_Related
102  * @{
103  */
104 
105 #pragma pack(1)
106 
107 //PSDK_GIMBAL_CMD_ID_GET_GIMBAL_PARAM
108 /**
109  * @brief Get gimbal state command request data structure.
110  */
111 typedef struct {
112  PSDK_EMPTY_STRUCT
114 
115 /**
116  * @brief Get gimbal state command ack data structure.
117  */
118 typedef struct {
119  uint8_t ackCode; /*!< Specifies PSDK command ack code.
120  This parameter can be any value of ::E_PsdkCmdAckCode */
121  uint8_t gimbalMode; /*!< This parameter can be any value of ::E_PsdkGimbalGimbalMode. */
122 
123  uint8_t isMountedUpwards: 1; /*!< Specifies gimbal mounting direction. 0 represents downward mounting,
124  1 represents upward mounting. */
125  uint8_t isYawLimit : 1; /*!< Specifies whether YAW axis reaches limits. */
126  uint8_t isRollLimit : 1; /*!< Specifies whether ROLL axis reaches limits. */
127  uint8_t isPitchLimit : 1; /*!< Specifies whether PITCH axis reaches limits. */
128  uint8_t reserved : 4;
129 
130  int16_t pitch; /*!< Specifies current PITCH axis angle, unit: 0.1 degree.
131  @note The parameter refer to NED coordinate system. */
132  int16_t roll; /*!< Specifies current ROLL axis angle, unit: 0.1 degree.
133  @note The parameter refer to NED coordinate system. */
134  int16_t yaw; /*!< Specifies current YAW axis angle, unit: 0.1 degree.
135  @note The parameter refer to NED coordinate system. */
137 
138 //PSDK_GIMBAL_CMD_ID_SET_GIMBAL_MODE
139 /**
140  * @brief Set gimbal mode command request data structure.
141  */
142 typedef struct {
143  uint8_t gimbalMode; /*!< This parameter can be any value of ::E_PsdkGimbalGimbalMode. */
145 
146 /**
147  * @brief Set gimbal mode command ack data structure.
148  */
149 typedef struct {
150  uint8_t ackCode; /*!< Specifies PSDK command ack code.
151  This parameter can be any value of ::E_PsdkCmdAckCode */
153 
154 //PSDK_GIMBAL_CMD_ID_RETURN_HEAD
155 /**
156  * @brief Control gimbal return head command request data structure.
157  */
158 typedef struct {
159  PSDK_EMPTY_STRUCT
161 
162 /**
163  * @brief Control gimbal return head command ack data structure.
164  */
165 typedef struct {
166  uint8_t ackCode; /*!< Specifies PSDK command ack code.
167  This parameter can be any value of ::E_PsdkCmdAckCode */
169 
170 //PSDK_GIMBAL_CMD_ID_CONTROL_SPEED
171 /**
172  * @brief Control gimbal angle speed command request data structure.
173  */
174 typedef struct {
175  int16_t pitchSpeed; /*!< Pitch axis speed, unit: 0.1 degree/s. */
176  int16_t rollSpeed; /*!< Roll axis speed, unit: 0.1 degree/s. */
177  int16_t yawSpeed; /*!< Yaw axis speed, unit: 0.1 degree/s. */
178  uint8_t ctrlFlag; /*!< Specifies gimbal control action. 1 represents control gimbal,
179  0 represents stop control gimbal. */
181 
182 /**
183  * @brief Control gimbal angle speed command ack data structure.
184  */
185 typedef struct {
186  uint8_t ackCode; /*!< Specifies PSDK command ack code.
187  This parameter can be any value of ::E_PsdkCmdAckCode */
189 
190 //PSDK_GIMBAL_CMD_ID_CONTROL_ANGLE
191 /**
192  * @brief Control gimbal angle command request data structure.
193  */
194 typedef struct {
195  psdk_f32_t pitchAngle; /*!< Pitch axis target angle, unit: degree. */
196  psdk_f32_t rollAngle; /*!< Roll axis target angle, unit: degree. */
197  psdk_f32_t yawAngle; /*!< Yaw axis target angle, unit: degree. */
199 
200 /**
201  * @brief Control gimbal angle command ack data structure.
202  */
203 typedef struct {
204  uint8_t ackCode; /*!< Specifies PSDK command ack code.
205  This parameter can be any value of ::E_PsdkCmdAckCode */
207 
208 //PSDK_GIMBAL_CMD_ID_CONTROL_JOINT_ANGLE
209 /**
210  * @brief Control gimbal joint angle command request data structure.
211  */
212 typedef struct {
213  int16_t pitchJointAngle; /*!< Current joint angle of pitch axis, unit: 0.1 degree. */
214  int16_t rollJointAngle; /*!< Current joint angle of roll axis, unit: 0.1 degree. */
215  int16_t yawJointAngle; /*!< Current joint angle of yaw axis, unit: 0.1 degree. */
217 
218 /**
219  * @brief Control gimbal joint angle command ack data structure.
220  */
221 typedef struct {
222  uint8_t ackCode; /*!< Specifies PSDK command ack code.
223  This parameter can be any value of ::E_PsdkCmdAckCode */
225 
226 //PSDK_GIMBAL_CMD_ID_START_CALIBRATION
227 /**
228  * @brief Control gimbal calibration command request data structure.
229  */
230 typedef struct {
231  PSDK_EMPTY_STRUCT
233 
234 /**
235  * @brief Control gimbal calibration command ack data structure.
236  */
237 typedef struct {
238  uint8_t ackCode; /*!< Specifies PSDK command ack code.
239  This parameter can be any value of ::E_PsdkCmdAckCode */
241 
242 //PSDK_GIMBAL_CMD_ID_GET_CALIBRATION_PROGRESS
243 /**
244  * @brief Get gimbal calibration progress command request data structure.
245  */
246 typedef struct {
247  PSDK_EMPTY_STRUCT
249 
250 /**
251  * @brief Get gimbal calibration progress command ack data structure.
252  */
253 typedef struct {
254  uint8_t ackCode; /*!< Specifies PSDK command ack code.
255  This parameter can be any value of ::E_PsdkCmdAckCode */
256  uint8_t progress; /*!< Specifies gimbal calibration progress percentage, range from 0 to 100. */
257  uint8_t status; /*!< Specifies gimbal calibration status, This parameter can be any value of ::E_PsdkGimbalCaliSts. */
259 
260 //PSDK_GIMBAL_CMD_ID_GET_GIMBAL_ADDITIONAL_STATUS
261 /**
262  * @brief Get gimbal additional status command request data structure.
263  */
264 typedef struct {
265  PSDK_EMPTY_STRUCT
267 
268 /**
269  * @brief Get gimbal additional status command ack data structure.
270  */
271 typedef struct {
272  uint8_t ackCode; /*!< Specifies PSDK command ack code. This parameter can be any value of ::E_PsdkCmdAckCode */
273  float rotationSpeedPitch; /*!< Specifies rotation speed at pitch axis in body coordinate, unit: 0.1 degree/s. */
274  float rotationSpeedRoll; /*!< Specifies rotation speed at roll axis in body coordinate, unit: 0.1 degree/s. */
275  float rotationSpeedYaw; /*!< Specifies rotation speed at yaw axis in body coordinate, unit: 0.1 degree/s. */
277 
278 //PSDK_GIMBAL_CMD_ID_SUPPORT_STATE
279 /**
280  * @brief Get gimbal function support state command request data structure.
281  */
282 typedef struct {
283  PSDK_EMPTY_STRUCT
285 
286 /**
287  * @brief Get gimbal function support state command ack data structure.
288  */
289 typedef struct {
290  uint8_t ackCode; /*!< Specifies PSDK command ack code.
291  This parameter can be any value of ::E_PsdkCmdAckCode */
292  uint8_t isGimbalCmdSetSupport : 1; /*!< Specifies if gimbal commands is supported. */
293  uint8_t reserved : 7;
295 
296 #pragma pack()
297 
298 /**
299  * @}
300  */
301 
302 /**
303  * @}
304  */
305 
306 /* Exported variables --------------------------------------------------------*/
307 /* Exported functions --------------------------------------------------------*/
308 /* Private constants ---------------------------------------------------------*/
309 /* Private macros ------------------------------------------------------------*/
310 /* Private types -------------------------------------------------------------*/
311 /* Private variables ---------------------------------------------------------*/
312 /* Private functions ---------------------------------------------------------*/
313 
314 /**
315  * @}
316  */
317 
318 /**
319  * @}
320  */
321 
322 #endif //PSDK_CMD_SET_GIMBAL_H
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:166
Set gimbal mode command ack data structure.
Definition: psdk_cmdset_gimbal.h:149
Control gimbal calibration command request data structure.
Definition: psdk_cmdset_gimbal.h:230
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:238
uint8_t isMountedUpwards
Definition: psdk_cmdset_gimbal.h:123
float rotationSpeedRoll
Definition: psdk_cmdset_gimbal.h:274
float rotationSpeedYaw
Definition: psdk_cmdset_gimbal.h:275
Control gimbal joint angle command request data structure.
Definition: psdk_cmdset_gimbal.h:212
int16_t rollJointAngle
Definition: psdk_cmdset_gimbal.h:214
Control gimbal joint angle command ack data structure.
Definition: psdk_cmdset_gimbal.h:221
uint8_t isGimbalCmdSetSupport
Definition: psdk_cmdset_gimbal.h:292
Control gimbal angle speed command ack data structure.
Definition: psdk_cmdset_gimbal.h:185
psdk_f32_t rollAngle
Definition: psdk_cmdset_gimbal.h:196
Control gimbal calibration command ack data structure.
Definition: psdk_cmdset_gimbal.h:237
Control gimbal return head command ack data structure.
Definition: psdk_cmdset_gimbal.h:165
Get gimbal state command request data structure.
Definition: psdk_cmdset_gimbal.h:111
psdk_f32_t pitchAngle
Definition: psdk_cmdset_gimbal.h:195
int16_t rollSpeed
Definition: psdk_cmdset_gimbal.h:176
Control gimbal angle command ack data structure.
Definition: psdk_cmdset_gimbal.h:203
uint8_t gimbalMode
Definition: psdk_cmdset_gimbal.h:121
int16_t yawJointAngle
Definition: psdk_cmdset_gimbal.h:215
Get gimbal calibration progress command request data structure.
Definition: psdk_cmdset_gimbal.h:246
Get gimbal additional status command request data structure.
Definition: psdk_cmdset_gimbal.h:264
int16_t yaw
Definition: psdk_cmdset_gimbal.h:134
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:204
psdk_f32_t yawAngle
Definition: psdk_cmdset_gimbal.h:197
int16_t yawSpeed
Definition: psdk_cmdset_gimbal.h:177
int16_t pitchSpeed
Definition: psdk_cmdset_gimbal.h:175
Control gimbal angle speed command request data structure.
Definition: psdk_cmdset_gimbal.h:174
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:150
Set gimbal mode command request data structure.
Definition: psdk_cmdset_gimbal.h:142
Get gimbal function support state command ack data structure.
Definition: psdk_cmdset_gimbal.h:289
Control gimbal angle command request data structure.
Definition: psdk_cmdset_gimbal.h:194
PSDK core include file.
Control gimbal return head command request data structure.
Definition: psdk_cmdset_gimbal.h:158
int16_t roll
Definition: psdk_cmdset_gimbal.h:132
int16_t pitch
Definition: psdk_cmdset_gimbal.h:130
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:290
float rotationSpeedPitch
Definition: psdk_cmdset_gimbal.h:273
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:272
Get gimbal function support state command request data structure.
Definition: psdk_cmdset_gimbal.h:282
uint8_t isPitchLimit
Definition: psdk_cmdset_gimbal.h:127
uint8_t isYawLimit
Definition: psdk_cmdset_gimbal.h:125
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:222
Get gimbal additional status command ack data structure.
Definition: psdk_cmdset_gimbal.h:271
uint8_t status
Definition: psdk_cmdset_gimbal.h:257
uint8_t progress
Definition: psdk_cmdset_gimbal.h:256
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:119
Get gimbal calibration progress command ack data structure.
Definition: psdk_cmdset_gimbal.h:253
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:186
uint8_t isRollLimit
Definition: psdk_cmdset_gimbal.h:126
uint8_t ctrlFlag
Definition: psdk_cmdset_gimbal.h:178
Get gimbal state command ack data structure.
Definition: psdk_cmdset_gimbal.h:118
int16_t pitchJointAngle
Definition: psdk_cmdset_gimbal.h:213
uint8_t gimbalMode
Definition: psdk_cmdset_gimbal.h:143
uint8_t ackCode
Definition: psdk_cmdset_gimbal.h:254