Dheeraj
Dheeraj

Reputation: 1202

ROS2 data received at Zenoh, Not able to deserialize

I am receiving the data in sample.payload but i am not able to deserialize the data.

Data format:

b'\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00Demo20\x00\x00\x04\x00\x00\x00gap\x00\x00\x00\x80?\x00\x00\x00@\x00\x00\x80?\x00\x00\x00@{\x14\x8e?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xd3\x02\x96I\x07\x00\x00\x00tripid\x00\x00'
b'\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x07\x00\x00\x00Demo20\x00\x00\t\x00\x00\x00position\x00\x00\x00\x00\xa5\xbdJAH\x90\x9eB\x00\x00\x00@\xd3\x02\x96I\x07\x00\x00\x00tripid\x00\x00'

Getting a struct error.

struct.error: unpack_from requires a buffer of at least 1065353260 bytes for unpacking 1 bytes at offset 1065353259 (actual buffer size is 92)

where am I going wrong?

Upvotes: 1

Views: 437

Answers (1)

JEnoch
JEnoch

Reputation: 56

Assuming you're using pycdr, as done in this example, you should check if the Python class you defined for the expected deserialized type correspond exactly to the ROS2 message definition.

In this same example, the Log class corresponds exactly to the ROS2 Log message (ordering of fields is important).

Upvotes: 3

Related Questions