Main Content

LidarData

Store sequence of lidar data

Since R2024b

Description

The LidarData object stores a sequence of lidar point cloud data.

Creation

Description

lidarData = scenariobuilder.LidarData creates an empty LidarData object, lidarData.

lidarData = scenariobuilder.LidarData(timestamps,pointClouds) creates a LidarData object, lidarData, with the Timestamps and PointClouds properties set by the timestamps and pointClouds arguments, respectively. Additionally, this syntax sets the SampleRate, SampleTime, TimeDuration, and NumSamples properties.

lidarData = scenariobuilder.LidarData(timestamps,pointClouds,Name=Value) sets writable properties using one or more name-value arguments. For example, Name="lidar1" specifies the name of the lidar sensor as "lidar1".

Note

This object requires the Scenario Builder for Automated Driving Toolbox™ support package. You can install the Scenario Builder for Automated Driving Toolbox support package from the Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

example

Input Arguments

expand all

Timestamps of the lidar data, specified as an N-element numeric column vector, an N-element datetime array, or an N-element duration array. N is the number of timestamps. Each element in the timestamps argument specifies the time at which the corresponding lidar data was collected. If you specify an N-element numeric column vector, units must be in seconds.

This argument sets the Timestamps property.

Lidar point cloud data, specified as an N-by-1 array of pointCloud objects, N-by-1 string array, N-by-1 cell array of character vectors, or a string scalar. N is the number of timestamps.

If you specify an N-by-1 string array or an N-by-1 cell array of character vectors, each element in the array represents a point cloud filename, an absolute or relative path of a point cloud file. The point cloud file must be of PLY or PCD format.

If you specify a string scalar, the string must specify an absolute or relative path to a folder containing point cloud files.

This argument sets the PointClouds property.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: scenariobuilder.LidarData(Name="lidar1") specifies the name of the lidar sensor as "lidar1".

Name of the lidar sensor, specified as a string scalar or character vector.

This argument sets the Name property.

Data Types: char | string

Optional lidar sensor parameters, specified as lidar parameters specifying sensor characteristics, mounting information, or transformations, such as a rigidtform3d object.

This argument sets the SensorParameters property.

Optional lidar attributes, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the additional lidar attributes, such as classification labels, detected at the corresponding timestamp.

This argument sets the Attributes property.

Data Types: cell

Properties

expand all

Name of the lidar sensor, specified as a string scalar or character vector.

Data Types: char | string

This property is read-only.

Number of point cloud samples, represented as a nonnegative integer.

Data Types: uint8 | uint16 | uint32 | uint64

This property is read-only.

Time duration for which the lidar data was acquired, represented as a nonnegative scalar. Units are in seconds.

Data Types: double

This property is read-only.

Mean sample rate of the lidar data, represented as a nonnegative scalar. This value defines the number of point cloud frames per second. Units are in hertz.

Data Types: double

This property is read-only.

Mean sample time of the lidar data, represented as a nonnegative scalar. This value defines the mean time interval between two consecutive point cloud frames. Units are in seconds.

Data Types: double

This property is read-only after object creation. To set this property, use the timestamps argument when calling the scenarioBuilder.LidarData function.

Timestamps of the lidar data, represented as an N-element numeric column vector, an N-element datetime array, or an N-element duration array. N is the number of timestamps. Each element in the Timestamps property specifies the time at which the corresponding lidar data was collected. If you specify an N-element numeric column vector, units must be in seconds.

When you initialize the object with timestamps and pointClouds, the object arranges the data by the input timestamps in increasing order.

This property is read-only after object creation. To set this property, use the pointClouds argument when calling the scenarioBuilder.LidarData function.

Lidar point cloud data, represented as an N-by-1 string array. N is the number of timestamps. Each element in the array represents a point cloud filename, an absolute or a relative path of a point cloud file.

Optional lidar sensor parameters, specified as lidar parameters specifying sensor characteristics, mounting information, or transformations, such as a rigidtform3d object.

Optional lidar attributes, specified as an N-by-1 cell array. N is the number of timestamps. Each cell contains the additional lidar attributes, such as classification labels, detected at the corresponding timestamp.

Data Types: cell

Object Functions

addAdd data to lidar data object
removeRemove data from sensor data object
readRead data from sensor data object
copyCreate copy of sensor data object
cropCrop data from sensor data object
synchronizeSynchronize sensor data with reference sensor information
playPlay point clouds from lidar data object
datastoreCreate datastore from sensor data object
normalizeTimestampsNormalize timestamps of sensor data object

Examples

collapse all

Specify a path containing a sequence of point cloud files.

files = dir(fullfile(toolboxdir("vision"),"visiondata","pcdmapseq","*.pcd"));
pcds = strcat({files.folder},filesep,{files.name})';

Specify timestamps for each point cloud in the point cloud data.

timestamps = (1:4)';

Create an empty lidar data object.

lidarData = scenariobuilder.LidarData(Name="LidarSensor")
lidarData = 
  LidarData with properties:

                Name: "LidarSensor"

          NumSamples: 0
            Duration: 0
          SampleRate: 0
          SampleTime: 0
          Timestamps: []

         PointClouds: []
    SensorParameters: []

          Attributes: []

Add your data samples to the lidar data object.

add(lidarData,timestamps,pcds)

Visualize the lidar data object.

play(lidarData)

Version History

Introduced in R2024b