DJIFlightController

@interface DJIFlightController : DJIBaseComponent

This class contains components of the flight controller and provides methods to send different commands to the flight controller.

  • Flight controller delegate.

    Declaration

    Objective-C

    @property (readwrite, nonatomic)
        id<DJIFlightControllerDelegate> _Nullable delegate;
  • Flight limitation object. This object sets, gets and tracks the state of the maximum flight height and radius allowed.

    Declaration

    Objective-C

    @property (readonly, nonatomic) DJIFlightLimitation *_Nullable flightLimitation;
  • Landing Gear object. For products with moveable landing gear only. It is supported by Inspire 1, Matrice 600, Matrice 600 Pro and Inspire 2.

    Declaration

    Objective-C

    @property (readonly, nonatomic) DJILandingGear *_Nullable landingGear;
  • Compass object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) DJICompass *_Nullable compass;
  • rtk

    RTK positioning object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) DJIRTK *_Nullable rtk;
  • Intelligent flight assistant.

    Declaration

    Objective-C

    @property (readonly, nonatomic)
        DJIIntelligentFlightAssistant *_Nullable intelligentFlightAssistant;
  • Simulator object.

    Declaration

    Objective-C

    @property (readonly, nonatomic) DJISimulator *_Nullable simulator;
  • The number of IMU module in the flight controller. Most products have 1 IMU

    Exceptions: - Phantom 4, Phantom 4 Pro, Mavic Pro and Inspire 2 have 2 IMUs - A3, Matrice 600 and Matrice 600 Pro have 1 inner IMU and can have at most 2 external IMUs. - N3 has 2 inner IMUs and can have 1 external IMU.

    Declaration

    Objective-C

    @property (readonly, nonatomic) NSUInteger numberOfIMUs;
  • Vertical control mode.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        DJIVirtualStickVerticalControlMode verticalControlMode;
  • Roll/Pitch control mode.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        DJIVirtualStickRollPitchControlMode rollPitchControlMode;
  • Yaw control mode.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        DJIVirtualStickYawControlMode yawControlMode;
  • Roll/Pitch control coordinate system.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic)
        DJIVirtualStickFlightCoordinateSystem rollPitchCoordinateSystem;
  • YES if Virtual Stick advanced mode is enabled. By default, it is NO. When advanced mode is enabled, the aircraft will compensate for wind when hovering and the GPS signal is good. For the Phantom 4, collision avoidance can be enabled for virtual stick control if advanced mode is on, and collision avoidance is enabled in DJIIntelligentFlightAssistant.

    It is only supported by flight controller firmware versions 3.1.x.x or above.

    Declaration

    Objective-C

    @property (assign, readwrite, nonatomic) BOOL virtualStickAdvancedModeEnabled;
  • YES if the landing gear is supported for the connected aircraft.

    Declaration

    Objective-C

    - (BOOL)isLandingGearMovable;
  • Starts aircraft takeoff. Takeoff is considered complete when the aircraft is hovering 1.2 meters (4 feet) above the ground. Completion block is called when aircraft crosses 0.5 meters (1.6 feet).

    If the motors are already on, this command can not be executed.

    Declaration

    Objective-C

    - (void)takeoffWithCompletion:(DJICompletionBlock)completion;
  • Stops aircraft takeoff. If called before takeoffWithCompletion is complete, the aircraft will cancel takeoff (takeoffWithCompletion completion block will return an error) and hover at the current height.

    Declaration

    Objective-C

    - (void)cancelTakeoffWithCompletion:(DJICompletionBlock)completion;
  • Starts auto-landing of the aircraft. Landing is considered complete once the aircraft lands on the ground, and powers down propellors to medium throttle.

    Declaration

    Objective-C

    - (void)autoLandingWithCompletion:(DJICompletionBlock)completion;
  • Stops auto-landing the aircraft. If called before startAutoLandingWithCompletion is complete, the auto landing will be cancelled (startAutoLandingWithCompletion completeion block will return an error) and the aircraft will hover at its current location.

    Declaration

    Objective-C

    - (void)cancelAutoLandingWithCompletion:(DJICompletionBlock)completion;
  • Turns on the aircraft’s motors. It is supported by flight controller firmware 3.1.0.0 or above.

    Declaration

    Objective-C

    - (void)turnOnMotorsWithCompletion:(DJICompletionBlock)completion;
  • Turns off the aircraft’s motors. The method can only be called when the aircraft is on the ground.

    Declaration

    Objective-C

    - (void)turnOffMotorsWithCompletion:(DJICompletionBlock)completion;
  • The aircraft will start to go home. This method is considered complete once the aircraft has landed at its home position.

    Declaration

    Objective-C

    - (void)goHomeWithCompletion:(DJICompletionBlock)completion;
  • The aircraft will stop going home and will hover in place. The goHomeWithCompletion completion block will immediately return an error.

    Declaration

    Objective-C

    - (void)cancelGoHomeWithCompletion:(DJICompletionBlock)completion;
  • Sets the home location of the aircraft. The home location is where the aircraft goes to when commanded by goHomeWithCompletion, when the signal to the aircraft is lost or when the battery is below the lowBatteryWarning threshold. The user should be careful where they set a new home point location as in some scenarios the product will not be under user control when going to this location. A home location is valid if it is within 30m of initial take-off location, current aircraft’s location, current mobile location with at least kCLLocationAccuracyNearestTenMeters accuracy level, or current remote controller’s location as shown by RC GPS.

    Note: If setting home point around mobile location, before calling this method, the locationServicesEnabled must be true in CLLocationManager, the NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription key needs to be specified in the applications Info.plist and the requestWhenInUseAuthorization or requestAlwaysAuthorization method of CLLocationManager object needs to be called to get the user’s permission to access location services.

    Declaration

    Objective-C

    - (void)setHomeLocation:(CLLocationCoordinate2D)homePoint
             withCompletion:(DJICompletionBlock)completion;

    Parameters

    homeLocation

    Home location latitude and longitude in degrees.

    completion

    Completion block.

  • Sets the home location of the aircraft with the current location of the aircraft. See setHomeLocation:withCompletion: for details on when the home point is used.

    Declaration

    Objective-C

    - (void)setHomeLocationUsingAircraftCurrentLocationWithCompletion:
        (DJICompletionBlock)completion;
  • Gets the home point of the aircraft.

    Declaration

    Objective-C

    - (void)getHomeLocationWithCompletion:
        (void (^_Nonnull)(CLLocationCoordinate2D, NSError *_Nullable))completion;
  • Sets the minimum altitude, relative to where the aircraft took off, at which the aircraft must be before going home. This can be useful when the user foresees obstacles in the aircraft’s way. If the aircraft’s current altitude is higher than the minimum go home altitude, it will go home at its current altitude. The valid range for the altitude is from 20m to 500m.

    Declaration

    Objective-C

    - (void)setGoHomeAltitude:(float)altitude
               withCompletion:(DJICompletionBlock)completion;

    Parameters

    altitude

    Aircraft’s minimum go home altitude.

    completion

    Completion block.

  • Gets the minimum altitude the aircraft must be at before going home.

    Declaration

    Objective-C

    - (void)getGoHomeAltitudeWithCompletion:
        (void (^_Nonnull)(float, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block.

  • Sets the FailSafe action for when the connection between remote controller and aircraft is lost.

    Declaration

    Objective-C

    - (void)setFlightFailsafeOperation:(DJIFlightFailsafeOperation)operation
                        withCompletion:(DJICompletionBlock)completion;

    Parameters

    operation

    The Failsafe action.

    completion

    Completion block.

  • Gets the FailSafe action for when the connection between remote controller and aircraft is lost.

    Declaration

    Objective-C

    - (void)getFlightFailsafeOperationWithCompletion:
        (void (^_Nonnull)(DJIFlightFailsafeOperation,
                          NSError *_Nullable))completion;
  • Check if the onboard SDK device is available.

    Declaration

    Objective-C

    - (BOOL)isOnboardSDKDeviceAvailable;
  • If there is a device connected to the aircraft using the Onboard SDK, this method will send data to that device. The size of the data cannot be greater than 100 bytes, and will be sent in 40 byte increments every 14ms. This method is only supported on products that support the Onboard SDK (Matrice 100).

    Declaration

    Objective-C

    - (void)sendDataToOnboardSDKDevice:(NSData *_Nonnull)data
                        withCompletion:(DJICompletionBlock)completion;

    Parameters

    data

    Data to be sent to the external device.

    completion

    Completion block.

  • Sets the low battery go home percentage threshold. The percentage must be in the range [25, 50].

    Declaration

    Objective-C

    - (void)setGoHomeBatteryThreshold:(uint8_t)percent
                       withCompletion:(DJICompletionBlock)completion;

    Parameters

    percent

    Low battery warning percentage.

    completion

    Completion block.

  • Gets the go home battery percentage threshold. The value of the percent parameter must be in the range [25, 50].

    Declaration

    Objective-C

    - (void)getGoHomeBatteryThresholdWithCompletion:
        (void (^_Nonnull)(uint8_t, NSError *_Nullable))completion;
  • Sets the serious battery land immediately percentage threshold. The percentage must be in the range [10, 25].

    Declaration

    Objective-C

    - (void)setLandImmediatelyBatteryThreshold:(uint8_t)percent
                                withCompletion:(DJICompletionBlock)completion;

    Parameters

    percent

    Serious low battery warning percentage.

    completion

    Completion block.

  • Gets the land immediately battery percentage threshold. The value of the percent parameter must be in the range [10, 25].

    Declaration

    Objective-C

    - (void)getLandImmediatelyBatteryThresholdWithCompletion:
        (void (^_Nonnull)(uint8_t, NSError *_Nullable))completion;
  • Start the calibration for IMU. For aircrafts with multiple IMUs, this method will start the calibration for all IMUs. Please keep stationary and horizontal during calibration. The calibration will take 5 ~ 10 minutes. The completion block will be called once the calibration is started. Please use the [flightController:didUpdateIMUState:] method in ‘DJIFlightControllerDelegate’ to check the execution status of the IMU calibration.

    Declaration

    Objective-C

    - (void)startIMUCalibrationWithCompletion:(DJICompletionBlock)completion;

    Parameters

    completion

    Completion block to check if the calibration starts successfully.

  • Start the calibration for IMU with a specific ID. Please keep stationary and horizontal during calibration. The calibration will take 5 ~ 10 minutes. The completion block will be called once the calibration is started. Use the [flightController:didUpdateIMUState:] method in DJIFlightControllerDelegate to check the execution status of the IMU calibration. Only supported by Matrice 600.

    Declaration

    Objective-C

    - (void)startIMUCalibrationForID:(NSUInteger)imuID
                      withCompletion:(DJICompletionBlock)completion;

    Parameters

    imuID

    The IMU with the specific ID to calibrate.

    completion

    Completion block to check if the calibration starts successfully.

  • Confirms to continue the landing action. When the clearance between the aircraft and the ground is less than 0.3m, the aircraft will pause landing and wait for user’s confirmation. Can use isLandingConfirmationNeeded in DJIFlightControllerCurrentState to check if confirmation is needed.

    It is supported by flight controller firmware 3.2.0.0 or above.

    Declaration

    Objective-C

    - (void)confirmLandingWithCompletion:(DJICompletionBlock)completion;
  • Turns on/off the LEDs in the front. The LEDs are used to indicate the status of the aircraft. By default, it is on. It is only supported by Phantom 3 series, Phantom 4, Phantom 4 Pro, Mavic Pro and Inspire 2.

    Declaration

    Objective-C

    - (void)setLEDsEnabled:(BOOL)enabled
            withCompletion:(DJICompletionBlock)completion;

    Parameters

    enabled

    YES to turn on the front LEDs, NO to turn off.

    completion

    Completion block that receives the setter execution result.

  • Gets if the LEDs in the front is enabled or not. It is only supported by Phantom 3 series, Phantom 4, Phantom 4 Pro, Mavic Pro and Inspire 2.

    Declaration

    Objective-C

    - (void)getLEDsEnabledWithCompletion:
        (void (^_Nonnull)(BOOL, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Sets the control mode of the flight controller. By default the value is DJIFlightControllerControlModeSmart. It is highly recommended to keep the default value. See DJIFlightControllerControlMode for details. It is only supported by stand-alone A3.

    Declaration

    Objective-C

    - (void)setControlMode:(DJIFlightControllerControlMode)mode
            withCompletion:(DJICompletionBlock)completion;

    Parameters

    mode

    Control mode to set.

    completion

    Completion block that receives the setter execution result.

  • Gets the control mode of the flight controller. It is only supported by A3.

    Declaration

    Objective-C

    - (void)getControlModeWithCompletion:
        (void (^_Nonnull)(DJIFlightControllerControlMode,
                          NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter execution result.

  • Enable/disable tripod mode. Tripod Mode drops the aircraft’s maximum speed to 2.2mph (3.6kph), and significantly reduces the control stick sensitivity of the remote controller to give the user the precision needed for accurate framing. When tripod mode is enabled, missions, terrain follow mode, course lock and home lock are not allowed. Tripod mode is not allowed if the aircraft is running a mission. If GPS or vision positioning isn’t available, tripod mode cannot be enabled. If the GPS and/or the vision system is providing the flight controller with velocity information then the aircraft will be able to automatically compensate for wind. If however, position information is not available, then manual intervention will be required, but the user should beware any manual compensation will be limited due to the reduced maximum velocity and sensitivity. If GPS and vision position become unavailable during tripod mode, it is recommended to alert the user and disable tripod mode.

    It is only supported by Mavic Pro.

    Declaration

    Objective-C

    - (void)setTripodModeEnabled:(BOOL)enabled
                  withCompletion:(DJICompletionBlock)completion;

    Parameters

    enabled

    YES to enable tripod mode.

    completion

    Completion block that receives the setter result.

  • Gets if tripod mode is enabled or not. It is only supported by Mavic Pro.

    Declaration

    Objective-C

    - (void)getTripodModeEnabledWithCompletion:
        (void (^_Nonnull)(BOOL, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter result.

  • Enable/disable terrain follow mode. The aircraft uses height information gathered by the onboard ultrasonic system, and its downward facing cameras to keep flying at the same height above the ground. It is only supported by Mavic Pro.

    Declaration

    Objective-C

    - (void)setTerrainFollowModeEnabled:(BOOL)enabled
                         withCompletion:(DJICompletionBlock)completion;

    Parameters

    enabled

    YES to enable terrain follow mode.

    completion

    Completion block that receives the setter result.

  • Gets if terrain follow mode is enabled or not. It is only supported by Mavic Pro.

    Declaration

    Objective-C

    - (void)getTerrainFollowModeEnabledWithCompletion:
        (void (^_Nonnull)(BOOL, NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter result.

  • Enable/disable Auto Quick Spin. When the gimbal reaches a yaw movement limit, the aircraft will automatically rotate the aircraft 360 degrees to uniwind the gimbal, allowing it to continue moving in the yaw direction. It is only available when the aircraft is flying at least 3m above the ground. Only supported by Inspire 2.

    Declaration

    Objective-C

    - (void)setAutoQuickSpinEnabled:(BOOL)enabled
                     withCompletion:(DJICompletionBlock)completion;

    Parameters

    enabled
     `YES` to enable Auto Quick Spin.
    

    @parma completion Completion block that receives the setter result.

  • Gets if Auto Quick Spin is enabled or not. Only supported by Inspire 2.

    @parma completion Completion block that receives the getter result.

    Declaration

    Objective-C

    - (void)getAutoQuickSpinEnabledWithCompletion:
        (void (^_Nonnull)(BOOL, NSError *_Nullable))completion;
  • Gets the mapping between the flight modes and the flight mode switch positions on the remote controller. Elements 0, 1 and 2 of mapping map to DJIRemoteControllerFlightModeSwitchPositionOne, DJIRemoteControllerFlightModeSwitchPositionTwo and DJIRemoteControllerFlightModeSwitchPositionThree of the flightModeSwitch in DJIRCHardwareState. Each element is an NSNumber instance with a value from DJIFlightControllerRemoteControllerFlightMode representing the flight mode. The mapping is fixed for Phantom series, Inspire series, Mavic Pro and the M100. For N3, A3, Matrice 600, and Matrice 600 Pro the mapping is firmware dependent. With firmware version 3.2.11.0 or above, the mapping can be customized in DJI Assistant 2.

    Declaration

    Objective-C

    - (void)getRemoteControllerFlightModeMappingWithCompletion:
        (void (^_Nonnull)(NSArray<NSNumber *> *_Nullable,
                          NSError *_Nullable))completion;

    Parameters

    completion

    Completion block that receives the getter result. Each element of mapping is an NSNumber instance with a value of DJIFlightControllerRemoteControllerFlightMode.