Clear Filters
Clear Filters

How to save in workspace a "point cloud, location" output from simulink block "Lidar Point Cloud Generator"

2 views (last 30 days)
I want to import into the workspace the point cloud that the simulink block "Lidar point cloud generator" provides me with as a "Point cloud".
The simulink block, in output on simulink, already provides me with this type of data however when I try to save it using the "To Workspace" block it saves the file as a 4-D.
In fact saving it this way I cannot view it through the "Lidar Viewer " tool.
Preamble:
I use this block to simulate the Lidar sensor as it seems to be the only one that interfaces with RoadRunner.
I already tried using lidarpointcloudgenerator() however I`m interested in saving everything to the workspace since, the system is all on simulink and anyway there would still be the problem for importing the data.
Thanks in advance for the help.

Answers (1)

Sai Pavan
Sai Pavan on 6 Dec 2023
Hi Elviro,
I understand that you are trying to save point cloud generated from the “Lidar Point Cloud Generator” Simulink block in the workspace.
When using the "To Workspace" block to save the data in to the workspace, ensure that you are saving it in “Structure with Time” format, which can be accessed in the block parameters. This will help preserve the point cloud data as a single entity rather than as a 4-D array and allowing it to be visualized using the "Lidar Viewer" tool.
The code snippet attached below demonstrates how the saved point cloud data in the MATLAB workspace can be accessed:
lidarPointCloud = lidarData.Data; % Access the saved point cloud data
pcshow(lidarPointCloud) % Visualize the point cloud
Hope it helps.
Regards,
Sai Pavan

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!