Closed nyxaria closed 4 years ago
BTW, you seem to have copied one line from _String.py
incorrectly. In my version (Kinetic) at least it looks like this, which makes much more sense:
if python3 or type(_x) == unicode:
You are right, I was messing around with the source code. In python3 str
is equivalent to unicode
so I thought I would try that, thanks for reminding me I will change it back!
When running this package in python 3, the conversion of a string fails because of the ros implementation of
std_msgs/msg/_String.py
. They callencode()
on thedata
field of a string object due topython3
being alwaysTrue
:However, the rospy_message_converter already does this when it converts a string python object to a ros_primitive in
rospy_message_converter/src/rospy_message_converter/message_converter.py:149
:The fix is to add a check that we are not in python3 before doing the conversion.
This works for std_msgs/String and sensor_msgs/JointState but I am not sure if this breaks anything else as I don't have the infrastructure in place to test this.
I will create a PR shortly.