Creating Pointcloud ROS message in Simulink
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I have a pointcloud data stream where at each time step i have three variables X,Y,Z each of size 160x320 corresponding to the XYZ coordinates or 160*320 points. I would like to create a pointcloud ros message and publish it. Can anyone tell me a method to do it in Simulink?. I tried the following code using saved data for one time step but it takes too much time.
strmsg=rosmessage('sensor_msgs/PointCloud');
tempmsg=rosmessage('geometry_msgs/Point32');
count=1;
for i=1:160
for j=1:320
tempmsg.X=x_data(i,j);
tempmsg.Y=y_data(i,j);
tempmsg.Z=z_data(i,j);
strmsg.Points(count)=tempmsg;
count=count+1;
end
end
Edit: I tried to use for each subsystems and bus assignments to achieve the same in Simulink as shown below. But when viewing the data from ROS, I dont see any values in the Points field of Pointcloud message. Am I doing it correctly?
![ROS_Pointcloud.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246075/ROS_Pointcloud.png)
![ROS_Pointcloud2.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/246076/ROS_Pointcloud2.png)
0 个评论
回答(1 个)
Cam Salzberger
2020-1-15
(Moved from comment to answer)
This question about creating point cloud messages seems fairly similar, and the attached utilties to the answer may help you.
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!