Main Content

hasFrame

Determine if another Hesai point cloud is available

Since R2022a

Description

isAvailable = hasFrame(hesaiReader) determines if another point cloud is available in the packet capture (PCAP) file of the input Hesai® file reader. As you read point clouds using readFrame, the point clouds are read sequentially until this function returns false.

example

Examples

collapse all

Download a ZIP file containing a Hesai packet capture (PCAP) file and then unzip the file.

zipFile = matlab.internal.examples.downloadSupportFile("lidar","data/hesai_BusyRoad.zip");
saveFolder = fileparts(zipFile);
pcapFileName = [saveFolder filesep 'hesai_BusyRoad.pcap'];
if ~exist(pcapFileName,"file")
    unzip(zipFile,saveFolder);
end

Create a hesaiFileReader object.

hesaiReader = hesaiFileReader(pcapFileName,"Pandar128E3X");

Check if hesaiReader has a next point cloud to read.

disp(hasFrame(hesaiReader))
   1

Read the last frame in the file.

ptCloud = readFrame(hesaiReader,hesaiReader.NumberOfFrames);

Check if hesaiReader has a next point cloud frame available to read.

disp(hasFrame(hesaiReader))
   0

Input Arguments

collapse all

Hesai file reader, specified as hesaiFileReader object.

Output Arguments

collapse all

Frame is available, returned as 1 (true) or 0 (false). This argument returns true if the Hesai file reader contains one or more point cloud frames to read after the current frame. Otherwise, it returns false.

Version History

Introduced in R2022a