Main Content

velodyneFileReader

Read point cloud data from Velodyne PCAP file

Description

The velodyneFileReader object reads point cloud data from a Velodyne® packet capture (PCAP) file.

Creation

Description

example

veloReader = velodyneFileReader(FileName,DeviceModel) creates a Velodyne file reader that reads in point cloud data. Specify the PCAP file and the device model that generated the file. The inputs set the FileName and DeviceModel properties directly. The reader supports the VLP-16, Puck LITE, Puck Hi-Res, VLP-32C, HDL-32E, HDL-64E, VLS-128, and Velarray H800 device models.

veloReader = velodyneFileReader(FileName,DeviceModel,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, (OrganizePoints=true) returns an organized point cloud.

Input Arguments

expand all

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: (OrganizePoints=true) returns an organized point cloud.

Calibration XML file, specified as a string. If you do not specify a calibration file, the reader selects a default calibration file containing data from the Velodyne device manual.

Note

If using the "VelarrayH800" device model, you must specify the calibration file.

Logical to set the structure for the output point cloud, specified as a numeric or logical 1 (true) or 0 (false) scalar.

To return an organized point cloud structure, set OrganizePoints to true. For an organized point cloud, every row represents a separate laser scan, and the number of columns is based on the horizontal angle resolution of the sensor.

To return an unorganized point cloud structure, set OrganizePoints to false.

Properties

expand all

This property is read-only.

Name of Velodyne PCAP file to read lidar data from, specified as a character vector or string scalar.

This property is read-only.

Velodyne device model name, specified as "VLP16", "PuckLITE", "PuckHiRes", "VLP32C", "HDL32E", "HDL64E", "VLS128", or "VelarrayH800".

Note

Specifying the incorrect device model returns an improperly calibrated point cloud.

This property is read-only.

Name of the Velodyne calibration XML file, specified as a character vector or string scalar. This calibration file is included with every sensor.

This property is read-only.

Total number of point clouds in the file, specified as a positive integer.

This property is read-only.

Total duration of the file in seconds, specified as a duration scalar.

This property is read-only.

Time of the first point cloud, specified as a duration scalar in seconds.

Start and end times are specified relative to the previous whole hour. For instance, if the file is recorded for 7 minutes from 1:58 p.m. to 2:05 p.m., then:

  • StartTime = 58 min × 60 s = 3480 s

  • EndTime = StartTime + 7 min × 60 s = 3900 s

This property is read-only.

Time of the last point cloud reading, specified as a duration scalar.

Start and end times are specified relative to the previous whole hour. For instance, if the file is recorded for 7 minutes from 1:58 PM to 2:05 PM, then:

  • StartTime = 58 min × 60 s = 3480 s

  • EndTime = StartTime + 7 min × 60 s = 3900 s

Time for the current point cloud reading in seconds, specified as a duration scalar. As you read point clouds using readFrame, this property is updated with the most recent point cloud reading time. You can use reset to reset the value of this property to the default value. The default value matches the StartTime property.

This property is read-only.

Start time for each point cloud frame in seconds, specified as a duration vector. The length of the vector is equal to the value of NumberOfFrames property. The value of first element in the vector is same as that of the StartTime property. You can use this property to read point cloud frames captured at different times.

For example, read start time of a point cloud frame from the Timestamps property. Pass the start time as an input to the readFrame function and read the corresponding point cloud frame.

veloReader = velodyneFileReader("lidarData_ConstructionRoad.pcap","HDL32E")
frameTime  = veloReader.Timestamps(10);
ptCloud    = readFrame(veloReader,frameTime);

This property is read-only.

Logical to set the structure for the output point cloud, specified as a numeric or logical 1 (true) or 0 (false). This read-only property is set using the OrganizePoints name-value argument.

This property is read-only.

Logical to indicate existence of position data in the PCAP file, specified as a logical scalar 1 (true) or 0 (false).

Object Functions

hasFrameDetermine if another Velodyne point cloud is available
readFrameRead Velodyne point cloud from file
resetReset the CurrentTime property of velodyneFileReader object to the default value

Examples

collapse all

Use the velodyneFileReader to read a packet capture (PCAP) file from a Velodyne® sensor. View point clouds using pcplayer.

Read in point clouds by using a Velodyne® file reader. Specify the PCAP file to read and the Velodyne® device model.

veloReader = velodyneFileReader('lidarData_ConstructionRoad.pcap','HDL32E');

Define x-, y-, and z-axes limits for pcplayer in meters. Label the axes.

xlimits = [-60 60];
ylimits = [-60 60];
zlimits = [-20 20];

Create the point cloud player.

player = pcplayer(xlimits,ylimits,zlimits);

Label the axes.

xlabel(player.Axes,'X (m)');
ylabel(player.Axes,'Y (m)');
zlabel(player.Axes,'Z (m)');

The first point cloud of interest is captured at 0.3 second into the file. Set the CurrentTime property to that time to being reading point clouds from there.

veloReader.CurrentTime = veloReader.StartTime + seconds(0.3); 

Display the point cloud stream for 10 seconds. Remove the last while condition to display the full stream.

Use hasFrame to check if a new frame is available. Iterate through the file by calling readFrame to read in point clouds. Display them using the point cloud player. Remove the last while condition to display the full stream.

while(hasFrame(veloReader) && player.isOpen() && (veloReader.CurrentTime < veloReader.StartTime + seconds(10)))
    ptCloudObj = readFrame(veloReader);
    view(player,ptCloudObj.Location,ptCloudObj.Intensity);
    pause(0.1);
end

Version History

Introduced in R2018a

expand all