The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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_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.

The Laser Range Finder Bricklet knows different modes. Distances are only measured in the distance measurement mode, see :func:`SetMode`. Also the laser has to be enabled, see :func:`EnableLaser`.

If you want to get the distance periodically, it is recommended to use the callback :func:`Distance` and set the period with :func:`SetDistanceCallbackPeriod`.

get_velocity()

Returns the measured velocity. The value has a range of 0 to 12700 and is given in 1/100 m/s.

The Laser Range Finder Bricklet knows different modes. Velocity is only measured in the velocity measurement modes, see :func:`SetMode`. Also the laser has to be enabled, see :func:`EnableLaser`.

If you want to get the velocity periodically, it is recommended to use the callback :func:`Velocity` and set the period with :func:`SetVelocityCallbackPeriod`.

set_distance_callback_period()

Sets the period in ms with which the :func:`Distance` callback is triggered periodically. A value of 0 turns the callback off.

:func:`Distance` 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:`SetDistanceCallbackPeriod`.

set_velocity_callback_period()

Sets the period in ms with which the :func:`Velocity` callback is triggered periodically. A value of 0 turns the callback off.

:func:`Velocity` 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:`SetVelocityCallbackPeriod`.

set_distance_callback_threshold()

Sets the thresholds for the :func:`DistanceReached` 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:`SetDistanceCallbackThreshold`.

set_velocity_callback_threshold()

Sets the thresholds for the :func:`VelocityReached` 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:`SetVelocityCallbackThreshold`.

set_debounce_period()

Sets the period in ms with which the threshold callbacks

* :func:`DistanceReached`, * :func:`VelocityReached`,

are triggered, if the thresholds

* :func:`SetDistanceCallbackThreshold`, * :func:`SetVelocityCallbackThreshold`,

keep being reached.

The default value is 100.

get_debounce_period()

Returns the debounce period as set by :func:`SetDebouncePeriod`.

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:`SetMovingAverage`.

set_mode()

The LIDAR 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:`SetMode`.

enable_laser()

Activates the laser of the LIDAR.

We recommend that you wait 250ms after enabling the laser before the first call of :func:`GetDistance` 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_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|