RobotWebTools / rosbridge_suite

Server Implementations of the rosbridge v2 Protocol
https://robotwebtools.github.io
BSD 3-Clause "New" or "Revised" License
866 stars 506 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte #884

Open thuongnv94 opened 8 months ago

thuongnv94 commented 8 months ago

I got this error when I tried to send a sensor_msgs::Image message via ros_bridge ros1 version. Has anyone met this issue? File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/subscription_modifiers.py", line 164, in run MessageHandler.handle_message(self, msg) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/subscription_modifiers.py", line 73, in handle_message self.publish(msg) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/capabilities/subscribe.py", line 148, in _publish self.publish(message, self.fragment_size, self.compression) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/capabilities/subscribe.py", line 298, in publish outgoing_msg["msg"] = message.get_json_values() File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/outgoing_message.py", line 25, in get_json_values self._json_values = extract_json_values(self._message) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/message_conversion.py", line 124, in extract_values return _from_inst(inst, rostype) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/message_conversion.py", line 159, in _from_inst return _from_object_inst(inst, rostype) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/message_conversion.py", line 183, in _from_object_inst msg[field_name] = _from_inst(field_inst, field_rostype) File "/home/ubuntu/rosbridge_ws/src/rosbridge_library/src/rosbridge_library/internal/message_conversion.py", line 139, in _from_inst return encoded if python2 else encoded.decode('ascii') UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 4347: ordinal not in range(128)

brean commented 6 months ago

You need to provide more code, it looks like your image gets decoded as an image, so you are probably accessing it wrong. This is probably not a bug in ROSBridge-suite but your code.