MATLAB Answers

Lidar Point Cloud 3D Show

3 ビュー (過去 30 日間)
Elad Soll
Elad Soll 2019 年 11 月 23 日
回答済み: Sai Bhargav Avula 2019 年 12 月 6 日
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

  2 件のコメント

Walter Roberson
Walter Roberson 2019 年 11 月 23 日
You appear to have posted your question twice ?
Elad Soll
Elad Soll 2019 年 11 月 23 日
Yes , sorry .. it's my first time asking for a question and i am pretty new at matlab

サインイン to comment.

回答 (1 件)

Sai Bhargav Avula
Sai Bhargav Avula 2019 年 12 月 6 日
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!

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

タグ


Translated by