Skip to content

'ascii' codec can't decode byte #1002

@alien19

Description

@alien19

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions