DJI Mobile SDK Documentation

      class DJICompass

      @interface DJICompass : NSObject
      Header:DJICompass.h
      Inherits From:NSObject
      Description:

      This class provides compass status information and compass calibration methods. Products with multiple compasses (like the Phantom 4) have their compass state fused into one compass class for simplicity.

      Class Members:
      Heading
      property
      property heading
      @property(nonatomic, readonly) double heading
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassHeading
      Description:

      Represents the heading, in degrees. True North is 0 degrees, positive heading is East of North, and negative heading is West of North. Heading bounds are [-180, 180].

      Error
      property
      property hasError
      @property(nonatomic, readonly) BOOL hasError
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassHasError
      Description:

      YES if the compass has an error. If YES, the compass needs calibration.

      Check Calibrating
      property
      property isCalibrating
      @property(nonatomic, readonly) BOOL isCalibrating
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassIsCalibrating
      Description:

      YES if the compass is currently calibrating.

      Calibration Status
      property
      property calibrationState
      @property(nonatomic, readonly) DJICompassCalibrationState calibrationState
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassCalibrationState
      Description:

      Shows the calibration status.

      See Also:

      DJICompassCalibrationState

      method startCalibrationWithCompletion
      - (void)startCalibrationWithCompletion:(DJICompletionBlock)completion
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassStartCalibration
      Description:

      Starts compass calibration. Make sure there are no magnets or metal objects near the compass.

      Input Parameters:
      DJICompletionBlock completionCompletion block that receives the execution result.
      method stopCalibrationWithCompletion
      - (void)stopCalibrationWithCompletion:(DJICompletionBlock)completion
      Header:DJICompass.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassStopCalibration
      Description:

      Stops compass calibration.

      Input Parameters:
      DJICompletionBlock completionCompletion block that receives the execution result.
      enum DJICompassCalibrationState
      typedef NS_ENUM (NSUInteger, DJICompassCalibrationState)
      Header:DJICompassCalibrationState.h
      SDK Key:DJIFlightControllerKey.DJIFlightControllerParamCompassCalibrationState
      Description:

      Compass Calibration Status.

      Enum Members:
      DJICompassCalibrationStateNotCalibratingNormal state. Compass not in calibration.
      DJICompassCalibrationStateHorizontalCompass horizontal calibration. The user should hold the aircraft horizontally and rotate it 360 degrees.
      DJICompassCalibrationStateVerticalCompass vertical calibration. The user should hold the aircraft vertically, with the nose pointed towards the ground, and rotate the aircraft 360 degrees.
      DJICompassCalibrationStateSuccessfulCompass calibration succeeded.
      DJICompassCalibrationStateFailedCompass calibration failed. Make sure there are no magnets or metal objects near the compass and retry.
      DJICompassCalibrationStateUnknownCompass calibration status unknown.