readFrame
Read Velodyne point cloud from file
Syntax
Description
reads the next point cloud in sequence from the Velodyne® PCAP file and returns a ptCloud
= readFrame(veloReader
)pointCloud
object.
reads the point cloud with the specific frame number from the file.ptCloud
= readFrame(veloReader
,frameNumber
)
reads the first point cloud recorded at or after the given
ptCloud
= readFrame(veloReader
,frameTime
)frameTime
.
[
returns the timestamps for all points in the point cloud using any combination of
input arguments from previous syntaxes.ptCloud
,pointTimestamps
] = readFrame(___)
[
returns the positional information for each point cloud frame.ptCloud
,pointTimestamps
,positionData
] = readFrame(___)
Examples
Read Point Cloud from File Using Time Duration
Create a velodyneFileReader
object to read a Velodyne® packet capture (PCAP) file and select specific point clouds using a duration
scalar.
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');
Create a duration
scalar that represents one second after the first point cloud reading.
timeDuration = veloReader.StartTime + duration(0,0,1,Format='s');
Read the first point cloud recorded at or after the given time duration.
ptCloudObj = readFrame(veloReader,timeDuration);
Display the point cloud using pcshow
.
figure pcshow(ptCloudObj)
Input Arguments
veloReader
— Velodyne file reader
velodyneFileReader
object
Velodyne file reader, specified as a
velodyneFileReader
object.
frameNumber
— Frame number of desired point cloud in the file
positive integer
Frame number of the desired point cloud in file, specified as a positive integer. Frame numbers are sequential.
frameTime
— Frame time of desired point cloud in file
duration
scalar
Frame time of the desired point cloud in the file, specified as a duration
scalar in seconds.
The first frame available at or after frameTime
is
given.
Output Arguments
ptCloud
— Point cloud
pointCloud
object
Point cloud, returned as a pointCloud
object.
pointTimestamps
— Timestamps for all points in point cloud
duration
vector | duration
matrix
Timestamps for all points in the point cloud, returned as a duration
vector or a matrix.
The function returns timestamps as:
An M-element vector for unorganized point clouds. M is the total number of points in the point cloud.
An M-by-N matrix for organized point clouds. M and N are the number of rows and columns in the organized point cloud, respectively.
Timestamps are between the values of StartTime
and
EndTime
, which are properties of the velodyneFileReader
object. Points in an organized point cloud
with a NaN
value is returned with a time stamp set to
NaN
.
positionData
— Position data
structure
Position data, returned as a structure with five fields:
Field | Description |
---|---|
GPSReadings | GPS reading data, returned as an
M-by-4 matrix of data type
If the GPS hardware is not connected,
then the function returns |
GyroscopeReadings | Raw gyroscopic rotation readings in radians per
second, collected from the three internal gyroscopes in
GPS hardware, returned as an M-by-3
matrix of data type
If the Velodyne device model is not
HDL-32E, then the function returns
|
AccelerometerReadings | Raw accelerometer readings, in
m/s2, collected from the
three internal accelerometers in GPS hardware, returned
as an M-by-6 matrix of data type
If the Velodyne device model is not
HDL-32E, then the function returns
|
PositionTimestamps | Timestamp for each position reading, returned as an
M-by-1 duration vector. |
GPSTimes | Time of the GPS in UTC, returned as an
M-by-1 duration
vector, used to synchronize the timestamps of the GPS
coordinates with their respective point clouds. |
positionData
returns []
when there
is no position data in the PCAP file.
References
[1] Velodyne LiDAR, Inc. "HDL-32E User Manual." 63-9113 Rev. M, 2018.
Version History
Introduced in R2018aR2023a: Returns positional information for each point cloud frame
The readFrame
function can return the raw position readings
of point cloud data for each frame as a structure with fields for the GPS locations,
gyroscope readings, accelerometer readings, position reading timestamps, and GPS
reading timestamps.
R2022b: Returns timestamps for all points in point cloud
The readFrame
function additionally returns the timestamps
for all the points in the point cloud as a duration
vector or matrix.
See Also
Functions
Objects
External Websites
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)