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

[rosidl_typesupport_introspection_c] Fix get_function and get_const_function semantics for arrays #531

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

ivanpauno
Copy link
Member

@ivanpauno ivanpauno commented Sep 24, 2020

Fixes #522.
For all arrays/sequences/bounded_sequences in rosidl_typesupport_introspection_c/cpp, the following code works:

member->get_function(ros_message + member->offset_, index)

except for rosidl_typesupport_introspection_c arrays, where the correct code is:

member->get_function(&(ros_message + member->offset_), index)

This PR fixes the semantic difference.

The following PRs must be merged simultaneously:

This error wasn't detected before, because both rmw_fastrtps_dynamic_cpp and rmw_cyclonedds_cpp were doing "weird stuff" instead of using the "get function" and "resize function" provided by the introspection typesupport.
For further reference, see:

Signed-off-by: Ivan Santiago Paunovic <ivanpauno@ekumenlabs.com>
@dirk-thomas
Copy link
Member

The following PRs must be merged simultaneously:

How about Connext? If it doesn't need the change is its current behavior broken?

This error wasn't detected before, because both rmw_fastrtps_dynamic_cpp and rmw_cyclonedds_cpp were doing "weird stuff" instead of using the "get function" and "resize function" provided by the introspection typesupport.

Both were using the provided function. And the "weird stuff" was simply accounting the difference in the API - to exactly pass what was needed.

Certainly unifying the signature makes sense.

@dirk-thomas
Copy link
Member

The following PRs must be merged simultaneously:

These changes will also need to be released into Rolling.

@ivanpauno
Copy link
Member Author

How about Connext? If it doesn't need the change is its current behavior broken?

rmw_connexy_dynamic_cpp is not supported, and the code was not handling the semantic difference correctly https://github.com/ros2/rmw_connext/blob/c0a12cd0c6b8a14191763417e2ee13bbd9624492/rmw_connext_dynamic_cpp/src/templates.hpp#L1271.

Both were using the provided function. And the "weird stuff" was simply accounting the difference in the API - to exactly pass what was needed.

They weren't using those functions, that was fixed in ros2/rmw_cyclonedds#228, ros2/rmw_fastrtps#429. The code handling the introspection typesupport before those PRs is interesting.

These changes will also need to be released into Rolling.

👍

@dirk-thomas
Copy link
Member

rmw_connexy_dynamic_cpp is not supported, and the code was not handling the semantic difference correctly https://github.com/ros2/rmw_connext/blob/c0a12cd0c6b8a14191763417e2ee13bbd9624492/rmw_connext_dynamic_cpp/src/templates.hpp#L1271.

I would suggest to still update the code (since it is trivial to do now) and probably hard to figure out that it is needed in the future.

@ivanpauno
Copy link
Member Author

I would suggest to still update the code (since it is trivial to do now) and probably hard to figure out that it is needed in the future.

Yeah, what I mean is that rmw_connext_dynamic_cpp doesn't need a patch. That code was always using:

member->get_function(ros_message + member->offset_, index)

@dirk-thomas
Copy link
Member

Yeah, what I mean is that rmw_connext_dynamic_cpp doesn't need a patch. That code was always using:

Oh, got it now. Thanks for clarifying. So the behavior must have been broken in the past then. ✅

@ivanpauno
Copy link
Member Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@ivanpauno ivanpauno merged commit c047136 into master Sep 24, 2020
@delete-merged-branch delete-merged-branch bot deleted the ivanpauno/fix-array-get-function-semantics branch September 24, 2020 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[rosidl_typesupport_introspection_c] get item function for arrays is semantically broken
2 participants