Type system fails to parse ros2 bounded size msgs
My Environment
Ubuntu 18.04, Python 3.8.12, rosbags 0.9.6 installed w/ pip
The Issue
Having trouble getting the type system working w/ custom ros2 messages with bounded length arrays / strings. See end of 2.1.1 of interfaces docs link for examples of these bounded length messages.
The exception
Traceback (most recent call last):
File "/home/frivold/kef_env/kef_ws/src/kef_py_utils/venv38/lib/python3.8/site-packages/rosbags/typesys/base.py", line 69, in parse_message_definition
assert npos == len(text), f'Could not parse: {text!r}'
AssertionError: Could not parse: 'MSG: kef_messages/msg/StringBounded\nstring<=10 bar'
Msg that works
StringNormal.msg
string foo
Msg that breaks
StringBounded.msg
string<=10 bar
Another that breaks
ArrayBounded.msg
float64[<=10] fizz
Note: Fixed size arrays ie. float64[10] fizz
are fine though.
@bbferka's python script
Borrowing#!/usr/bin/env python3
from pathlib import Path
from rosbags.typesys import get_types_from_msg, register_types
add_types= {}
string_normal = Path('./StringNormal.msg').read_text()
add_types.update(get_types_from_msg(string_normal, 'test_msg/msg/StringNormal'))
print("Success")
string_bounded = Path('./StringBounded.msg').read_text()
add_types.update(get_types_from_msg(string_bounded, 'test_msg/msg/StringBounded'))
print("Success")