MATLAB Answers

Li Jack
0

How to change PointCloud2 Piont Data type?

Asked by Li Jack
on 11 Jun 2019
Latest activity Answered by Cam Salzberger on 12 Jun 2019
I extraced points data from a simulation software, when put x,y,z directly into a bus assigment with PointCloud2 messagetype,I found the Data is uint8, can't accept float format x,y,z,if change data into uint, the微信图片_20190611175118.jpg accuracy will be very low. I tried to define Fields in simulink or matlab worktable,they all didn't work, the Data'type is still uint.

  0 Comments

Sign in to comment.

1 Answer

Answer by Cam Salzberger on 12 Jun 2019

The data type in the sensor_msgs/PointCloud2 ROS message type is hard-locked by the message definition. Note, however, that the uint8 data type does not mean that all of the XYZ positions in the point cloud are expected to be at integer values. The "fields" field in the message helps to define exactly how the data contained in the message should be read, including an option for float64.
When extracting the data from a pointcloud2 message, you can pass the output of the Subscribe block directly to a Read Point Cloud block. Assuming the message has been created correctly, the data will be parsed and output in its correct data type. Sebastian has posted a functionality for creating PointCloud2 messages (from CVST point cloud input).
-Cam

  0 Comments

Sign in to comment.