openHAB - Laser Range Finder Bricklet

Bemerkung

Die openHAB-Dokumentation ist nur auf Englisch verfügbar.

Warnung

The openHAB bindings are still in beta, but the development was stopped.

This is the description of the openHAB API bindings for the Laser Range Finder Bricklet. General information and technical specifications for the Laser Range Finder Bricklet are summarized in its hardware description.

An installation guide for the openHAB API bindings is part of their general description.

Thing

UID:
  • tinkerforge:brickletlaserrangefinder:[UID]
Required firmware version:
  • 2.0.3
Firmware update supported:
  • yes
Channels:
Actions:
Parameters:
  • Distance Moving Average Length – Type: integer, Default: 10, Min: 0, Max: 30
  • The length of a moving averaging for the distance.

  • Velocity Moving Average Length – Type: integer, Default: 10, Min: 0, Max: 30
  • The length of a moving averaging for the velocity.

  • Mode – Type: Choice, Default: Distance
  • The LIDAR-Lite sensor (hardware version 1) has five different modes. One mode is for distance measurements and four modes are for velocity measurements with different ranges. The following modes are available:
    • 0: Distance is measured with resolution 1.0 cm and range 0-400 cm
    • 1: Velocity is measured with resolution 0.1 m/s and range is 0-12.7 m/s
    • 2: Velocity is measured with resolution 0.25 m/s and range is 0-31.75 m/s
    • 3: Velocity is measured with resolution 0.5 m/s and range is 0-63.5 m/s
    • 4: Velocity is measured with resolution 1.0 m/s and range is 0-127 m/s
    This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 3.
  • Options: Distance, Velocity Max 13m/s, Velocity Max 32m/s, Velocity Max 64m/s, Velocity Max 127m/s

  • Acquisition Count – Type: integer, Default: 128, Min: 1, Max: 255
  • The acquisition count defines the number of times the Laser Range Finder Bricklet will integrate acquisitions to find a correlation record peak. With a higher count, the Bricklet can measure longer distances. With a lower count, the rate increases. This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 1.

  • Quick Termination – Type: boolean, Default: false
  • If you enable Quick Termination, the distance measurement will be terminated early if a high peak was already detected. This means that a higher measurement rate can be achieved and long distances can be measured at the same time. However, the chance of false-positive distance measurements increases. This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 1.

  • Threshold Value – Type: integer, Default: 0, Min: 0, Max: 255
  • Normally the distance is calculated with a detection algorithm that uses peak value, signal strength and noise. You can however also define a fixed Threshold Value. Set this to a low value if you want to measure the distance to something that has very little reflection (e.g. glass) and set it to a high value if you want to measure the distance to something with a very high reflection (e.g. mirror). Set this to 0 to use the default algorithm. This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 1.

  • Fixed Measurement Frequency – Type: boolean, Default: false
  • For a stable velocity measurement you should set a fixed measurement frequency. See Measurement Frequency for details. This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 1.

  • Measurement Frequency – Type: integer, Default: 10, Min: 10, Max: 500
  • If the fixed measurement frequency is enabled, the measurement frequency is forced to this value. If it is disabled, the Laser Range Finder Bricklet will use the optimal frequency according to the other configurations and the actual measured distance. Since the rate is not fixed in this case, the velocity measurement is not stable. For a stable velocity measurement you should set a fixed measurement frequency. The lower the frequency, the higher is the resolution of the calculated velocity. This setting will be ignored if you have a LIDAR-Lite sensor with hardware version 1.

Channels

Distance

The measured distance. Sensor hardware version 1 cannot measure distance and velocity at the same time. Therefore, the distance mode has to be enabled. Sensor hardware version 3 can measure distance and velocity at the same time. In both cases the laser has to be enabled.

Type:
  • Number:Length
UID:
  • tinkerforge:brickletlaserrangefinder:[UID]:BrickletLaserRangeFinderDistance
Read only:
  • Yes
Predicate:
  • This channel will only be available if the sensor has a hardware version of 3 or the mode is Distance
Unit:
  • Meter
Range:
  • 0 Meter to 40 Meter (Step 0.01 Meter)
Parameters:
  • Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.
Velocity

The measured velocity. Sensor hardware version 1 cannot measure distance and velocity at the same time. Therefore, the velocity mode has to be enabled. Sensor hardware version 3 can measure distance and velocity at the same time, but the velocity measurement only produces stables results if a fixed measurement frequency is configured. Also the laser has to be enabled.

Type:
  • Number:Speed
UID:
  • tinkerforge:brickletlaserrangefinder:[UID]:BrickletLaserRangeFinderVelocity
Read only:
  • Yes
Predicate:
  • This channel will only be available if the sensor has a hardware version of 3 or the mode is not Distance
Unit:
  • Meter Per Second
Range:
  • -128 Meter Per Second to 127 Meter Per Second (Step 0.01 Meter Per Second)
Parameters:
  • Update Interval – Type: integer, Default: 1000, Unit: ms, Min: 0, Max: 4294967295
  • Specifies the update interval in milliseconds. A value of 0 disables automatic updates.
Laser

Activates/Deactivates the laser of the LIDAR.

Type:
  • Switch
UID:
  • tinkerforge:brickletlaserrangefinder:[UID]:BrickletLaserRangeFinderLaser
Read only:
  • No

Actions

Actions can be used in rules by creating an action object. All actions return a Map<String, Object>. Returned values can be accessed by name, sometimes the type deduction needs some hints, as shown below:

val actions = getActions("tinkerforge", "tinkerforge:brickletlaserrangefinder:[UID]")
val hwVersion = actions.brickletLaserRangeFinderGetIdentity().get("hardwareVersion") as short[]
logInfo("Example", "Hardware version: " + hwVersion.get(0) + "." + hwVersion.get(1) + "." + hwVersion.get(2))

Basic Actions

brickletLaserRangeFinderGetDistance()
Return Map:
  • distance – Type: int, Unit: 1 cm, Range: [0 to 4000]

Returns the measured distance.

Sensor hardware version 1 (see GetSensorHardwareVersion()) cannot measure distance and velocity at the same time. Therefore, the distance mode has to be enabled using the thing configuration. Sensor hardware version 3 can measure distance and velocity at the same time. Also the laser has to be enabled, see Laser.

If you want to get the distance periodically, it is recommended to use the Distance channel and set the period with the configuration of Distance.

brickletLaserRangeFinderGetVelocity()
Return Map:
  • velocity – Type: short, Unit: 1 cm/s, Range: [-12800 to 12700]

Returns the measured velocity.

Sensor hardware version 1 (see GetSensorHardwareVersion()) cannot measure distance and velocity at the same time. Therefore, the velocity mode has to be enabled using the thing configuration. Sensor hardware version 3 can measure distance and velocity at the same time, but the velocity measurement only produces stables results if a fixed measurement rate (see the thing configuration) is configured. Also the laser has to be enabled, see Laser.

If you want to get the velocity periodically, it is recommended to use the Velocity channel and set the period with the configuration of Velocity.

brickletLaserRangeFinderGetMode()
Return Map:
  • mode – Type: short, Range: See constants, Default: 0

Returns the mode as set by the thing configuration.

The following constants are available for this function:

For mode:

  • val MODE_DISTANCE = 0
  • val MODE_VELOCITY_MAX_13MS = 1
  • val MODE_VELOCITY_MAX_32MS = 2
  • val MODE_VELOCITY_MAX_64MS = 3
  • val MODE_VELOCITY_MAX_127MS = 4
brickletLaserRangeFinderEnableLaser()

Activates the laser of the LIDAR.

We recommend that you wait 250ms after enabling the laser before the first call of Distance to ensure stable measurements.

brickletLaserRangeFinderDisableLaser()

Deactivates the laser of the LIDAR.

brickletLaserRangeFinderIsLaserEnabled()
Return Map:
  • laserEnabled – Type: boolean

Returns true if the laser is enabled, false otherwise.

brickletLaserRangeFinderGetConfiguration()
Return Map:
  • acquisitionCount – Type: short, Range: [1 to 255], Default: 128
  • enableQuickTermination – Type: boolean, Default: false
  • thresholdValue – Type: short, Range: [0 to 255], Default: 0
  • measurementFrequency – Type: int, Unit: 1 Hz, Range: [0, 10 to 500], Default: 0

Returns the configuration as set by the thing configuration.

Neu in Version 2.0.3 (Plugin).

Advanced Actions

brickletLaserRangeFinderGetMovingAverage()
Return Map:
  • distanceAverageLength – Type: short, Range: [0 to 30], Default: 10
  • velocityAverageLength – Type: short, Range: [0 to 30], Default: 10

Returns the length moving average as set by the thing configuration.

brickletLaserRangeFinderGetSensorHardwareVersion()
Return Map:
  • version – Type: short, Range: See constants

Returns the LIDAR-Lite hardware version.

The following constants are available for this function:

For version:

  • val VERSION_1 = 1
  • val VERSION_3 = 3

Neu in Version 2.0.3 (Plugin).

brickletLaserRangeFinderGetIdentity()
Return Map:
  • uid – Type: String, Length: up to 8
  • connectedUid – Type: String, Length: up to 8
  • position – Type: char, Range: ['a' to 'h', 'z']
  • hardwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • firmwareVersion – Type: short[], Length: 3
    • 0: major – Type: short, Range: [0 to 255]
    • 1: minor – Type: short, Range: [0 to 255]
    • 2: revision – Type: short, Range: [0 to 255]
  • deviceIdentifier – Type: int, Range: [0 to 216 - 1]

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port). A Bricklet connected to an Isolator Bricklet is always at position 'z'.

The device identifier numbers can be found here