DJI Mobile SDK Documentation

      class VisionDetectionState

      @EXClassNullAway
      final class VisionDetectionState
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VISION_DETECTION_STATE
      Description:

      This class gives state information about the product's vision sensors used for obstacle detection. The two types of sensors used are dual camera sensors operating in the visible spectrum (dual-camera sensor) and infrared time of flight (TOF) sensors. Note, Inspire 2's upwards-facing infrared TOF sensor is not returned in this state. It is accessed through VisionControlState.

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

      This protocol provides an interface to update the Intelligent Flight Assistant current state.

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

      Callback function that updates the vision detection state. The frequency of this method is 10Hz.

      Input Parameters:
      @NonNull VisionDetectionState stateThe state of vision sensor.
      enum VisionSensorPosition
      @EXClassNullAway
      enum VisionSensorPosition
      Package:dji.common.flightcontroller
      Description:

      Position of the sensor on the aircraft.

      Enum Members:
      NOSEThe sensor is on the front or nose of the aircraft.
      TAILThe sensor is on the back or tail of the aircraft.
      RIGHTThe sensor is on the right or starboard side of the aircraft.
      LEFTThe sensor is on the left or port side of the aircraft.
      UNKNOWNUnknown.
      Class Members:
      enum VisionSystemWarning
      @EXClassNullAway
      enum VisionSystemWarning
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VISION_SYSTEM_WARNING
      Description:

      Distance warning returned by the front vision system. Warning Level 4 is the most serious level.

      Enum Members:
      INVALIDThe warning is invalid. The front vision system cannot determine depth of the scene in front of it.
      SAFEThe distance between the obstacle detected by the vision system and the aircraft is safe (over 2 meters).
      DANGEROUSThe distance between the obstacle detected by the vision system and the aircraft is dangerous (less than 2 meters).
      UNKNOWNThe distance warning is unknown. This warning is returned when an exception occurs.
      Class Members:
      Sensor
      method
      method isSensorBeingUsed
      boolean isSensorBeingUsed()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.IS_VISION_POSITIONING_SENSOR_BEING_USED
      Description:

      true if the vision sensor is working.

      Return:
      booleanA boolean value.
      method getSystemWarning
      VisionSystemWarning getSystemWarning()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.VISION_SYSTEM_WARNING
      Description:

      Distance warning level between the obstacle and the aircraft. This is a combination of warning levels from each sector.

      Return:
      VisionSystemWarningAn enum value of VisionSystemWarning
      method getPosition
      VisionSensorPosition getPosition()
      Package:dji.common.flightcontroller
      Description:

      The vision sensor's position on the aircraft. For Phantom 4 Pro, there are 4 vision sensors on the aircraft. The sensors on the nose and tail are dual-camera sensors. The sensors on the left and right are infrared time-of-flight (TOF) sensors.

      Return:
      VisionSensorPositionAn enum value of VisionSensorPosition
      Obstacle Detection
      method
      method getObstacleDistanceInMeters
      double getObstacleDistanceInMeters()
      Package:dji.common.flightcontroller
      Description:

      The distance to the closest detected obstacle, in meters. It is only used when the sensor is an infrared TOF sensor. The valid range is [0.3, 5.0]. Phantom 4 Pro has two infrared sensors on its left and right. Both sensors have a 70-degree horizontal field of view (FOV) and 20-degree vertical FOV. The value is always 0.0 if the sensor is a dual-camera sensor or the sensor is not working properly.

      Return:
      doubleA double value.
      method getDetectionSectors
      @Nullable
      ObstacleDetectionSector[] getDetectionSectors()
      Package:dji.common.flightcontroller
      SDK Key:FlightControllerKey.DETECTION_SECTORS
      Description:

      The vision system can see in front of the aircraft with a 70 degree horizontal field of view (FOV) and 55-degree vertical FOV for the Phantom 4. The horizontal FOV is split into four equal sectors and this array contains the distance and warning information for each sector. For Phantom 4, the horizontal FOV is separated into 4 sectors.

      Return:
      ObstacleDetectionSector[]An instance of List<DJIVisionDetectionSector>.
      Check Disable
      method
      method isDisabled
      boolean isDisabled()
      Package:dji.common.flightcontroller
      Description:

      true if the vision sensor is disabled.

      Return:
      booleanA boolean value.