Array in message data being read as string [closed]
In ROS Hydro, I'm publishing a PointCloud2 message, and reading off the "data" field with a simple subscriber. However, unlike other arrays which I've tried to read before (including the "fields" field, which comes through fine), it is read somehow as a string of seemingly random characters. When I print the data directly from the topic using rostopic echo, it shows up fine. For example:
data: [109, 116, 205, 66, 187, 18, 129, 191, 179, 122, 164, 66, 253, 32, 32, 95]
becomes
data: "bXTNQrsSgb+zeqRC/SAgXw=="
when read using a Python/JavaScript subscriber rather than rostopic echo.
I also discovered that if I read the message object with Python as a whole rather than just the specific "data" field, then it is displayed correctly, and only if I try to separate the field from the object does it behave strangely. The subscriber in JavaScript displays it strangely regardless of separation.
I feel like this might have something to do with the way arrays are encoded for different types (data is a uint8[] and fields is a PointField[]), but it's hard to tell. Does anyone know if this is a bug, or if I'm just missing something?
The PointCloud2 I'm testing on is created from the following pcd file using pcl_ros:
# .PCD v.7 - Point Cloud Data file format
VERSION .7
FIELDS x y z rgb
SIZE 4 4 4 4
TYPE F F F F
COUNT 1 1 1 1
WIDTH 1
HEIGHT 1
VIEWPOINT 0 0 0 1 0 0 0
POINTS 1
DATA ascii
1.027273914e+02 -1.008384056e+00 8.223965048e+01 1.15385e+19
Thanks!