Skip to main content

AUTELDroneGimbal

class AUTELDroneGimbal​

describe:Get real-time gimbal status and send command to control gimbal.

@interface AUTELDroneGimbal : NSObject

property drone​

describe:Returns a instance of AUTELDrone. drone.gimbal is the same as self.

@property (weak, nonatomic, readonly) AUTELDrone *drone;

property delegate​

describe:Returns drone gimbal delegate object.

@property (weak, nonatomic) id<AUTELDroneGimbalDelegate> delegate;

method startUpdataGimbalState​

- (void)startUpdataGimbalState;

describe:Start to update gimbal states.

The -gimbalController:didUpdateGimbalState will be called by calling this function. To stop update gimbal states, call -stopUpdateGimbalState function.


method stopUpsataGimbalState​

- (void)stopUpsataGimbalState;

describe:Stop to update gimbal states.

By calling this function, gimbalControlller:didUpdateGimbalState will not be invoked any more until startUpdateGimbalStaten is called again.


method setGimbalWorkMode:withCompletion​

- (void)setGimbalWorkMode:(AUTELDroneGimbalWorkMode)workMode withCompletion:(AUTELCompletionBlock)block;

describe:Set working mode of gimbal.

Input parameters:

workMode:Work mode.

block:AUTELCompletionBlock,Completion block .


method getGimbalWorkModeWithCompletion​

- (void)getGimbalWorkModeWithCompletion:(void (^)(AUTELDroneGimbalWorkMode workMode, NSError *_Nullable error))block;

describe:Get working mode of gimbal.

Input parameters:

block:Completion block. This block includes 2 parameters. One is the working mode of gimbal. another one is error which indicates error message. Error retuns nil if this function applies successfully.


method startGimbalAutoCalibrationWithCompletion​

- (void)startGimbalAutoCalibrationWithCompletion:(AUTELCompletionBlock)block;

describe:Trigger gimbal auto calibration.

If auto calibration succeeded, AUTELDroneGimbalState.isCalibrating turns to Yes, and calibrationProgress has a valid value.

Gimbal auto calibration will be failed if it is triggered while motors are on, and block returns AUTELSDKFlightControllerErrorMotorWorking error.

Input parameters:

block:AUTELCompletionBlock,Completion block .


method setGimbalPitch:withCompletion​

- (void)setGimbalPitch:(uint8_t)pitch withCompletion:(AUTELCompletionBlock)block;

describe:Set gimbal pitch.

AUTELDroneGimbalState.altitude changes value every time after pitch angle change applies.

Gimal wheel on the controller has a higher priority than this function. If the user use gimbal wheel and app to change gimbal pitch angle at the same time. Gimbal maybe only accept the command from gimbal wheel.

Input parameters:

pitch:Gimbal pitch angle, from 0 to 90 degree. When it’s 0 degree, camera face to the front, and when it’s 90 degree, camera face to the ground.

block:AUTELCompletionBlock,Completion block .


method setGimbalPitchSpeed​

- (void)setGimbalPitchSpeed:(int32_t)pitchSpeed;

describe:Set the speed of gimbal pitch.

Gimbal pitch angle changes with speed setting. Gimbal operates 300ms for each call. If gimbal continue to tile up or down, invoke this function every 100ms to get optimized performace .

AUTELDroneGimbalState.altitude changes value every time after pitch angle change applies.

Gimal wheel on the controller has a higher priority than this function. If the user use gimbal wheel and app to change gimbal pitch angle at the same time. Gimbal maybe only accept the command from gimbal wheel.

Input parameters:

pitchSpeed:Set speed from 0 to 100, gimbal tiles up. Set speed from -100 to 0, gimbal tiles down.


method rotateWithRotation:withCompletion​

- (void)rotateWithRotation:(AUTELGimbalRotation *_Nonnull)rotation withCompletion:(nullable AUTELCompletionBlock)block;

describe:Rotating gimbal

Input parameters:

rotation:Rotation parameters

block:AUTELCompletionBlock,Completion block .


method fineTuneGimbalRollClockwise:withCompletion​

- (void)fineTuneGimbalRollClockwise:(BOOL)clockwise withCompletion:(AUTELCompletionBlock)block;

describe:Adjust gimbal roll axis angle from counterclockwise 10 degree to clockwise 10 degree. 0.2 degree for each adjustment.

Input parameters:

clockwise: If Yes, adjust the gimbal roll axis in clockwise direction. If no, adjust the gimbal roll axis in counterclockwise direction.

block:AUTELCompletionBlock,Completion block .


method fineTuneGimbalRollInDegree:gimbalAttitude:withCompletion​

- (void)fineTuneGimbalRollInDegree:(float)degree gimbalAttitude:(AUTELGimbalAttitudeType)attitude withCompletion:(AUTELCompletionBlock)block;

describe:Adjust the AUTELGimbalAttitudeType axis angle of the PTZ

Input parameters:

degree:axis adjust angle, range is (-10, 10) deg。

attitude:axis of the PTZ

block:AUTELCompletionBlock,Completion block .


method resetGimbalFineTuneDegreeWithCompletion​

- (void)resetGimbalFineTuneDegreeWithCompletion:(AUTELCompletionBlock)block;

describe:Set gimbal roll axis angle to 0 degree.

Input parameters:

block:AUTELCompletionBlock,Completion block .


method getGimbalFineTuneDegreeWithCompletion​

- (void)getGimbalFineTuneDegreeWithCompletion:(void(^)(float pitchDigree, float yawDigree, float rollDigree, NSError *_Nullable error))block;

describe:Get current gimbal pitch,yaw and roll axis angle.

Input parameters:

block:this block includes 4 parameters. xxxDegree indicates the angle; digree > 0 indicates clockwise direction, while digree < 0 indicates counterclockwise direction. Error indicates the error message. If this function applies successfully, error is nil.


method getGimbalFineTuneDegreeWithCompletion​

-(void)getGimbalCapabilityWithCompletion:(void(^_Nullable)(NSDictionary *_Nullable capability, NSError *_Nullable error))block;

describe:get Gimbal angle and angular velocity range

Input parameters:

block:Completion block. This block includes 2 parameters. One is Gimbal angle and angular velocity rang. another one is error which indicates error message. Error retuns nil if this function applies successfully.


method resetGimbalRotation:withCompletion​

- (void)resetGimbalRotation:(AUTELGimbalRotation *_Nonnull)rotation withCompletion:(AUTELCompletionBlock)block;

describe:Reset the gimbal angle

Input parameters:

rotation:the gimbal axis: pitch, roll, yaw

block:AUTELCompletionBlock,Completion block .


method rotateToMaxAngleWithRotation:withCompletion​

- (void)rotateToMaxAngleWithRotation:(AUTELGimbalRotation *_Nonnull)rotation withCompletion:(AUTELCompletionBlock)block;

describe:Gimbal turns to the maximum limit

Input parameters:

rotation:the gimbal axis: pitch, roll, yaw

block:AUTELCompletionBlock,Completion block .


method rotateToMinAngleWithRotation:withCompletion​

- (void)rotateToMinAngleWithRotation:(AUTELGimbalRotation *_Nonnull)rotation withCompletion:(AUTELCompletionBlock)block;

describe:Gimbal turns to the minimum limit

Input parameters:

rotation:the gimbal axis: pitch, roll, yaw

block:AUTELCompletionBlock,Completion block .


method startCalibrationWithCompletion​

- (void)startCalibrationWithCompletion:(AUTELCompletionBlock)block;

describe:Start Gimbal calibration

Input parameters:

block:AUTELCompletionBlock,Completion block .


method getGimbalPitchAngleRangeWithCompletion​

- (void)getGimbalPitchAngleRangeWithCompletion:(void (^_Nullable)(AUTELDroneGimbalPitchAngleRange rangeType, NSError *_Nullable error))block;

describe:Get pitch angle range type:[0~90°] or [-30~90°]

Input parameters:

rangeType:range type:[0~90°] or [-30~90°]

block:Completion block. This block includes 2 parameters. One is pitch angle range type. another one is error which indicates error message. Error retuns nil if this function applies successfully.


enum AUTELDroneGimbalWorkMode​

describe:Define gimbal work mode.

typedef NS_ENUM(uint8_t, AUTELDroneGimbalWorkMode){
/**
* Free mode
*
*/
GimbalAttitudMode,

/**
* FPV mode
*
*/
GimbalFpvMode,

/**
* Follow mode
*/
GimbalYawFollowMode,

/**
* Panorama,Tracking mode
*
*/
GimbalPanoramaMode,

/**
* Unknown
*
*/
GimbalWorkModeUnknown = 0xFF,
}

enum AUTELGimbalRotationMode​

describe:The mode of the gimbal rotation operation.

typedef NS_ENUM(NSInteger, AUTELGimbalRotationMode) {
/**
* The angle value, when the gimbal is rotating, relative to 0 degrees (aircraft
* heading).
*/
AUTELGimbalRotationModeAbsoluteAngle,

/**
* Rotate the gimbal's pitch, roll, and yaw in SPEED Mode. The direction can either
* be set to clockwise or counter-clockwise.
* For Phantom 3 Professional, Phantom 3 Advanced and Phantom 3 Standard, roll and
* yaw rotations are not available.
* For Inspire 1, Inspire Pro and M100, pitch, roll and yaw rotations are
* available.
* For Osmo, roll rotation is not available. The yaw angleVelocity of
* DJIGimbalSpeedRotation range is (0, 120).
*/
AUTELGimbalRotationModeSpeed
};

enum AUTELGimbalCalibrationStatus​

describe:Define Gimbal Calibration Status.

typedef NS_ENUM(NSInteger, AUTELGimbalCalibrationStatus) {
/**
* @brief not calibrated
*
*/
AUTELGimbalCalibrationNone = 0,

/**
* @brief Gimbal ready for calibration
*
*/
AUTELGimbalCalibrationReady = 1,

/**
* @brief Gimbal is Calibrating
*
*/
AUTELGimbalCalibrationInProgress = 2,

/**
* @brief Gimbal calibration completed, ready to save data
*
*/
AUTELGimbalCalibrationSavingData = 3,

/**
* @brief Gimbal calibration failed
*
*/
AUTELGimbalCalibrationFailed = 4,

/**
* @brief Gimbal save data failed
*
*/
AUTELGimbalCalibrationSavingDataFailed = 5,

/**
* @brief Gimbal calibration success
*
*/
AUTELGimbalCalibrationSuccess = 6,

/**
* @brief Gimbal unable to calibrate, the aircraft is leaning
*
*/
AUTELGimbalCalibrationAircraftLeans = 7,

/**
* @brief Gimbal unable to calibrate, the aircraft is shaking
*
*/
AUTELGimbalCalibrationAircraftShaking = 8,

/**
* @brief Gimbal unable to calibrate, the aircraft motor is turning
*
*/
AUTELGimbalCalibrationAircraftMotorWorking = 9,
};

enum AUTELGimbalAttitudeType​

describe:Gimbal attitude type

typedef NS_ENUM(NSInteger, AUTELGimbalAttitudeType) {
/**
* @brief Gimbal pitch angle (°)
*
*/
AUTELGimbalAttitudeTypePitch,
/**
* @brief Gimbal roll angle (°)
*
*/
AUTELGimbalAttitudeTypeRoll,
/**
* @brief Gimbal yaw angle (°)
*
*/
AUTELGimbalAttitudeTypeYaw,
};

enum AUTELGimbalMotorStatus​

describe:Gimbal Motor Status

typedef NS_ENUM(NSInteger, AUTELGimbalMotorStatus) {
/**
* @brief normal
*
*/
AUTELGimbalMotorStatusNone = 0,

/**
* @brief Gimbal motor stall protection
*
*/
AUTELGimbalMotorStatusProtection = 1,

/**
* @brief Gimbal motor close
*
*/
AUTELGimbalMotorStatusClose = 2

};

enum AUTELDroneGimbalPitchAngleRange​

describe:Define the Angle range type of the gimbal pitch。

typedef NS_ENUM(uint8_t, AUTELDroneGimbalPitchAngleRange){
/**
* Angle Range:[0~90°]
*
*/
AUTELDroneGimbalPitchAngleRangeType1 = 0,

/**
* Angle Range:[-30~90°]
*
*/
AUTELDroneGimbalPitchAngleRangeType2 = 1,

/**
* Unknown
*
*/
AUTELDroneGimbalPitchAngleRangeUnknown = 0xFF,
};

struct AUTELGimbalAttitude​

describe:Gimbal attitude

typedef struct {
/**
* @brief Gimbal pitch angle (°)
*
*/
float pitch;
/**
* @brief Gimbal roll angle (°)
*
*/
float roll;
/**
* @brief Gimbal yaw angle (°)
*
*/
float yaw;
} AUTELGimbalAttitude;

struct AUTELGimbalAngleSpeed​

describe:Define Speed of each axis of gimbal

typedef struct {
/**
* @brief Gimbal pitch speed
*
*/
float pitchSpeed;

/**
* @brief Gimbal yaw speed
*
*/
float yawSpeed;

/**
* @brief Gimbal roll speed
*
*/
float rollSpeed;
}AUTELGimbalAngleSpeed;

class AUTELGimbalRotation​

describe:Represents a gimbal speed or angular rotation operation.

property mode​

@property (nonatomic, assign, readonly) AUTELGimbalRotationMode mode;

describe:Type of gimbal rotation operation mode.


property pitch​

@property (nonatomic, strong, nullable, readonly) NSNumber *pitch;

describe:The pitch property of a gimbal rotation operation, how much the gimbal rotates on the pitch axis.


property roll​

@property (nonatomic, strong, nullable, readonly) NSNumber *roll;

describe:The roll property of a gimbal rotation operation, how much the gimbal rotates on

the roll axis.


property yaw​

@property (nonatomic, strong, nullable, readonly) NSNumber *yaw;

describe:The yaw property of a gimbal rotation operation, how much the gimbal rotates on

the yaw axis.


method gimbalRotationWithPitchValue:rollValue:yawValue:mode​

+ (nullable instancetype)gimbalRotationWithPitchValue:(nullable NSNumber *)pitchValue
rollValue:(nullable NSNumber *)rollValue
yawValue:(nullable NSNumber *)yawValue
mode:(AUTELGimbalRotationMode)mode;

describe:Constructor for AUTELGimbalRotation.

Input parameters:

pitchValue:NSNumber object of pitch value.

rollValue:NSNumber object of roll value.

yawValue:NSNumber object of yaw value.

mode:An enum value of AUTELGimbalRotationMode.

output parameters:Instance of AUTELGimbalRotation.


class AUTELDroneGimbalState​

describe:This class saves the info of gimbal states.

@interface AUTELDroneGimbalState : NSObject<NSCopying>

property attitude​

@property(nonatomic) AUTELGimbalAttitude attitude;

describe:Returns gimbal attitude info. For X-Star and X-Star Premium, only attitude.pitch property is valid.


property isAttitudeAvailable​

@property(nonatomic) BOOL isAttitudeAvailable;

describe:Check if gimbal attitude is initialized. If Yes, attitude has a valid value.


property workMode​

@property(nonatomic) AUTELDroneGimbalWorkMode workMode;

describe:Returns working mode of gimbal.


property isCalibrating​

@property(nonatomic) BOOL isCalibrating;

describe:Returns YES if gimbal is calibrating, else NO.


property calibrationStatus​

@property(nonatomic) AUTELGimbalCalibrationStatus calibrationStatus;

describe:gimbal calibration status


property gimbalMotorStatus​

@property(nonatomic) AUTELGimbalMotorStatus gimbalMotorStatus;

describe:gimbal motor status


property calibrationProgress​

@property(nonatomic) uint8_t calibrationProgress;

describe:Returns calibration progress value from 0 to 100. Only if isCalibrating is set to Yes, calibrationProgress has a valid value.


property isRollReachMax​

@property(nonatomic) BOOL isRollReachMax;

describe:Returns a Boolean value which indicates whether gimbal reach roll axis maximum angle.


property isOverheat​

@property(nonatomic) BOOL isOverheat;

describe:If the Gimbal is overheated, return YES, otherwise return NO.


property isHardwareFail​

@property(nonatomic) BOOL isHardwareFail;

describe:Return YES if the Gimbal hardware failure occurs, otherwise return NO


property isSleepForNoAttitude​

@property(nonatomic) BOOL isSleepForNoAttitude;

describe:Returns a boolean value which indicates whether gimbal is in sleep mode because of no coming attitude data.


property isSleepForRollReachMax​

@property(nonatomic) BOOL isSleepForRollReachMax;

describe:Returns a Boolean value which indicates whether gimbal is in sleep mode because of reaching roll axis maximum angle.


property isWorkError​

@property(nonatomic) BOOL isWorkError;

describe:Returns a Boolean value indicating whether PTZ reports an error.


protocol AUTELDroneGimbalDelegate​

describe:Provides delegate to update real-time status of gimbal.

@protocol AUTELDroneGimbalDelegate<NSObject>

method gimbalController:didUpdateGimbalState​

-(void) gimbalController:(AUTELDroneGimbal * _Nonnull)controller didUpdateGimbalState:(AUTELDroneGimbalState* _Nonnull)gimbalState NS_SWIFT_NAME(gimbalController(_:didUpdateGimbalState:));

describe:Update current status of gimbal. After the app connect to the aircraft, the instance of AUTELDroneGimbal object call startUpdataGimbalState method 5 times per second.

To invoke this call back method, AUTELDroneGimbal.starUpdataGimbalState has to be called first. To stop this call back method, call AUTELDroneGimbal.stopUpdataGimbalState. This call back method won’t be invoked until AUTELDroneGimbal.starUpdataGimbalState is called again.

Input parameters:

controller:The instance of gimbal object.

gimbalState: Current state of gimbal.