ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Custom Message with uint8[] Reads as string [..] in Python I can't seem to pull information from the custom message. When I try to take the passed array, it reads it as a 'str' type. Is there anything I am doing wrong here?

No, and this is actually as-designed and documented.

From wiki/msg: Message Description Specification, section Array handling (a screenshot of the page as recreating the table is not really possible here):

rospy_array_handling

Note the columns for Python 2 and Python 3, the row for uint8[] and note 2 about how in Python 2 that all gets mapped to str.

Custom Message with uint8[] Reads as string [..] in Python I can't seem to pull information from the custom message. When I try to take the passed array, it reads it as a 'str' type. Is there anything I am doing wrong here?

No, and this is actually as-designed and documented.

From wiki/msg: Message Description Specification, section Array handling (a screenshot of the page as recreating the table is not really possible here):

rospy_array_handling

Note the columns for Python 2 and Python 3, the row for uint8[] and note 2 about how in Python 2 that all gets mapped to str.

Note also this is a "Python 2 thing": there is a str<->bytes duality there almost. I can't find any authoritative sources right now, so I can't link to anything, but there is a myriad of pages which discuss this difficulty with Python 2.

Edit: in Visual Studio Code, when I create a variable field = DensityField() and type "field.data", hovering over "data" reveals that it thinks its a string. [..] I have no idea why it thinks its a string.

No, it doesn't think it, it is a str.

Is it possible to force catkin_make to regenerate the messages?

That would not change anything, as I hope is clear now.