Client for ws-protocol in python #991
-
Is there a python client for foxglove ws-protocol ? I try to communicate with a ROS2 application running ros-foxglove-bridge by using websockets (the sub-protocol foxglove.websocket.v1). i'm able to subscribe to topics and listen for messages but I was not able to decode the bytes message (cdr). The messages received are raw bits messages here is what i get from a string: I tried to use mcap (https://github.com/foxglove/mcap/tree/b8a73890348ef2dc69272b377fd2faab56f0303f) python examples to decode the bytes but I got the error: AttributeError: 'bytes' object has no attribute 'seekable'. Platform: Here is my script:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
We don't have a python client library. The challenge you will have with decoding the raw ROS2 CDR data in python is that you need to lookup (or build at runtime) a deserializer for the specific message you want to read. It looks like you understand some part of that by trying to invoke the "deserialize_message" method from rclpy with the An error like |
Beta Was this translation helpful? Give feedback.
-
I see that starting with 0.8, the bridge now supports JSON encoding for ROS2. Does that mean that there is a parameter we can use to receive messages in JSON rather than in binary CDR? |
Beta Was this translation helpful? Give feedback.
We don't have a python client library. The challenge you will have with decoding the raw ROS2 CDR data in python is that you need to lookup (or build at runtime) a deserializer for the specific message you want to read. It looks like you understand some part of that by trying to invoke the "deserialize_message" method from rclpy with the
String
type. Is that the type of the message you are trying to deserialize?An error like
AttributeError: 'bytes' object has no attribute 'seekable'.
indicates to me that you are passing some sort of object thatdeserialize_message
does not support. This is a more ROS 2 specific question so you might have more luck asking on the ROS 2 support forums on wh…