Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

'ascii' codec can't decode byte #1002

Open
alien19 opened this issue Feb 4, 2025 · 1 comment
Open

'ascii' codec can't decode byte #1002

alien19 opened this issue Feb 4, 2025 · 1 comment
Labels

Comments

@alien19
Copy link

alien19 commented Feb 4, 2025

Description
I'm using rosbridge_server to publish some rostopics data in bson_only mode. The messages are of type sensor_msgs/Imu and sensor_msgs/Image.
I can send the subscribe message to the server in bson format, in case of the imu topic the client gets the data correctly but in case of Image topic the server gives me
Exception calling subscribe callback: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

  • Library Version: newest version (0.11.17-1focal.20240913.194148)
  • ROS Version: Noetic
  • Platform / OS: Ubuntu 20.04 (WSL)

Steps To Reproduce
In Python:
on the client side:

import websocket
import bson
import cbor2


def on_message(ws, message):
    print("Received message:", bson.BSON.decode(message))

def on_error(ws, error):
    print("Error:", error)

def on_close(ws, close_status_code , close_msg):
    ws.close
    print("Connection closed", close_status_code, close_msg)

def on_open(ws):
    # Create a BSON message
    message = {
        "op": "subscribe",
        "topic": "/mcsrov/imu"
        }
    ws.send_bytes(bson.BSON.encode(message))

if __name__ == "__main__":
    websocket.enableTrace(True)
    ws = websocket.WebSocketApp("ws://localhost:9080",
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)
    ws.on_open = on_open
    ws.run_forever()


on the server side, in a launch file:

<include file="$(find rosbridge_server)/launch/rosbridge_websocket.launch" > 
    <arg name="port" value="9080"/>
    <arg name="bson_only_mode" value="true"/>
  </include>

Expected Behavior
the client gets the image message binary-encoded

Actual Behavior
no Image msg received

@alien19 alien19 added the bug label Feb 4, 2025
@alien19
Copy link
Author

alien19 commented Feb 5, 2025

Update
I have reached that the line 208 is causing the error where the uint8[] in ros is dealt as string which is not the case so, I see no use of encoding then decoding just returning the "inst" is enough, I'm working on it and will check its efficiency

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant