dji_gimbal_module.hpp
Go to the documentation of this file.
1 
29 #ifndef ONBOARDSDK_DJI_GIMBAL_MODULE_HPP
30 #define ONBOARDSDK_DJI_GIMBAL_MODULE_HPP
31 
32 #include <vector>
33 #include "dji_payload_base.hpp"
34 #include "dji_payload_link.hpp"
35 
36 namespace DJI {
37 namespace OSDK {
38 
41 class Linker;
42 
45 class GimbalModule : public PayloadBase {
46  public:
47 
50  enum GimbalWorkMode : uint8_t {
54  WORK_MODE_DONT_CHANGE = 254,
55  };
56 
59  enum ReturnCenterCMD : uint8_t {
60  CENTER = 1,
61  SELFIE = 2,
63  PITCH_ONLY = 4,
64  ROLL_ONLY = 5,
65  YAW_ONLY = 6,
66  };
67 
68 #pragma pack(1)
69  typedef uint8_t retCodeType;
70 
71  typedef struct Rotation {
76  uint8_t rotationMode;
79  float pitch;
82  float roll;
85  float yaw;
88  double time;
89  } Rotation;
90 
91  typedef struct gimbalAngleSetting
92  {
95  int16_t yaw_angle;
98  int16_t roll_angle;
101  int16_t pitch_angle;
104  int16_t allowance;
107  uint8_t reserved :1;
110  uint8_t yaw_follow_enabled :1;
113  uint8_t is_pitch_control_invalid:1;
116  uint8_t is_roll_control_invalid :1;
119  uint8_t is_yaw_control_invalid :1;
124  uint8_t coordinate :1;
128  uint8_t reference :1;
133  uint8_t is_control :1;
138  uint8_t timeout;
141  uint16_t time_for_action;
142  uint8_t reserved_13_byte :7;
146  uint8_t atti_or_joint_ref:1;
147  } gimbalAngleSetting;
148 
149 
150  typedef struct gimbalWorkModeAndReturnCenterSetting
151  {
154  GimbalWorkMode workMode;
157  ReturnCenterCMD returnCenterCmd;
158  } gimbalWorkModeAndReturnCenterSetting;
159 #pragma pack()
160 
165  typedef struct callbackWarpperHandler {
166  void (*cb)(ErrorCode::ErrorCodeType retCode, UserData userData);
167  UserData udata;
169 
170  public:
171  GimbalModule(Linker *linker, PayloadIndexType payloadIndex,
172  std::string name, bool enable);
173 
174  ~GimbalModule();
175 
184  void resetAsync(void (*UserCallBack)(ErrorCode::ErrorCodeType retCode,
185  UserData userData),
186  UserData userData);
187 
193  ErrorCode::ErrorCodeType resetSync(int timeout);
194 
206  void rotateAsync(Rotation rotation,
207  void (*UserCallBack)(ErrorCode::ErrorCodeType retCode,
208  UserData userData),
209  UserData userData);
210 
218  ErrorCode::ErrorCodeType rotateSync(Rotation rotation, int timeout);
219 
220 }; /* GimbalModule */
221 } // namespace OSDK
222 } // namespace DJI
223 
224 #endif // ONBOARDSDK_DJI_GIMBAL_MODULE_HPP
void * UserData
This is used as the datatype for all data arguments in callbacks.
Definition: dji_type.hpp:75
int64_t ErrorCodeType
Unified error type.
Definition: dji_error.hpp:144
Definition: dji_gimbal_module.hpp:52
PayloadBase.
Definition: dji_payload_base.hpp:54
PayloadIndexType
The payload Index of camera.
Definition: dji_payload_base.hpp:42
void resetAsync(void(*UserCallBack)(ErrorCode::ErrorCodeType retCode, UserData userData), UserData userData)
reset gimbal in pitch and yaw, non-blocking calls
Definition: dji_gimbal_module.hpp:65
ReturnCenterCMD
the work mode of gimbal
Definition: dji_gimbal_module.hpp:59
Abstract protocol implementation for payload module.
struct DJI::OSDK::GimbalModule::callbackWarpperHandler callbackWarpperHandler
Definition: dji_gimbal_module.hpp:62
Definition: dji_gimbal_module.hpp:60
void rotateAsync(Rotation rotation, void(*UserCallBack)(ErrorCode::ErrorCodeType retCode, UserData userData), UserData userData)
reset gimbal in pitch and yaw, non-blocking calls
Definition: dji_gimbal_module.hpp:53
Definition: dji_gimbal_module.hpp:64
Definition: dji_ack.cpp:38
Definition: dji_gimbal_module.hpp:61
gimbal module
Definition: dji_gimbal_module.hpp:45
ErrorCode::ErrorCodeType resetSync(int timeout)
reset gimbal in pitch and yaw, blocking calls
Definition: dji_gimbal_module.hpp:165
Definition: dji_gimbal_module.hpp:63
Definition: dji_gimbal_module.hpp:51
ErrorCode::ErrorCodeType rotateSync(Rotation rotation, int timeout)
rotate gimbal angle, blocking calls
GimbalWorkMode
the work mode of gimbal
Definition: dji_gimbal_module.hpp:50