error when deserialize custom message
System information
OS Platform and Distribution: Ubuntu18.04
python version : 3.8.10
Steps to reproduce the issue:
Dear Ternaris team,I try to deserialize a custom message after register the type with get_types_from_msg() ,register_types() API follow this tutorial;
but when use deserialize_cdr(),there comes an error like
here is my code and msg file,the msg file only contains an int64 member and a string member,wish you can provide some advice.
from pathlib import Path
from common.msg import Bytes
from rosbags.typesys import get_types_from_idl, get_types_from_msg, register_types
msg_text = Path('/home/zwchen/custom_ws/common/msg/Bytes.msg').read_text()
add_types = {}
print(msg_text)
# add_types.update()
bytes_type = get_types_from_msg(msg_text, 'common/msg/Bytes')
add_types.update(bytes_type)
print('bytes_type',bytes_type)
register_types(bytes_type)
from rosbags.rosbag1 import Reader
from rosbags.rosbag1.reader import deserialize_time
from rosbags.serde import deserialize_cdr
with Reader('/home/zwchen/Downloads/2021-05-24-11-28-42.bag') as reader:
for topic,msgtype,timestamp,rawdata in reader.messages():
if topic == '/test_topic':
print('msgtype ',msgtype)
print(
'timestamp ',timestamp
)
msg = deserialize_cdr(rawdata,msgtype)