rospy string type

asked 2018-05-09 15:35:49 -0500

thinwybk gravatar image

The - 2.1.1 Field Types states

Primitive Type | Serialization | C++ | Python2 | Python3

string | ascii string (4) | std::string | str | bytes

.4. unicode strings are currently not supported as a ROS data type. utf-8 should be used to be compatible with ROS string serialization. In python 2, this encoding is automatic for unicode objects, but decoding must be done manually. In python 3, when using str, both encoding and decoding using 'utf-8' in the generated message code.

  • Is Python-level string publishing in Python2 plain str?
  • Is "serialized" string publishing in Python2 plain str and subscription str + utf-8 decoding?
  • Is Python-level string in Python3 plain bytes?
  • Is "serialized" string publishing in Python3 str + utf-8 encoding and subscription str + utf-8 decoding?
edit retag flag offensive close merge delete



I'm not sure, but I believe Python3 and strings on ROS Discourse answers (most of) this.

gvdhoorn gravatar image gvdhoorn  ( 2018-05-10 02:26:18 -0500 )edit

Thx a lot for the hint. Helped a lot.

thinwybk gravatar image thinwybk  ( 2018-05-10 12:26:31 -0500 )edit