NAME
Tinkerforge::BrickletLaserRangeFinder - Measures distance up to 40m with laser light
CONSTANTS
- DEVICE_IDENTIFIER
-
This constant is used to identify a Laser Range Finder Bricklet.
The get_identity() subroutine and the CALLBACK_ENUMERATE callback of the IP Connection have a device_identifier parameter to specify the Brick's or Bricklet's type.
- DEVICE_DISPLAY_NAME
-
This constant represents the display name of a Laser Range Finder Bricklet.
- CALLBACK_DISTANCE
-
This constant is used with the register_callback() subroutine to specify the CALLBACK_DISTANCE callback.
- CALLBACK_VELOCITY
-
This constant is used with the register_callback() subroutine to specify the CALLBACK_VELOCITY callback.
- CALLBACK_DISTANCE_REACHED
-
This constant is used with the register_callback() subroutine to specify the CALLBACK_DISTANCE_REACHED callback.
- CALLBACK_VELOCITY_REACHED
-
This constant is used with the register_callback() subroutine to specify the CALLBACK_VELOCITY_REACHED callback.
- FUNCTION_GET_DISTANCE
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_VELOCITY
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_DISTANCE_CALLBACK_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_DISTANCE_CALLBACK_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_VELOCITY_CALLBACK_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_VELOCITY_CALLBACK_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_DISTANCE_CALLBACK_THRESHOLD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_DISTANCE_CALLBACK_THRESHOLD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_VELOCITY_CALLBACK_THRESHOLD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_VELOCITY_CALLBACK_THRESHOLD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_DEBOUNCE_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_DEBOUNCE_PERIOD
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_MOVING_AVERAGE
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_MOVING_AVERAGE
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_MODE
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_MODE
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_ENABLE_LASER
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_DISABLE_LASER
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_IS_LASER_ENABLED
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_SENSOR_HARDWARE_VERSION
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_SET_CONFIGURATION
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_CONFIGURATION
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
- FUNCTION_GET_IDENTITY
-
This constant is used with the get_response_expected(), set_response_expected() and set_response_expected_all() subroutines.
FUNCTIONS
- new()
-
Creates an object with the unique device ID *uid* and adds it to the IP Connection *ipcon*.
- get_distance()
-
Returns the measured distance. The value has a range of 0 to 4000 and is given in cm.
Sensor hardware version 1 (see :func:`Get Sensor Hardware Version`) cannot measure distance and velocity at the same time. Therefore, the distance mode has to be enabled using :func:`Set Mode`. Sensor hardware version 3 can measure distance and velocity at the same time. Also the laser has to be enabled, see :func:`Enable Laser`.
If you want to get the distance periodically, it is recommended to use the :cb:`Distance` callback and set the period with :func:`Set Distance Callback Period`.
- get_velocity()
-
Returns the measured velocity. The value has a range of -12800 to 12700 and is given in 1/100 m/s.
Sensor hardware version 1 (see :func:`Get Sensor Hardware Version`) cannot measure distance and velocity at the same time. Therefore, the velocity mode has to be enabled using :func:`Set Mode`. 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 :func:`Set Configuration`) is configured. Also the laser has to be enabled, see :func:`Enable Laser`.
If you want to get the velocity periodically, it is recommended to use the :cb:`Velocity` callback and set the period with :func:`Set Velocity Callback Period`.
- set_distance_callback_period()
-
Sets the period in ms with which the :cb:`Distance` callback is triggered periodically. A value of 0 turns the callback off.
The :cb:`Distance` callback is only triggered if the distance value has changed since the last triggering.
The default value is 0.
- get_distance_callback_period()
-
Returns the period as set by :func:`Set Distance Callback Period`.
- set_velocity_callback_period()
-
Sets the period in ms with which the :cb:`Velocity` callback is triggered periodically. A value of 0 turns the callback off.
The :cb:`Velocity` callback is only triggered if the velocity value has changed since the last triggering.
The default value is 0.
- get_velocity_callback_period()
-
Returns the period as set by :func:`Set Velocity Callback Period`.
- set_distance_callback_threshold()
-
Sets the thresholds for the :cb:`Distance Reached` callback.
The following options are possible:
.. csv-table:: :header: "Option", "Description" :widths: 10, 100
"'x'", "Callback is turned off" "'o'", "Callback is triggered when the distance value is *outside* the min and max values" "'i'", "Callback is triggered when the distance value is *inside* the min and max values" "'<'", "Callback is triggered when the distance value is smaller than the min value (max is ignored)" "'>'", "Callback is triggered when the distance value is greater than the min value (max is ignored)"
The default value is ('x', 0, 0).
- get_distance_callback_threshold()
-
Returns the threshold as set by :func:`Set Distance Callback Threshold`.
- set_velocity_callback_threshold()
-
Sets the thresholds for the :cb:`Velocity Reached` callback.
The following options are possible:
.. csv-table:: :header: "Option", "Description" :widths: 10, 100
"'x'", "Callback is turned off" "'o'", "Callback is triggered when the velocity is *outside* the min and max values" "'i'", "Callback is triggered when the velocity is *inside* the min and max values" "'<'", "Callback is triggered when the velocity is smaller than the min value (max is ignored)" "'>'", "Callback is triggered when the velocity is greater than the min value (max is ignored)"
The default value is ('x', 0, 0).
- get_velocity_callback_threshold()
-
Returns the threshold as set by :func:`Set Velocity Callback Threshold`.
- set_debounce_period()
-
Sets the period in ms with which the threshold callbacks
* :cb:`Distance Reached`, * :cb:`Velocity Reached`,
are triggered, if the thresholds
* :func:`Set Distance Callback Threshold`, * :func:`Set Velocity Callback Threshold`,
keep being reached.
The default value is 100.
- get_debounce_period()
-
Returns the debounce period as set by :func:`Set Debounce Period`.
- set_moving_average()
-
Sets the length of a `moving averaging <https://en.wikipedia.org/wiki/Moving_average>`__ for the distance and velocity.
Setting the length to 0 will turn the averaging completely off. With less averaging, there is more noise on the data.
The range for the averaging is 0-30.
The default value is 10.
- get_moving_average()
-
Returns the length moving average as set by :func:`Set Moving Average`.
- set_mode()
-
.. note:: This function is only available if you have a LIDAR-Lite sensor with hardware version 1. Use :func:`Set Configuration` for hardware version 3. You can check the sensor hardware version using :func:`Get Sensor Hardware Version`.
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
The default mode is 0 (distance is measured).
- get_mode()
-
Returns the mode as set by :func:`Set Mode`.
- enable_laser()
-
Activates the laser of the LIDAR.
We recommend that you wait 250ms after enabling the laser before the first call of :func:`Get Distance` to ensure stable measurements.
- disable_laser()
-
Deactivates the laser of the LIDAR.
- is_laser_enabled()
-
Returns *true* if the laser is enabled, *false* otherwise.
- get_sensor_hardware_version()
-
Returns the LIDAR-Lite hardware version.
.. versionadded:: 2.0.3$nbsp;(Plugin)
- set_configuration()
-
.. note:: This function is only available if you have a LIDAR-Lite sensor with hardware version 3. Use :func:`Set Mode` for hardware version 1. You can check the sensor hardware version using :func:`Get Sensor Hardware Version`.
The **Aquisition 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. The allowed values are 1-255.
If you set **Enable Quick Termination** to true, 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.
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. The other allowed values are 1-255.
Set the **Measurement Frequency** in Hz to force a fixed measurement rate. If set to 0, 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. The allowed values are 10Hz-500Hz (and 0 to turn the fixed frequency off).
The default values for Acquisition Count, Enable Quick Termination, Threshold Value and Measurement Frequency are 128, false, 0 and 0.
.. versionadded:: 2.0.3$nbsp;(Plugin)
- get_configuration()
-
Returns the configuration as set by :func:`Set Configuration`.
.. versionadded:: 2.0.3$nbsp;(Plugin)
- get_identity()
-
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' or 'd'.
The device identifier numbers can be found :ref:`here <device_identifier>`. |device_identifier_constant|