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

expose native participant #145

Merged
merged 2 commits into from
Aug 21, 2017
Merged

expose native participant #145

merged 2 commits into from
Aug 21, 2017

Conversation

dirk-thomas
Copy link
Member

This is an example how to expose native handles from a rmw implementation. It only exposes the eprosima::fastrtps::Participant but other handles could be supported in a similar fashion. The patch demonstrate how this is possible and that it can be achieved by each rmw implementation without requiring any changes in the rmw interface.

When the function is being used with a different rmw implementation at runtime get_participant returns NULL.

In order to try this feature I modified the talker in the demo_nodes_cpp package. The changes are straight forward. Only getting from the C++ Node to the rmw_node_t is not "very pretty":

  • package.xml
<depend>rmw_fastrtps_cpp</depend>
  • CMakeLists.txt
find_package(rmw_fastrtps_cpp REQUIRED)
...
ament_target_dependencies(talker "rmw_fastrtps_cpp")
  • talker.cpp
#include "rmw_fastrtps_cpp/internal/get_participant.hpp"
...
// auto node = rclcpp::node::Node::make_shared("talker");
...
rcl_node_t * rcl_node = node->get_node_base_interface()->get_rcl_node_handle();
rmw_node_t * rmw_node = rcl_node_get_rmw_handle(rcl_node);
eprosima::fastrtps::Participant * p = rmw_fastrtps_cpp::get_participant(rmw_node);

@dirk-thomas dirk-thomas added the in review Waiting for review (Kanban column) label Aug 18, 2017
@dirk-thomas dirk-thomas self-assigned this Aug 18, 2017
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

+1, makes sense to me.

I always imagined the API added here would be in a separate package, but I can't think of a reason it needs to be at this point.

@dirk-thomas
Copy link
Member Author

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

@dirk-thomas dirk-thomas merged commit 3742a11 into master Aug 21, 2017
@dirk-thomas dirk-thomas deleted the expose_native_participant branch August 21, 2017 15:48
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label Aug 21, 2017
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.

2 participants