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

Deserializing error for string type #234

Open
hr-ti opened this issue Aug 23, 2024 · 3 comments
Open

Deserializing error for string type #234

hr-ti opened this issue Aug 23, 2024 · 3 comments

Comments

@hr-ti
Copy link

hr-ti commented Aug 23, 2024

Describe the bug
String types in service types cause microROS on the MCU side to fail in the executor due to a deserializing error. Running it through a debugger it fails in ucdr_deserialize_sequence_header when parsing the nested message type.

Service calls with non-string types work as expected. I've verified it's not a buffer overflow since the buffer size >> bytes received. There is also no packet corruption in UDP traffic, the dest packet and src packet match 1:1.

To Reproduce
Steps to reproduce the behaviour:

  1. On MCU, init service with service type that has a string type
  2. On host side, call service

Expected behaviour
The MCU accepts the service call and handles accordingly.

Actual behaviour
Executor fails due to deserialization error.

System information (please complete the following information):

  • OS: Ubuntu 22.04
  • ROS 2 Humble
  • MCU: STM32F767ZI
@hr-ti
Copy link
Author

hr-ti commented Aug 23, 2024

Seems like this is an error with the nested message type's string member. As it fails in ucdr_deserialize_sequence_header, the length of the string member is greater than the capacity in rosidl_runtime_c__String, which is always 0.

Since there's no issue with UDP comms, this could be due to an error in generating the string type from the agent side.

@hr-ti hr-ti changed the title Deserializing error for nested message types Deserializing error for string types Aug 23, 2024
@hr-ti hr-ti changed the title Deserializing error for string types Deserializing error for string type Aug 23, 2024
@hr-ti
Copy link
Author

hr-ti commented Aug 26, 2024

This actually applies to any sequence type, like a byte array. Since capacity is always 0, any populated sequence simply just fails

@gavanderhoorn
Copy link

gavanderhoorn commented Aug 27, 2024

Edit: apologies, confused capacity with size.

re: capacity: how do you initialise your message/service structs? Are you using the appropriate _init(..)/_fini(..) pairs or are you using micro_ros_utilities?

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

2 participants