Skip to content

expose native participant#145

Merged
dirk-thomas merged 2 commits intomasterfrom
expose_native_participant
Aug 21, 2017
Merged

expose native participant#145
dirk-thomas merged 2 commits intomasterfrom
expose_native_participant

Conversation

@dirk-thomas
Copy link
Copy Markdown
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
Copy Markdown
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 dirk-thomas force-pushed the expose_native_participant branch from 3965d67 to c3c533f Compare August 20, 2017 20:18
@dirk-thomas dirk-thomas force-pushed the expose_native_participant branch from c3c533f to c452522 Compare August 20, 2017 21:11
@dirk-thomas
Copy link
Copy Markdown
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