ROS Custom Message cannot use readXYZ

2 visualizaciones (últimos 30 días)
FJB427
FJB427 el 20 de Abr. de 2020
Respondida: Cam Salzberger el 22 de Abr. de 2020
I have a custom message received via MATLAB, and the would like to use readXYZ on the data. However, since the class of these custom messages are not the dictated 'rosbotics.ros.msg.sensor_msgs.PointCloud2' the function call to readXYZ is not successful. I would think there must be a way to either change the custom message prefix to align with the dictated class or would it be easier to convert to the appropriate class? Any help would be appreciated!

Respuesta aceptada

Cam Salzberger
Cam Salzberger el 22 de Abr. de 2020
Francis,
Currently "readXYZ" is a method only on the PointCloud2 message class. The way that it converts the data from the PointCloud2 "data" array into human-usable (x, y, z) coordinates is specific to the PointCloud2 message format and self-description. It would not work even for sensor_msgs/PointCloud, much less an arbitrary encoding that theoretically contains point cloud data.
If your custom message contains point cloud data in the same format as PointCloud2, then my first question would be, "why not just use the built-in PointCloud2 message?" If you are adding additional information to the message, you could easily create a custom message with a field that contains a PointCloud2 message. If you did that, the PointCloud2 message could be used directly with readXYZ or other similar functions in MATLAB.
If you must use the custom message, but it does contain its data in the same format as PointCloud2, you could simply create a PointCloud2 message object and copy the data into it before calling readXYZ.
If your custom message uses a different way of encoding the point cloud data, though, you will need to write your own method for extracting the data into a usable format.
-Cam

Más respuestas (0)

Categorías

Más información sobre Specialized Messages en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by