Main Content

velodyneFileReader

Read point cloud data fromVelodynePCAP file

Description

ThevelodyneFileReaderobject reads point cloud data from a Velodyne®packet capture (PCAP) file.

Creation

Description

example

veloReader= velodyneFileReader(文件名,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 theFileNameandDeviceModel直接属性。读者支持VLP-1金宝app6, Puck LITE, Puck Hi-Res, VLP-32C, HDL-32E, HDL-64E, and VLS-128 device models.

veloReader= velodyneFileReader(文件名,deviceModel,'CalibrationFile',calibFile)specifies the Velodyne calibration XML file and sets theCalibrationFileproperty.

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 adurationscalar.

This property is read-only.

Time of the first point cloud, specified as adurationscalar 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 adurationscalar.

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 adurationscalar. As you read point clouds usingreadFrame, this property is updated with the most recent point cloud reading time. You can useresetto reset the value of this property to the default value. The default value matches theStartTimeproperty.

This property is read-only.

Start time for each point cloud frame in seconds, specified as adurationvector. The length of the vector is equal to the value ofNumberOfFramesproperty. The value of first element in the vector is same as that of theStartTimeproperty. 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 theTimestampsproperty. Pass the start time as an input to thereadFramefunction and read the corresponding point cloud frame.

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

Object Functions

hasFrame Determine if anotherVelodynepoint cloud is available
readFrame ReadVelodynepoint cloud from file
reset Reset theCurrentTimeproperty ofvelodyneFileReaderobject to the default value

Examples

collapse all

Use thevelodyneFileReaderto read a packet capture (PCAP) file from a Velodyne® sensor. View point clouds usingpcplayer.

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');

Definex-, y-,andz-axes limits forpcplayerin 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 theCurrentTimeproperty 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 lastwhilecondition to display the full stream.

UsehasFrameto check if a new frame is available. Iterate through the file by callingreadFrameto read in point clouds. Display them using the point cloud player. Remove the lastwhilecondition 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

Figure Point Cloud Player contains an axes. The axes contains an object of type scatter.

See Also

Functions

Objects

Topics

External Websites

Introduced in R2018a