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 rosidl_generator_cpp templates for actions #312

Merged
merged 23 commits into from
Nov 13, 2018

Conversation

apojomovsky
Copy link
Contributor

@apojomovsky apojomovsky commented Nov 2, 2018

Addresses parts of #303
Built on top of sloretz/speficication-to-str which is in turn based on sservulo/305-parse_action_file
This PR:

  • Defines the action__struct.hpp.em and action.hpp.em in the rosidl_generator_cpp's resource directory.
  • Defines the action__struct.h.em and action.h.em in the rosidl_generator_c's resource directory.
  • Extends the rosidl_generator_cpp and rosidl_generator_c logic to process .action files.
  • Adds and ActionSpecification class to the rosidl_parser.

EDIT:
It wasn't possible to add a test_action_initialization test because of an implicit dependency to builtin_interfaces package in the generated c++ code which ended up in a circular dependency with the package.

Since this can't be tested in the generation pipeline yet, I've extended some of my notes in this gist with some instructions on how to run the generator by hand against an example package.

connects to ros2/rcl_interfaces#48

@apojomovsky apojomovsky requested review from sloretz and hidmic November 2, 2018 15:16
@tfoote tfoote added the in progress Actively being worked on (Kanban column) label Nov 2, 2018
@sloretz sloretz changed the base branch from master to sloretz/speficication-to-str November 2, 2018 16:40
@sloretz sloretz changed the base branch from sloretz/speficication-to-str to master November 2, 2018 16:49
@apojomovsky apojomovsky force-pushed the apojomovsky/cpp_typesupport_for_actions branch 2 times, most recently from db03640 to 819c976 Compare November 7, 2018 20:45
@hidmic hidmic force-pushed the apojomovsky/cpp_typesupport_for_actions branch from 819c976 to c7352db Compare November 10, 2018 01:32
Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM but for a few nits plus pending CI.

#include <action_msgs/msg/goal_status_array.hpp>
#include <@(spec.pkg_name)/action/@(get_header_filename_from_msg_name(spec.action_name))__feedback.hpp>
#include <@(spec.pkg_name)/action/@(get_header_filename_from_msg_name(spec.action_name))__goal.hpp>
#include <@(spec.pkg_name)/action/@(get_header_filename_from_msg_name(spec.action_name))__result.hpp>
Copy link
Contributor

Choose a reason for hiding this comment

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

@apojomovsky I think we should be consistent with rosidl_generator_c equivalent template: either we hard-code action or we pass in @(subfolder).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, done!


using Goal = GoalRequestService::Request;
using Result = GoalResultService::Response;
using Feedback = @(spec.pkg_name)::action::@(spec.action_name)_Feedback;
Copy link
Contributor

Choose a reason for hiding this comment

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

@apojomovsky same thing about action vs. @(subfolder).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done, thanks!

@apojomovsky
Copy link
Contributor Author

CI with ros2/rosidl_typesupport#36, ros2/rosidl#312 and ros2/rcl_interfaces#48

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

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

Guys, I found a few more things here and there while digging.

add_dependencies(
${rosidl_generate_interfaces_TARGET}
${rosidl_generate_interfaces_TARGET}${_target_suffix}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@apojomovsky @sloretz I don't entirely follow why we check for ${rosidl_generate_action_interfaces_TARGET} but use ${rosidl_generate_interfaces_TARGET}.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy/paste error

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in 2ed5832

add_dependencies(
${rosidl_generate_interfaces_TARGET}
${rosidl_generate_interfaces_TARGET}${_target_suffix}
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@apojomovsky @sloretz same as above.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed in 2ed5832

"${rosidl_generator_c_TEMPLATE_DIR}/rosidl_generator_c__action_visibility_control.h.in"
"${_visibility_control_file}"
@ONLY
)
Copy link
Contributor

Choose a reason for hiding this comment

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

@apojomovsky @sloretz seems we're not installing the generated _visibility_control_file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Installed visibility file in db68926

Copy link
Contributor

@hidmic hidmic left a comment

Choose a reason for hiding this comment

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

LGTM!

@apojomovsky
Copy link
Contributor Author

As just mentioned here, the latest changes from @sloretz in ros2/rosidl_typesupport#36 in conjunction with the ones here enabled us to successfully build/run the rcl_action tests from @hidmic 's branch.

@sloretz sloretz merged commit 075fe35 into master Nov 13, 2018
@sloretz sloretz deleted the apojomovsky/cpp_typesupport_for_actions branch November 13, 2018 18:51
@sloretz sloretz removed the in progress Actively being worked on (Kanban column) label Nov 13, 2018
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

Successfully merging this pull request may close these issues.

5 participants