MATLAB Answers

ROS create PointCloud2 from MATLAB pointCloud

65 views (last 30 days)
I am looking to convert a MATLAB pointCloud object to a ROS PointCloud2 message. My application is receiving a point cloud, and processing the data in MATLAB. Then I wish to publish this cloud to ROS in the PointCloud2 format. I assume that since MATLAB can read the XYZ and RGB values in my subscribed PointCloud2 then there are translations between the two.
This is my current MATLAB pointCloud object that I wish to transform to something similar to the PointCloud2 that i receive.
This is my received PointCloud2 message in MATLAB:
I would very much appreciate any help! I think that I really don't understand how the PointCloud2 messages are formatted...

Accepted Answer

Sebastian Castro
Sebastian Castro on 14 Mar 2019
Hello Connor,
It's almost been a year since you asked, but I just learned about this question!
I've written MATLAB and Simulink utilities to convert from Computer Vision System Toolbox to ROS PointCloud2 messages, and you can find them here.
If anyone would like to test them, let us know how it worked at roboticsarena@mathworks.com.
- Sebastian

  1 Comment

Jose Avendano Arbelaez
Jose Avendano Arbelaez on 19 May 2020 at 18:09
For MATLAB R2019b and later please use the modified library attached. Otherwise, there will be an error in the model related to the block mask for Package Point Cloud.
-Jose

Sign in to comment.

More Answers (0)

Sign in to answer this question.