Lidar Point Cloud 3D Show

5 views (last 30 days)
Elad Soll
Elad Soll on 23 Nov 2019
Commented: Anand on 20 May 2020
Hi
I have a problem to show lidar point cloud by "build lidar map" example.
I took step by step, but only for the lidar sensor. I changed timerange field function inorder to adjust time and ptCloud values to the lidar variables, but I can not see point cloud on my figure.
Note - there is not complier error.
Please help.
my code:
data = load('lidarPointClouds');
lidarPointClouds = data.lidarPointClouds;
head(lidarPointClouds);%8x1 timetable
lidarFrameDuration = median(diff(lidarPointClouds.Time));
lidarFrameDuration.Format = 's';%Adjust display format to sec
lidarRate = 1/seconds(lidarFrameDuration);%Frame rates
%Display frame durations and rates
fprintf('Lidar:%s %3.1f Hz\n',char(lidarFrameDuration),lidarRate);
%Customize axis
xlimits = [-45 45];
ylimits = [-45 45];
zlimits = [-10 20];
lidarPlayer = pcplayer(xlimits,ylimits,zlimits);
xlabel(lidarPlayer.Axes,'X(m)');
ylabel(lidarPlayer.Axes,'Y(m)');
zlabel(lidarPlayer.Axes,'Z(m)');
title(lidarPlayer.Axes,'Lidar Sensor Data');
% Reading Lidar Point Cloud by a loop
lidarFrames = 0; timeSpan = 0 ;ptCloud = 0;
for i = 1:height(timetable)-1
timeSpan = timerange(lidarPointClouds.Time(1),lidarPointClouds.Time(1000),'closed');
lidarFrames = lidarPointClouds(timeSpan,:);
ptCloud = lidarFrames.PointCloud(i);
view(lidarPlayer,ptCloud);
pause(0.01);
end
  4 Comments
aws hawary
aws hawary on 13 Apr 2020
Hello
I have a question if anyone could help me
I got Data LIDAR files ( pcap and csv)
I wanna to apply that data but the files should be compatible with MATLAB platform .. How can I read all the frames of ply file .. I read the total of pcap but I need the frames #separately for each timestamp

Sign in to comment.

Answers (1)

Sai Bhargav Avula
Sai Bhargav Avula on 6 Dec 2019
Hi,
Here is updated code that works for simple lidarPointCloud. I think the issue with your code is 'timetable' wasnot defined properly
data = load('lidarPointClouds.mat');
lidarPointClouds = data.lidarPointClouds;
head(lidarPointClouds);%8x1 timetable
lidarFrameDuration = median(diff(lidarPointClouds.Time));
lidarFrameDuration.Format = 's';%Adjust display format to sec
lidarRate = 1/seconds(lidarFrameDuration);%Frame rates
%Display frame durations and rates
fprintf('Lidar:%s %3.1f Hz\n',char(lidarFrameDuration),lidarRate);
%Customize axis
xlimits = [-45 45];
ylimits = [-45 45];
zlimits = [-10 20];
lidarPlayer = pcplayer(xlimits,ylimits,zlimits);
xlabel(lidarPlayer.Axes,'X(m)');
ylabel(lidarPlayer.Axes,'Y(m)');
zlabel(lidarPlayer.Axes,'Z(m)');
title(lidarPlayer.Axes,'Lidar Sensor Data');
% Reading Lidar Point Cloud by a loop
lidarFrames = 0; timeSpan = 0 ;ptCloud = 0;
timeSpan = timerange(lidarPointClouds.Time(1),lidarPointClouds.Time(1000),'closed');
lidarFrames = lidarPointClouds(timeSpan,:);
for i = 1:height(lidarFrames)-1
ptCloud = lidarFrames.PointCloud(i);
view(lidarPlayer,ptCloud);
pause(0.01);
end
Hope this helps!
  2 Comments
aws hawary
aws hawary on 13 Apr 2020
Hello
I have a question if anyone could help me
I got Data LIDAR files ( pcap and csv)
I wanna to apply that data but the files should be compatible with MATLAB platform .. How can I read all the frames of ply file .. I read the total of pcap but I need the frames #separately for each timestamp
Anand
Anand on 20 May 2020
If you have the PCAP file, you can use the velodyneFileReader class to read frames from it using the readFrame function.
If you have PLY files, you can use the pcread function to read each PLY file.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!