Main Content

read

Read lidar scans from Hokuyo 2-D lidar sensor

Since R2024a

Description

example

scan = read(hokuyoObj) reads the latest 2-D lidar scan from the hokuyolidar2d object hokuyoObj, and stores the read data in a lidarScan object, scan.

[scan,intensities] = read(hokuyoObj) returns the intensity value corresponding to each data point.

[___] = read(hokuyoObj,numScans) reads the specified number of previous lidar scans numScans using any combination of output arguments from previous syntaxes.

[___] = read(___,ScanAngleLimits=scanAngleLimits) specifies the lower and upper limits of the scan angles for reading the lidar scan data, in addition to any combination of arguments from previous syntaxes.

Note

This feature requires the Lidar Toolbox™ Support Package for Hokuyo™ Lidar Sensors. You can install the support package from the Add-On Explorer. For more information, see Download and Install Lidar Toolbox Support Package for Hokuyo Lidar Sensors.

Examples

collapse all

Create a hokuyolidar2d object.

hokuyoObj = hokuyolidar2d;

Read the latest 2-D lidar scan by using the read function of the hokuyolidar2d object.

scan = read(hokuyoObj);

Plot all the points of the lidar scan.

plot(scan)

Plot of lidar scan from Hokuyo sensor

Input Arguments

collapse all

Hokuyo lidar sensor connection, specified as a hokuyolidar2d object.

Number of lidar scans to read, specified as a positive integer.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Azimuth limits for reading the lidar scans, specified as a two-element vector of the form [min max]. The values must not exceed the range specified by the ScanAngleLimits property of the hokuyolidar2d object. max must be greater than min. Units are in degrees.

Data Types: single | double

Output Arguments

collapse all

Lidar scan data read from the Hokuyo 2-D lidar sensor, returned as a lidarScan object or vector of lidarScan objects.

  • When you do not specify the numScans argument, or if its value is 1, the function returns a single lidarScan object.

  • When you specify the numScans argument with a value greater than 1, the function returns a numScans-element vector of lidarScan objects, ordered from the earliest to the most recent scan.

Intensity values of the lidar scan data read from the Hokuyo 2-D lidar sensor, returned as a vector or cell array.

  • When you do not specify the numScans argument, or if its value is 1, the function returns a vector of intensity values corresponding to the read lidar scan data.

  • When you specify the numScans argument with a value greater than 1, the function returns the intensity values as a 1-by-numScans cell array. Each element of cell array contains a vector of intensity values corresponding to the respective lidar scan data.

Data Types: double | cell

Version History

Introduced in R2024a