-
Notifications
You must be signed in to change notification settings - Fork 229
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
Decode ROS2 raw byte data using rclpy.serialization.deserialize_message #1273
Comments
I believe |
serialized message seems to be wrong, the following works w/o any problem. def main():
msg = String()
msg.data = 'Hello, world!'
msg_serialized = serialize_message(msg)
print(msg_serialized)
msg_deserialized = deserialize_message(msg_serialized, String)
print(msg_deserialized) the output is, b'\x00\x01\x00\x00\x0e\x00\x00\x00Hello, world!\x00'
std_msgs.msg.String(data='Hello, world!') |
ros2/rclpy#1273 Signed-off-by: Tomoya Fujita <[email protected]>
I have tried what you suggest @fujitatomoya and I'm able to successfully decode the string, the issue is that my data come from foxglove_bridge and the encoding seems to be a bit different. To give a bit more context, I try to create a ws-client to subscribe to a topic with a foxglove_bridge (https://github.com/foxglove/ros-foxglove-bridge), so I have: Here is the complete python script of the ws-client:
|
I try to get data from a ros-foxglove-bridge (more detail on the scope here
https://github.com/orgs/foxglove/discussions/991). I'm able to receive a ROS2 raw coded message in binary format but I'm not able to decode it properly. I tried to use deserialize_message to deserialize the data but I'm not able to make it work.
Required Info:
Steps to reproduce issue
Here is a standalone code with only the data received from the websocket hardcoded. The original message is a ROS2 std_msgs.msg String at the format:
data: Hello, world! Time(nanoseconds=1713770713401001821, clock_type=ROS_TIME)
Expected behavior
I would like to be able to decode the string message to get a deserialized value (to be able to also decode more advanced message.
Actual behavior
It shows the following error message:
return _rclpy.rclpy_deserialize(serialized_message, message_type)
rclpy._rclpy_pybind11.RMWError: failed to deserialize ROS message: rmw_serialize: invalid data size, at ./src/rmw_node.cpp:1727
I'm not sure if I'm not able to use the function without error because of validity of my data or just because of the provided arguments.
The text was updated successfully, but these errors were encountered: