主要内容

add

Add data to lidar data object

Since R2024b

Description

Add-On Required: This feature requires the Scenario Builder for Automated Driving Toolbox add-on.

add(lidarData,timestamps,pointClouds) adds the specified point clouds pointClouds, with their corresponding timestamps timestamps, to the lidar data object lidarData.

example

add(___,Attributes=attributes) adds the optional lidar attributes attributes to the lidar data object lidarData, in addition to the input arguments from the previous syntax.

example

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)

Input Arguments

collapse all

Lidar data, specified as a LidarData object.

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.

Lidar point cloud data, specified as an N-by-1 array of pointCloud objects, N-by-1 string array, N-by-1 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 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.

Optional lidar attributes of the added lidar data, 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

Version History

Introduced in R2024b