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, and VLS-128 device models.

veloReader = velodyneFileReader(fileName,deviceModel,'CalibrationFile',calibFile) specifies the Velodyne calibration XML file and sets the CalibrationFile property.

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', or 'VLS128'.

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 = 3840 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 = 3840 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);

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

See Also

Functions

Objects

Topics

External Websites

Introduced in R2018a