Ranging Configuration

The Laser Rangefinder can carry out measurements based on various settings that allow for the balancing of speed, range, and accuracy. Properly configuring these parameters can enhance the accuracy and reliability of the measurements, providing more precise results for navigation, mapping, or object detection tasks.

Writing Configurations

With the sensor plugged into an I2C port, we can write to its persistent memory using the provided configuration opmode. Changes take effect the next power-on of the sensor. Below is how we would load an example configuration:

// in runOpMode of ConfigureLaserRangefinder.java
waitForStart();
lrf.setDistanceMode(LaserRangefinder.DistanceMode.LONG);
lrf.setTiming(50, 0);

Uploading this code and running the opmode once will make the sensor use this ranging configuration every power-up until it is changed. The properties of different ranging configurations are detailed below.

Distance Mode

Here is a comparison of the three different distance modes of the sensor:

Mode
Max Range
Notes

SHORT

1.3m (4ft)

Resistant to ambient light

MEDIUM

3m (10ft)

Okay immunity to ambient light

LONG

4m (13 ft)

Less immune to ambient light

To set the distance mode, place the following inside your configuration opmode:

lrf.setDistanceMode(LaserRangefinder.DistanceMode.LONG); // SHORT, MEDIUM, or LONG

Timing

The timing budget and measurement period control the duration and frequency of the sensor's measurements. Together, they determine the ranging speed and accuracy.

  • The timing budget defines the time allocated for the sensor to perform a single measurement. During this time, the sensor collects data by pulsing and receiving lasers.

    • Higher timing budget values will result in less noisy data at the cost of ranging speed.

  • The measurement period defines how long one range takes, including the time the sensor spends collecting data (the timing budget). The period must be at least 4ms more than the timing budget.

    • The measurement period is not the time between each range, but the sum of the timing budget and a period of waiting, which must be at least 4ms.

    • In most or many cases it is desirable to not wait at all between one range and the next. In this case, using a measurement period of 0 will tell the sensor to start the next range immediately after the conclusion of the current range.

To set timing parameters, place the following inside your configuration opmode:

lrf.setTiming(33, 0);

Timing and distance mode come hand in hand. For example, smaller timing budgets work well on SHORT mode. Here are some examples of distance mode and timing configurations that will cover most needs:

Distance Mode & Timing Budget
Notes

SHORT, 10ms

100Hz ranging with good accuracy

MEDIUM, 10ms

100Hz ranging with good accuracy

LONG, 16ms

60Hz ranging, noisy

LONG, 33ms

30Hz ranging, less noisy

LONG, 50ms

20Hz ranging, good accuracy

Note that the measurement period is kept at 0 for all configurations in this table.

Region of Interest

The sensor has a square 16x16 grid of photodiodes used to capture the laser pulses it emits. This grid can be sub sectioned to focus on specific areas within the sensor's field of view.

  • Minimum size is 4x4, corresponding to 15 degrees FoV (full FoV is 27 degrees)

  • Smaller ROIs tend to result in noisy data, so increasing the timing budget will help

The user ROI is defined by the top left and bottom right points of the rectangle. Here is the axis definition (wire side up is positive y):

To set a custom ROI, use the following code in your configuration opmode:

lrf.setROI(0, 15, 15, 0);

The output of the sensor can also be configured to use analog or digital instead of I2C, which will greatly improve the speed of your control loop.

Last updated