Convert Struct to Pointcloud using ROS2
7 次查看(过去 30 天)
显示 更早的评论
I am trying to convert one structure (a) to point to cloud2.However, I am having problems converting this. Already tried this
ptCloud = pointCloud('a');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/734824/image.jpeg)
0 个评论
采纳的回答
Josh Chen
2021-9-10
Hello Manuel,
The function pointCloud takes 3-D coordinate points as input argument. However, the variable 'a' here in the screenshot seems to be an 'sensor_msgs/PointCloud2' message struct. To return a point cloud, you would have to first use rosReadXYZ to extract the 3-D coordinate points and use it as the input to the pointCloud function.
In this case, the following code shall return the point cloud from a:
>> pts = rosReadXYZ(a);
>> ptCloud = pointCloud(pts);
Hope this helps,
Josh
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Specialized Messages 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!