Skip to content
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

Problems with Message definitions containing backslashes in comments #137

Open
benjaminsoellner opened this issue Apr 9, 2021 · 0 comments

Comments

@benjaminsoellner
Copy link

Given you have some message definition like the following (SomeMessage.msg):

# \brief Some description
# \note Something I really want to stress
float64 x

... genpy will not escape the slashes when writing the _full_text member for the message serialization / deserialization classes.

In fact, a bagfile will contain the invalid message definition:

Header header
#rief Some description
# 
ote Something I really want to stress
float64 x

... invalidating the stored message and md5hash.

For the given example you can try this out with:

from your_package.msg import SomeMessage
constructed_msg = SomeMessage()
# output the message definition: without the fix you should see \b and especially \n screwing up the message definition,
# introducing a weird new "ote" field for the "# \note" comment
print(constructed_msg._full_text)
with rosbag.Bag("/tmp/test.bag", "w") as bag:
  bag.write("/some_topic", constructed_msg, genpy.Time.from_sec(0))
with rosbag.Bag("/tmp/test.bag") as bag:
  # attempt to read the message again. You will get an empty message and a md5sum-error without the fix
  next(bag.read_messages(topics=["/some_topic"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant