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

Add is_message trait in support of tf2 conversions #412

Merged
merged 6 commits into from
Oct 15, 2019

Conversation

mjcarroll
Copy link
Member

Restores the IsMessage trait from ROS1 message_traits.

This will simply be a true value for things that are messages and false otherwise.

ROS1 Ref: https://github.com/ros/roscpp_core/blob/kinetic-devel/roscpp_traits/include/ros/message_traits.h#L111

Signed-off-by: Michael Carroll michael@openrobotics.org

@dirk-thomas
Copy link
Member

It would be good to add similar traits for services and actions.

@@ -0,0 +1,85 @@
@# Included from rosidl_generator_cpp/resource/idl__traits.hpp.em
Copy link
Member

Choose a reason for hiding this comment

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

Does the resource/idl__traits.hpp.em template need to be updated in order to include this new file?

Also the test doesn't cover actions yet which based on the above seems to be broken.

Copy link
Member Author

Choose a reason for hiding this comment

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

It does.

Also, because action generation depends on action_msgs, it's likely going to have to reside in a higher package. I discussed with @jacobperron, and I'm going to move forward with putting the trait tests in rclcpp_action, unless there is another alternative.

Copy link
Member

Choose a reason for hiding this comment

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

Why can the is_action trait not be tested in this package? The <action>__traits.hpp doesn't require any other includes.

Copy link
Member

@jacobperron jacobperron Oct 14, 2019

Choose a reason for hiding this comment

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

We can't build test action interfaces in rosidl_generator_cpp because of a circular dependency on action_msgs. Unless we can test is_action without generating an action, we'll have to wait until we remove the circular dependency to add tests to this package.

@mabelzhang mabelzhang added the enhancement New feature or request label Sep 26, 2019
Copy link
Member

@jacobperron jacobperron 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 green CI)

@@ -0,0 +1,85 @@
@# Included from rosidl_generator_cpp/resource/idl__traits.hpp.em
Copy link
Member

@jacobperron jacobperron Oct 14, 2019

Choose a reason for hiding this comment

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

We can't build test action interfaces in rosidl_generator_cpp because of a circular dependency on action_msgs. Unless we can test is_action without generating an action, we'll have to wait until we remove the circular dependency to add tests to this package.


TEST(Test_rosidl_generator_traits, is_message) {
// A message is not a service
ASSERT_TRUE(is_message<rosidl_generator_cpp::msg::Empty>());
Copy link
Member

Choose a reason for hiding this comment

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

nit: using EXPECT_* instead, we'd see multiple failures instead of just the first to fail.

Signed-off-by: Michael Carroll <michael@openrobotics.org>
Additionally add tests for message and service traits

Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
Signed-off-by: Michael Carroll <michael@openrobotics.org>
@mjcarroll mjcarroll merged commit fee36d9 into master Oct 15, 2019
@delete-merged-branch delete-merged-branch bot deleted the convert_with_traits branch October 15, 2019 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants