Main Content

vision.labeler.loading.VelodyneLidarSource class

Package: vision.labeler.loading
Superclasses: vision.labeler.loading.MultiSignalSource

Load signals from Velodyne lidar sources into Ground Truth Labeler app

Description

The vision.labeler.loading.VelodyneLidarSource class creates an interface for loading signals from Velodyne® packet capture (PCAP) lidar data sources into the Ground Truth Labeler app. In the Add/Remove Signal dialog box of the app, when Source Type is set to Velodyne Lidar, this class controls the parameters in that dialog box.

To access this dialog box, in the app, select Open > Add Signals.

The default implementation of this class loads Velodyne PCAP files from the device models accepted by the velodyneFileReader (Computer Vision Toolbox) function.

The vision.labeler.loading.VelodyneLidarSource class is a handle class.

Creation

When you export labels from a Ground Truth Labeler app session that contains Velodyne lidar sources, the exported groundTruthMultisignal object stores instances of this class in its DataSource property.

To create a VelodyneLidarSource object programmatically, such as when programmatically creating a groundTruthMultisignal object, use the vision.labeler.loading.VelodyneLidarSource function (described here).

Description

example

velodyneSource = vision.labeler.loading.VelodyneLidarSource creates a VelodyneLidarSource object for loading signals from Velodyne lidar data sources. To specify the data source and the parameters required to load the source, use the loadSource method.

Properties

expand all

Name of the type of source that this class loads, specified as a string scalar.

Attributes:

GetAccess
public
Constant
true
NonCopyable
true

Description of the functionality that this class provides, specified as a string scalar.

Attributes:

GetAccess
public
Constant
true
NonCopyable
true

Name of the data source, specified as a string scalar. Typically, SourceName is the name of the file from which the signal is loaded.

Attributes:

GetAccess
public
SetAccess
protected

Parameters for loading a Velodyne lidar signal from a data source, specified as a structure.

This table describes the required and optional fields of the SourceParams structure.

FieldDescriptionRequired or Optional
Timestamps

Timestamps for the Velodyne lidar signal, specified as a cell array containing a single duration vector of timestamps.

In the Add/Remove Signal dialog box of the app, if you set the Timestamps parameter to From Workspace and read the timestamps from a variable in the MATLAB® workspace, then the SourceParams property stores these timestamps in the Timestamps field.

Optional

In the Add/Remove Signal dialog box of the app, if you set the Timestamps parameter to From File and read the timestamps from the Velodyne PCAP file, then the structure does not include this field.

DeviceModel

Velodyne device model name, specified as one of these options.

  • 'VLP16' (default) — VLP-16 device model

  • 'PuckLITE' — Puck LITE device model

  • 'PuckHiRes' — Puck Hi-Res device model

  • 'VLP32C' — VLP-32C device model

  • 'HDL32E' — HDL-32E device model

  • 'HDL64E' — HDL-64E device model

If you specify the incorrect device model for your Velodyne PCAP file, the app loads an improperly calibrated point cloud.

In the Add/Remove Signal dialog box of the app, select the device model from the Device Model parameter. The Calibration File parameter updates to the calibration file of the selected device model.

Required

CalibrationFile

Name of the Velodyne calibration XML file, specified as a character vector or string scalar.

To specify one of the calibration files included with your MATLAB installation, at the MATLAB command prompt, enter this code. Replace <DeviceModel> with the name of the device model that you specify in the DeviceModel field of this structure (without quotes).

calibrationFile = fullfile( ...
    matlabroot,'toolbox', ...
    'shared','pointclouds','utilities', ...
    'velodyneFileReaderConfiguration', ...
    '<DeviceModel>.xml')
By default, the CalibrationFile field is set to the full path to the VLP16.xml file, which is the calibration file for the VLP-16 device model.

In the Add/Remove Signal dialog box of the app, when you change the Device Model parameter selection, the Calibration File parameter updates to the corresponding calibration file for the selected device model. You can also browse for or enter a path to a different calibration file in the Calibration File box.

Required

For more details on device models and calibration files, see the velodyneFileReader (Computer Vision Toolbox) object reference page.

Attributes:

GetAccess
public
SetAccess
protected

Names of the signals that can be loaded from the data source, specified as a string vector.

Attributes:

GetAccess
public
SetAccess
protected

Types of the signals that can be loaded from the data source, specified as a vector of vision.labeler.loading.SignalType enumerations. Each signal listed in the SignalName property is of the type in the corresponding position of SignalType.

Attributes:

GetAccess
public
SetAccess
protected

Timestamps of the signals that can be loaded from the data source, specified as a cell array of duration vectors. Each signal listed in the SignalName property has the timestamps in the corresponding position of Timestamp.

Attributes:

GetAccess
public
SetAccess
protected

Number of signals that can be read from the data source, specified as a nonnegative integer. NumSignals is equal to the number of signals in the SignalName property.

Attributes:

GetAccess
public
SetAccess
public
Dependent
true
NonCopyable
true

Methods

expand all

Examples

collapse all

Specify the name of the Velodyne® lidar data source, a packet capture (PCAP) file.

sourceName = fullfile(toolboxdir('vision'),'visiondata', ...
    'lidarData_ConstructionRoad.pcap');

Specify information needed to load the source, including the device model of the lidar and the calibration file.

sourceParams = struct;
sourceParams.DeviceModel = 'HDL32E';
sourceParams.CalibrationFile = fullfile(matlabroot,'toolbox','shared', ...
    'pointclouds','utilities','velodyneFileReaderConfiguration', ...
    'HDL32E.xml');

Create the Velodyne lidar data source. Load the data source path, device model, and calibration file path into the VelodyneLidarSource object.

velodyneSource = vision.labeler.loading.VelodyneLidarSource;
loadSource(velodyneSource,sourceName,sourceParams);

Read the first frame from the source. Display the frame.

signalName = velodyneSource.SignalName;
pc = readFrame(velodyneSource,signalName,1);

figure
pcshow(pc)

Tips

  • You can use this class as a starting point for creating a custom data source loading class. To view the source code for this class, use this command:

    edit vision.labeler.loading.VelodyneLidarSource

Introduced in R2020a