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

      interface
      interface Callback
      interface Callback
      Package:dji.common.flightcontroller
      Description:

      Callback function that updates the flight controller's current state data. This method gets called 10 times per second after startUpdatingFlightControllerCurrentState is called.

      Interface Methods:
      method
      method onUpdate
      void onUpdate(@NonNull FlightControllerState state)
      Package:dji.common.flightcontroller
      Description:

      Called when the flight controller's current state data has been updated. This method is called 10 times per second.

      Input Parameters:
      @NonNull FlightControllerState stateCurrent state of the flight controller.


      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 was powered 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/mobile-sdk/documentation/introduction/component-guide-remotecontroller.html#flight-mode

      Return:
      FlightModeAn enum value of the FlightMode.
      method getFlightModeString
      String getFlightModeString()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.FLIGHT_MODE_STRING
      Description:

      Gets the flight mode as a string.

      Return:
      StringThe flight mode as a string. For example, "P-GPS" or "P-Atti".
      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.

      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.

      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.


      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.

      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. For more information, see http://wiki.dji.com/en/index.php/Phantom_3_Professional-Aircraft.

      Enum Members:
      MANUALManual mode.
      ATTIAttitude mode.
      ATTI_COURSE_LOCKAttitude course lock mode.
      ATTI_HOVERAttitude hover mode.
      GPS_ATTIGPS Attitude mode.
      GPS_COURSE_LOCKGPS course lock mode.
      GPS_HOME_LOCKGPS Home mode.
      GPS_HOT_POINTGPS hotpoint mode.
      ASSISTED_TAKEOFFAssisted takeoff mode.
      AUTO_TAKEOFFAuto takeoff mode.
      AUTO_LANDINGAuto landing mode.
      ATTI_LANDINGAttitude landing mode.
      GPS_WAYPOINTGPS waypoint mode.
      GO_HOMEGo home mode.
      JOYSTICKJoystick mode.
      ATTI_LIMITEDAttitude limited mode.
      DRAWDraw mode.
      GPS_ATTI_WRISTBANDGPS attitude limited mode.
      GPS_FOLLOW_MEGPS follow me mode.
      ACTIVE_TRACKActiveTrack mode.
      TAP_FLYTapFly mode.
      GPS_SPORTSport mode.
      GPS_NOVICEGPS Novice mode.
      UNKNOWNThe main controller flight mode is unknown.
      CONFIRM_LANDINGConfirm landing mode.
      TERRAIN_FOLLOWThe aircraft should move following the terrain.
      TRIPODTripod mode.
      TRACK_SPOTLIGHTActive track mode, corresponds to Spotlight active track mode.
      MOTORS_JUST_STARTEDThe motors are just started.
      Class Members: