DJI Mobile SDK Documentation

      class FlightControllerState

      @EXClassNullAway
      class FlightControllerState
      Package:dji.common.flightcontroller
      Description:

      This class represents the current state of the flight controller.

      Class Members:

      State Updates


      Flight Information

      Motors
      method
      method areMotorsOn
      boolean areMotorsOn()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.ARE_MOTOR_ON
      Description:

      true if motors are on.

      Return:
      booleanA boolean value.
      Flight
      method
      method isFlying
      boolean isFlying()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_FLYING
      Description:

      true if aircraft is flying.

      Return:
      booleanA boolean value.
      method getAircraftLocation
      LocationCoordinate3D getAircraftLocation()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.AIRCRAFT_LOCATION_LATITUDE, FlightControllerKey.AIRCRAFT_LOCATION_LONGITUDE, FlightControllerKey.ALTITUDE
      Description:

      Gets the current location of the aircraft as a coordinate. nil if the location is invalid.

      Return:
      LocationCoordinate3DThe current location of the aircraft as a coordinate.
      method getTakeoffLocationAltitude
      float getTakeoffLocationAltitude()
      Package:dji.common.flightcontroller
      SDK Key:DJIFlightControllerParamTakeoffLocationAltitude
      Description:

      Relative altitude of the aircraft home location relative to sea level, in meters.

      Return:
      floatA float value of the altitude.
      method getAttitude
      Attitude getAttitude()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.ATTITUDE_PITCH, FlightControllerKey.ATTITUDE_ROLL, FlightControllerKey.ATTITUDE_YAW
      Description:

      Gets the attitude of the aircraft, where the pitch, roll, and yaw values will be in the range of [-180, 180] degrees. If its pitch, roll, and yaw values are 0, the aircraft will be hovering level with a True North heading.

      Return:
      AttitudeThe attitude of the aircraft.
      method getVelocityX
      float getVelocityX()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VELOCITY_X
      Description:

      Current speed of the aircraft in the x direction, in meters per second, using the N-E-D (North-East-Down) coordinate system.

      Return:
      floatA float value of the current speed of the aircraft in the x direction.
      method getVelocityY
      float getVelocityY()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VELOCITY_Y
      Description:

      Current speed of the aircraft in the y direction, in meters per second, using the N-E-D (North-East-Down) coordinate system.

      Return:
      floatA float value of the current speed of the aircraft in the y direction.
      method getVelocityZ
      float getVelocityZ()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VELOCITY_Z
      Description:

      Current speed of the aircraft in the z direction, in meters per second, using the N-E-D (North-East-Down) coordinate system.

      Return:
      floatA float value of the current speed of the aircraft in the z direction.
      method getFlightTimeInSeconds
      int getFlightTimeInSeconds()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.FLY_TIME_IN_SECONDS
      Description:

      The accumulated flight time, in seconds, since the aircraft's motors were turned on.

      Return:
      intAn int value of the flight time.


      Flight Actions

      method isLandingConfirmationNeeded
      boolean isLandingConfirmationNeeded()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_LANDING_CONFIRMATION_NEEDED
      Description:

      true if the clearance between the aircraft and the ground is less than 0.3m, and confirmation from the user is needed to continue the landing. When the confirmation is needed, confirmLanding in FlightController can be used to continue landing. It is supported by flight controller firmware 3.2.0.0 or above.

      Return:
      booleanWhether confirmation is needed or not.


      Flight Mode

      Mode
      method
      method getFlightMode
      FlightMode getFlightMode()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.FLIGHT_MODE
      Description:

      Flight controller flight mode. For more info, see https://developer.dji.com/document/a3bd20d1-9f1c-4f76-a9aa-46eb0d23cd82, the Flight Mode part.

      Return:
      FlightModeAn enum value of the FlightMode.
      Multi Mode
      method
      method isMultipleModeOpen
      boolean isMultipleModeOpen()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.MULTI_MODE_OPEN
      Description:

      Determines whether multiple flight modes are open. This will reflect whether navigation mode (ground station) is enabled.

      Return:
      booleantrue if the navigation mode is enabled.


      Sensors

      method getSatelliteCount
      int getSatelliteCount()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.SATELLITE_COUNT
      Description:

      Returns the GPS satellite count.

      Return:
      intThe double value of the GPS satellite count.
      method getGPSSignalLevel
      GPSSignalLevel getGPSSignalLevel()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.GPS_SIGNAL_LEVEL
      Description:

      Gets the aircraft's current GPS signal quality. If the return value is in [6,10], which means the RTK signal is strong.

      Return:
      GPSSignalLevelThe aircraft's current GPS signal quality.
      method isIMUPreheating
      boolean isIMUPreheating()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_IMU_PREHEATING
      Description:

      true if IMU is preheating.

      Return:
      booleanA boolean value.
      Ultrasonic Sensor
      method
      method isUltrasonicBeingUsed
      boolean isUltrasonicBeingUsed()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_ULTRASONIC_BEING_USED
      Description:

      true if the ultrasonic sensor is being used. Variables that can impact the quality of the ultrasound measurement, or whether it's being used, are height above ground and the type of ground (if it reflects sound waves well). Usually, the ultrasonic sensor works when the aircraft is less than 8m above ground.

      Return:
      booleanA boolean value.
      method getUltrasonicHeightInMeters
      float getUltrasonicHeightInMeters()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.ULTRASONIC_HEIGHT_IN_METERS
      Description:

      Height of aircraft measured by the ultrasonic sensor in meters. The data will only be available if isUltrasonicBeingUsed returns true. Height has a precision of 0.1m. This value has reference significance when the height is below 5 meters.

      Return:
      floatA float value of the height of the aircraft measured by the ultrasonic sensor in meters.
      method doesUltrasonicHaveError
      boolean doesUltrasonicHaveError()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.ULTRASONIC_ERROR
      Description:

      true if ultrasonic sensor has error.

      Return:
      booleantrue if ultrasonic sensor has error.
      method isVisionPositioningSensorBeingUsed
      boolean isVisionPositioningSensorBeingUsed()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_VISION_POSITIONING_SENSOR_BEING_USED
      Description:

      true if a vision sensor is being used. Variables that can impact the quality of the vision measurement, or whether it's being used, are height above ground and the type of ground (if it has sufficiently rich texture). Usually, the vision sensor works when the aircraft is less than 3m above ground.

      Return:
      booleanA boolean value.


      Flight Assistance

      Orientation Mode
      method
      method getOrientationMode
      FlightOrientationMode getOrientationMode()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.ORIENTATION_MODE
      Description:

      The aircraft's current orientation mode.

      Return:
      FlightOrientationModeAn enum value of FlightOrientationMode.
      Connection Fail Safe
      method
      method isFailsafeEnabled
      boolean isFailsafeEnabled()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_FAIL_SAFE
      Description:

      true if the signal is lost between remote controller and aircraft, and FailSafe is enabled.

      Return:
      booleanA boolean value.
      Remaining Battery
      method
      method getBatteryThresholdBehavior
      BatteryThresholdBehavior getBatteryThresholdBehavior()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.BATTERY_THRESHOLD_BEHAVIOR
      Description:

      Recommended action based on remaining battery life. Not supported by Mavic Air 2, DJI Air 2S.

      Return:
      BatteryThresholdBehaviorAn enum value of BatteryThresholdBehavior.
      Battery Warning Threshold
      method
      method isLowerThanBatteryWarningThreshold
      boolean isLowerThanBatteryWarningThreshold()
      Package:dji.common.flightcontroller
      Description:

      true if the battery is lower than the low battery warning threshold.

      Return:
      booleanA boolean value.
      method isLowerThanSeriousBatteryWarningThreshold
      boolean isLowerThanSeriousBatteryWarningThreshold()
      Package:dji.common.flightcontroller
      Description:

      true if the battery is lower than the serious low battery warning threshold.

      Return:
      booleanA boolean value.
      Wind Warning
      method
      method getFlightWindWarning
      FlightWindWarning getFlightWindWarning()
      Package:dji.common.flightcontroller
      Description:

      Warning related to high winds.

      Return:
      FlightWindWarningAn enum value of FlightWindWarning.
      Count of Flights
      method
      method getFlightCount
      int getFlightCount()
      Package:dji.common.flightcontroller
      Description:

      The count of flights within the battery life cycle. Cleared when power-on.

      Return:
      intAn int value of flight count.
      Flight Log Index
      method
      method getFlightLogIndex
      int getFlightLogIndex()
      Package:dji.common.flightcontroller
      Description:

      The current index of the flight log on the aircraft. It is useful to find the corresponding flight log.

      Return:
      intAn int value of the flight log index.
      Check Active Brake Engaged
      method
      method isActiveBrakeEngaged
      boolean isActiveBrakeEngaged()
      Package:dji.common.flightcontroller
      Description:

      true when Active Brake is enaged to avoid obstacles. It is supported only by Matrice 300 RTK.

      Return:
      booleantrue if Active Brake is engaged.


      Home

      Location
      method
      method isHomeLocationSet
      boolean isHomeLocationSet()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_HOME_LOCATION_SET
      Description:

      true if the home point has been set.

      Return:
      booleanA boolean value.
      method getHomeLocation
      LocationCoordinate2D getHomeLocation()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.HOME_LOCATION, FlightControllerKey.HOME_LOCATION_LATITUDE, FlightControllerKey.HOME_LOCATION_LONGITUDE
      Description:

      Returns the home location of the aircraft as a coordinate.

      Return:
      LocationCoordinate2DAn instance of LocationCoordinate2D.
      Go Home Assessment
      method
      method getGoHomeAssessment
      GoHomeAssessment getGoHomeAssessment()
      Package:dji.common.flightcontroller
      Description:

      Gets the aircraft's smart go home data. If smart go home is enabled, all the smart go home data will be available in GoHomeAssessment.

      Return:
      GoHomeAssessmentAn instance of GoHomeAssessment.
      Go Home State
      method
      method getGoHomeExecutionState
      GoHomeExecutionState getGoHomeExecutionState()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.GO_HOME_STATUS
      Description:

      The current status of go-home execution.

      Return:
      GoHomeExecutionStateAn enum value of GoHomeExecutionState.
      method isGoingHome
      boolean isGoingHome()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_GOING_HOME
      Description:

      true if the aircraft is going home.

      Return:
      booleanA boolean value.
      method getGoHomeHeight
      int getGoHomeHeight()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.GO_HOME_HEIGHT_IN_METERS
      Description:

      Gets the height when the aircraft is going home in meters.

      Return:
      intAn int value of the height when the aircraft is going home.


      enum BatteryThresholdBehavior
      @EXClassNullAway
      enum BatteryThresholdBehavior
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.BATTERY_THRESHOLD_BEHAVIOR
      Description:

      Remaining battery life state. This state describes the recommended action based on remaining battery life.

      Enum Members:
      FLY_NORMALLYRemaining battery life sufficient for normal flying.
      GO_HOMERemaining battery life sufficient to go home.
      LAND_IMMEDIATELYRemaining battery life sufficient to land immediately.
      UNKNOWNUnknown.
      Class Members:
      enum GoHomeExecutionState
      @EXClassNullAway
      enum GoHomeExecutionState
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.GO_HOME_STATUS
      Description:

      An enum used to identify the different stages of the go-home command. Some aircraft only support part of the state depending on the firmware.
      For exampele:
      Phantom 4 Pro V2.0 and Mavic 2 Enterprise Dual only support GO_DOWN_TO_GROUND.
      Matrice 300 RTK only suppoort GO_UP_TO_HEIGHT, AUTO_FLY_TO_HOME_POINT and GO_DOWN_TO_GROUND.

      Enum Members:
      NOT_EXECUTINGThe aircraft is not executing a Go-Home command.
      TURN_DIRECTION_TO_HOME_POINTThe aircraft is turning the heading direction to the home point.
      GO_UP_TO_HEIGHTThe aircraft is going up to the height for go-home command.
      AUTO_FLY_TO_HOME_POINTThe aircraft is flying horizontally to home point.
      GO_DOWN_TO_GROUNDThe aircraft is going down after arriving at the home point.
      BRAKINGThe aircraft is braking to avoid collision.
      BYPASSINGThe aircraft is bypassing over the obstacle.
      COMPLETEDThe go-home command is completed.
      UNKNOWNThe go-home status is unknown.
      Class Members:
      enum GPSSignalLevel
      @EXClassNullAway
      enum GPSSignalLevel
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.GPS_SIGNAL_LEVEL
      Description:

      A enum class representing GPS signal levels, which are used to measure the signal quality.

      Enum Members:
      LEVEL_0The GPS has almost no signal, which is very bad.
      LEVEL_1The GPS signal is very weak.
      LEVEL_2The GPS signal is weak. At this level, the aircraft's go home functionality will still work.
      LEVEL_3The GPS signal is good. At this level, the aircraft can hover in the air.
      LEVEL_4The GPS signal is very good. At this level, the aircraft can record the home point.
      LEVEL_5The GPS signal is very strong.
      NONEThere is no GPS signal.
      Class Members:
      enum FlightMode
      @EXClassNullAway
      enum FlightMode
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.FLIGHT_MODE
      Description:

      Flight controller flight modes. If the current flight mode means P-GPS, it will show OPTI in DJI app if the vision system is working. If the current flight Mode contains GPS and also the RTK signal is healthy, it will show RTK in DJI app.

      Enum Members:
      MANUALManual mode. Shown as Manual in DJI app.
      ATTIAttitude mode. Shown as Atti in DJI app.
      ATTI_COURSE_LOCKAttitude course lock mode. Shown as Atti in DJI app.
      ATTI_HOVERAttitude hover mode. Shown as Atti in DJI app.
      HOVERHover mode. Shown as P-GPS in DJI app.
      GPS_BLAKEGPS blake mode. Shown as P-GPS in DJI app.
      GPS_ATTIGPS Attitude mode. Shown as P-GPS in DJI app.
      GPS_COURSE_LOCKGPS course lock mode. Shown as CL/P-CL/F-CL in DJI app.
      GPS_HOME_LOCKGPS Home mode. Shown as HL/P-HL/F-HL in DJI app.
      GPS_HOT_POINTGPS hotpoint mode. Show as POI/F-POI in DJI app.
      ASSISTED_TAKEOFFAssisted takeoff mode. Shown as TakeOff in DJI app.
      AUTO_TAKEOFFAuto takeoff mode. Shown as TakeOff in DJI app.
      AUTO_LANDINGAuto landing mode. Shown as Landing in DJI app.
      ATTI_LANDINGAttitude landing mode. Shown as Landing in DJI app.
      GPS_WAYPOINTGPS waypoint mode. Shown as WP/F-WP in DJI app.
      GO_HOMEGo home mode. Shown as Gohome in DJI app.
      JOYSTICKJoystick mode. hown as Joystick in DJI app.
      ATTI_LIMITEDAttitude limited mode. Shown as Atti in DJI app.
      DRAWDraw mode. Shown as Draw in DJI app.
      GPS_FOLLOW_MEGPS follow me mode. Shown as FM/F-FM in DJI app.
      ACTIVE_TRACKActiveTrack mode. Shown as ActiveTrack in DJI app.
      TAP_FLYTapFly mode. Shown as TapFly in DJI app.
      GPS_SPORTSport mode. Shown as Sport in DJI app.
      UNKNOWNThe main controller flight mode is unknown.
      CONFIRM_LANDINGConfirm landing mode. Shown as Landing in DJI app.
      TERRAIN_FOLLOWThe aircraft should move following the terrain. Shown as TerrainTracking in DJI app.
      TRIPODTripod mode. Shown as Tripod in DJI app.
      TRACK_SPOTLIGHTActive track mode, corresponds to Spotlight active track mode. Shown as QuickShot/ActiveTrack in DJI app.
      MOTORS_JUST_STARTEDThe motors are just started. Shown as TakeOff in DJI app.
      Class Members: