com.qualcomm.robotcore.hardware

## Interface DistanceSensor

- All Superinterfaces:
    HardwareDevice

      public interface DistanceSensor
      extends HardwareDevice

  The `DistanceSensor` may be found on hardware sensors which measure distance by one means or another.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.qualcomm.robotcore.hardware.HardwareDevice

      `HardwareDevice.Manufacturer`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `distanceOutOfRange` The value returned when a distance reading is not in fact available.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `getDistance(DistanceUnit unit)` Returns the current distance in the indicated distance units

    - ### Methods inherited from interface com.qualcomm.robotcore.hardware.HardwareDevice

      `close, getConnectionInfo, getDeviceName, getManufacturer, getVersion, resetDeviceConfigurationForOpMode`

- - ### Field Detail

    - #### distanceOutOfRange

          static final double distanceOutOfRange

      The value returned when a distance reading is not in fact available.
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getDistance

          double getDistance(DistanceUnit unit)

      Returns the current distance in the indicated distance units
      Parameters:
        `unit` - the unit of distance in which the result should be returned
      Returns:
        the current distance sas measured by the sensor. If no reading is available (perhaps the sensor is out of range), then `distanceOutOfRange` is returned;