-
Notifications
You must be signed in to change notification settings - Fork 913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unicode Caller ID prevent receiving topic messages #704
Comments
I managed to trace down the issue to this place : # check for name override
mappings = rospy.names.get_mappings()
print mappings
if '__name' in mappings:
name = mappings['__name']
if anonymous:
logdebug("[%s] WARNING: due to __name setting, anonymous setting is being changed to false"%name)
anonymous = False rospy.names.get_mappings() is actually : This mapping is unicode because the argument is passed from command line directly ( started with roslaunch ). So It looks like :
Looking at http://docs.ros.org/api/rospy/html/rospy-module.html#init_node It seems argv should be [str] so that means I need to make that happen on the caller code, before rospy... |
In case it s of any help to someone else coming around here, this did the trick : node_str_argv = [unicodedata.normalize('NFKD', arg).encode('ascii', 'ignore') if isinstance(arg, unicode) else str(arg) for arg in node_argv]
rospy.init_node(name=node_name, argv=node_str_argv) |
I think there is still a piece missing here. You mentioned that the variable was a raw string before and afterwards is a unicode string. While you mentioned that the value was both time just
Unicode or not Python does convert the string automatically. The problem is that the character is not a character with ascii value 0-127. So the question is what actual value was the problem and where did it come from? Maybe you can provide a reproducible example to answer both questions. |
The string is not converted. Doing something like |
Using the single line works fine for me. Please provide a SSCCE. |
Sorry my argv syntax was wrong. Full Talker node triggering the problem ( plus some boilerplate code to get ROS to initialize from inside python debugger ) : https://gist.github.com/asmodehn/92ff6f9f0cf35a65533c |
Thank you for the reproducible example. Can you please try the patch from PR #717 and report back if it fixes the problem for you. |
I tried with this modified talker node and indeed the problem seems fixed ! |
fix encoding of header fields (fix #704)
Thank you for confirming. |
fix encoding of header fields (fix ros#704)
I am currently investigating this, while diving into rospy code, so I have only a part of the information...
It seems that, whenever
rospy.names.get_name()
returns acaller_id
that is a unicode string, it then goes intorospy.impl.tcpros_pubsub.get_header_fields()
which forwards this totcpros_base.write_header()
and torosgraph.network.write_ros_handshake_header()
.There
encode_ros_handshake_header
throw'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128)
which is caught intcpros_base._tcp_server_callback
and the following message is displayed:And since the connection doesn't happen some communication breaks somewhere.
It took me a very long time to track this down because :
Now here are my two questions :
This happens for me now with https://github.com/asmodehn/rostful but the setup is a bit complicated, identifying the core issue with a simpler setup would be helpful.
I ll keep looking for more clues in the next few days...
The text was updated successfully, but these errors were encountered: