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

Remove template specialization for toMsg functions #179

Merged
merged 7 commits into from
Oct 19, 2019
Merged

Conversation

jacobperron
Copy link
Member

Resolves #176

Before, the compiler was preferring the overloaded function:

inline
geometry_msgs::msg::Transform toMsg(const tf2::Transform& in)

instead of the template specialization. I tried to change the overload into a template specialization, but then we run into the error that the compile can't deduce the second template parameter (ie. the return type).

I'm not sure if this is an ideal fix, or if instead we should go with template specialization (I'm not sure how we were/are benefiting from this), which requires the user to be explicit:

auto msg = tf2::toMsg<tf2::Stamped<tf2::Transform>, geometry_msgs::msg::TransformStamped>(tf_stamped);

I've also went ahead and made the change for stamped quaternions, which have the same bug.

@jacobperron jacobperron added the in review Waiting for review (Kanban column) label Oct 10, 2019
@jacobperron
Copy link
Member Author

Testing packages that depend on tf2_geometry_msgs:

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

Copy link
Contributor

@sloretz sloretz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with a recommendation to remove the templated declarations of toMsg() and fromMsg() in tf2/convert.h since they're no longer being used here.

I'm not sure if this can be backported. If a compiler chooses to ignore inline, I think the mangled name on the functions is changed when these become overloads instead of specializations.

@jacobperron
Copy link
Member Author

@tfoote Before I merge this, maybe you can shed some light on if template specialization is required or if switching to overloads is fine.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
This fixes #176 as demonstrated by the unit test compiling.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Similar to stamped transforms, this resolves a compilation issue when using the function.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@jacobperron
Copy link
Member Author

@sloretz I think you're right that this is not eligible for backport, but users can still workaround the issue by explicitly providing template arguments.

I've rebased to get the latest changes and I've removed the last occurrence of the template specialization for fromMsg in tf2_geometry_msgs (499afbd). I've also updated the tests to use tf2::convert now that it is available (143e90d). PTAL

@jacobperron
Copy link
Member Author

recommendation to remove the templated declarations of toMsg() and fromMsg() in tf2/convert.h since they're no longer being used here.

Since the templated declarations may be used elsewhere (outside of this repo), it might be better to leave them for now.

@jacobperron
Copy link
Member Author

Rerunning after the rebase:

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

@jacobperron jacobperron merged commit 881362f into ros2 Oct 19, 2019
@delete-merged-branch delete-merged-branch bot deleted the jacob/fix_176 branch October 19, 2019 02:43
@nuclearsandwich
Copy link
Member

@jacobperron removed this from backport consideration since it is not ABI compatible.

jacobperron added a commit to ros-visualization/visualization_tutorials that referenced this pull request Dec 9, 2019
Since ros2/geometry2#179, there are no longer compilation issues.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
ruffsl added a commit to CogRob/omnimapper_ros that referenced this pull request Feb 15, 2020
jacobperron added a commit to ros-visualization/visualization_tutorials that referenced this pull request Mar 9, 2020
Since ros2/geometry2#179, there are no longer compilation issues.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tf2_geometry_msgs geometry_msgs to TF2 StampedTransform
3 participants