How to change PointCloud2 Piont Data type?

조회 수: 7 (최근 30일)
Li Jack
Li Jack 2019년 6월 11일
답변: Cam Salzberger 2019년 6월 12일
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.

답변 (1개)

Cam Salzberger
Cam Salzberger 2019년 6월 12일
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

카테고리

Help CenterFile Exchange에서 Specialized Messages에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by