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

Switch to one Participant per Context #312

Merged
merged 37 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
5486297
Create one Participant per Context instead of one per Node
ivanpauno Sep 3, 2019
826d388
Fix error, use mangled topic name
ivanpauno Feb 4, 2020
76123ef
Address peer review comments
ivanpauno Feb 5, 2020
4e9c9f0
Rename register_node.*
ivanpauno Feb 5, 2020
be9d13f
Updates after renaming register_node.*
ivanpauno Feb 5, 2020
0659c31
Update rmw_fastrtps_dynamic_cpp/src/rmw_init.cpp to match rmw_fastrtp…
ivanpauno Feb 5, 2020
df0f6ca
Get rid of fprintf usage
ivanpauno Feb 5, 2020
554f2a4
Moved listener_thread.* to rmw_fastrpts_shared_cpp
ivanpauno Feb 5, 2020
162bd6c
Get rid of some duplicated code in rmw_init.*
ivanpauno Feb 5, 2020
fecf35b
Get rid of some duplicated code in init_rmw_context_impl.*
ivanpauno Feb 5, 2020
87ff449
Use new (std::nothrow)
ivanpauno Feb 5, 2020
bfbcef3
Correct bug in rmw_fastrtps_dynamic_cpp
ivanpauno Feb 5, 2020
39da7e3
Improve style
ivanpauno Feb 6, 2020
406e146
Make ros_discovery_info topic not accessible to ros users
ivanpauno Feb 6, 2020
5147650
Add note explaining why we can't depend on rosidl_typesupport_cpp
ivanpauno Feb 6, 2020
f9e9a02
Deleted old TODOs
ivanpauno Feb 6, 2020
a366b7a
Check return value of GraphCache::remove_participant
ivanpauno Feb 6, 2020
9c49ceb
Return eprosima::fastrtps::string_255 instead of std::string in _mang…
ivanpauno Feb 6, 2020
d454385
Communicate context name and namespace to remote participants
ivanpauno Feb 10, 2020
6739de9
Trigger graph condition in any graph change
ivanpauno Feb 11, 2020
2eab379
Address peer review comments
ivanpauno Feb 28, 2020
16a3d24
Revert "Improve style"
ivanpauno Feb 28, 2020
64da434
Address peer review comments
ivanpauno Feb 28, 2020
a0e29db
Update after rebasing
ivanpauno Feb 28, 2020
aad980a
Restore get_security_file_paths
ivanpauno Feb 28, 2020
5499f07
Latest update after discussion about supporting sros2
ivanpauno Mar 12, 2020
100a47f
Delete unused function
ivanpauno Mar 13, 2020
7fce106
Naming: replace context_name with security_context
ivanpauno Mar 17, 2020
e74a5e0
Don't terminate everything when an error happens in the ros discovery…
ivanpauno Mar 17, 2020
f10cc19
Update error
ivanpauno Mar 20, 2020
a94234c
Fix linker failures on Windows
ivanpauno Mar 24, 2020
f043aaa
Address peer review comments
ivanpauno Mar 26, 2020
fa959e1
Fix bug
ivanpauno Mar 26, 2020
0bf8112
Use static_cast instead of reinterpret_cast
ivanpauno Mar 27, 2020
0fa080e
Remove unused variable
ivanpauno Mar 30, 2020
47abe69
Fix UB
ivanpauno Mar 30, 2020
8b6f556
Only link about the typesupport we need
ivanpauno Apr 1, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions rmw_fastrtps_cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ endif()
find_package(ament_cmake_ros REQUIRED)

find_package(rcutils REQUIRED)
find_package(rmw_dds_common REQUIRED)
find_package(rmw_fastrtps_shared_cpp REQUIRED)

find_package(fastrtps_cmake_module REQUIRED)
Expand All @@ -53,6 +54,8 @@ add_library(rmw_fastrtps_cpp
src/get_service.cpp
src/get_subscriber.cpp
src/identifier.cpp
src/init_rmw_context_impl.cpp
src/publisher.cpp
src/rmw_logging.cpp
src/rmw_client.cpp
src/rmw_compare_gids_equal.cpp
Expand Down Expand Up @@ -82,7 +85,11 @@ add_library(rmw_fastrtps_cpp
src/rmw_wait.cpp
src/rmw_wait_set.cpp
src/serialization_format.cpp
src/subscription.cpp
src/type_support_common.cpp
src/gid__type_support.cpp
src/node_entities_info__type_support.cpp
src/participant_entities_info__type_support.cpp
)
target_link_libraries(rmw_fastrtps_cpp
fastcdr fastrtps)
Expand All @@ -92,11 +99,16 @@ ament_target_dependencies(rmw_fastrtps_cpp
"rcutils"
"rosidl_typesupport_fastrtps_c"
"rosidl_typesupport_fastrtps_cpp"
"rmw_dds_common"
"rmw_fastrtps_shared_cpp"
"rmw"
"rosidl_generator_c"
)

target_link_libraries(rmw_fastrtps_cpp
${rmw_dds_common_LIBRARIES__rosidl_typesupport_fastrtps_cpp}
)

configure_rmw_library(rmw_fastrtps_cpp)

# Causes the visibility macros to use dllexport rather than dllimport,
Expand All @@ -122,6 +134,11 @@ register_rmw_implementation(
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()

ament_add_gtest(test_gid_message test/test_gid_message.cpp)
if(TARGET test_gid_message)
target_link_libraries(test_gid_message ${PROJECT_NAME})
endif()
endif()

ament_package(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright 2020 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__INIT_RMW_CONTEXT_IMPL_HPP_
#define RMW_FASTRTPS_CPP__INIT_RMW_CONTEXT_IMPL_HPP_

#include "rmw/init.h"
#include "rmw/types.h"

namespace rmw_fastrtps_cpp
{

/// Increment `rmw_context_impl_t` reference count, initializing it if necessary.
/**
* Should be called when creating a node, and before using `context->impl`.
*/
rmw_ret_t
increment_context_impl_ref_count(rmw_context_t * context);

} // namespace rmw_fastrtps_cpp

#endif // RMW_FASTRTPS_CPP__INIT_RMW_CONTEXT_IMPL_HPP_
36 changes: 36 additions & 0 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/publisher.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2017-2019 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__PUBLISHER_HPP_
#define RMW_FASTRTPS_CPP__PUBLISHER_HPP_

#include "rmw/rmw.h"
#include "rmw_fastrtps_shared_cpp/custom_participant_info.hpp"

namespace rmw_fastrtps_cpp
{

rmw_publisher_t *
create_publisher(
const CustomParticipantInfo * participant_info,
const rosidl_message_type_support_t * type_supports,
const char * topic_name,
const rmw_qos_profile_t * qos_policies,
const rmw_publisher_options_t * publisher_options,
bool keyed,
bool create_publisher_listener);

} // namespace rmw_fastrtps_cpp

#endif // RMW_FASTRTPS_CPP__PUBLISHER_HPP_
38 changes: 38 additions & 0 deletions rmw_fastrtps_cpp/include/rmw_fastrtps_cpp/subscription.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2019 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef RMW_FASTRTPS_CPP__SUBSCRIPTION_HPP_
#define RMW_FASTRTPS_CPP__SUBSCRIPTION_HPP_

#include "rmw/rmw.h"
#include "rmw/subscription_options.h"

#include "rmw_fastrtps_shared_cpp/custom_participant_info.hpp"

namespace rmw_fastrtps_cpp
{

rmw_subscription_t *
create_subscription(
const CustomParticipantInfo * participant_info,
const rosidl_message_type_support_t * type_supports,
const char * topic_name,
const rmw_qos_profile_t * qos_policies,
const rmw_subscription_options_t * subscription_options,
bool keyed,
bool create_subscription_listener);

} // namespace rmw_fastrtps_cpp

#endif // RMW_FASTRTPS_CPP__SUBSCRIPTION_HPP_
2 changes: 2 additions & 0 deletions rmw_fastrtps_cpp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<build_depend>fastrtps_cmake_module</build_depend>
<build_depend>rcutils</build_depend>
<build_depend>rmw</build_depend>
<build_depend>rmw_dds_common</build_depend>
<build_depend>rmw_fastrtps_shared_cpp</build_depend>
<build_depend>rosidl_generator_c</build_depend>
<build_depend>rosidl_generator_cpp</build_depend>
Expand All @@ -30,6 +31,7 @@
<build_export_depend>fastrtps</build_export_depend>
<build_export_depend>fastrtps_cmake_module</build_export_depend>
<build_export_depend>rcutils</build_export_depend>
<build_export_depend>rmw_dds_common</build_export_depend>
<build_export_depend>rmw_fastrtps_shared_cpp</build_export_depend>
<build_export_depend>rmw</build_export_depend>
<build_export_depend>rosidl_generator_c</build_export_depend>
Expand Down
4 changes: 3 additions & 1 deletion rmw_fastrtps_cpp/src/get_participant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include "rmw_fastrtps_cpp/get_participant.hpp"

#include "rmw_fastrtps_shared_cpp/custom_participant_info.hpp"
#include "rmw_fastrtps_shared_cpp/rmw_context_impl.hpp"

#include "rmw_fastrtps_cpp/identifier.hpp"

namespace rmw_fastrtps_cpp
Expand All @@ -29,7 +31,7 @@ get_participant(rmw_node_t * node)
if (node->implementation_identifier != eprosima_fastrtps_identifier) {
return nullptr;
}
auto impl = static_cast<CustomParticipantInfo *>(node->data);
auto impl = static_cast<CustomParticipantInfo *>(node->context->impl->participant_info);
return impl->participant;
}

Expand Down
56 changes: 56 additions & 0 deletions rmw_fastrtps_cpp/src/gid__type_support.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright 2019 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <cstddef>

#include "rosidl_generator_c/message_type_support_struct.h"
// rosidl_typesupport_cpp/message_type_support.hpp is installed by rosidl_generator_cpp
#include "rosidl_typesupport_cpp/message_type_support.hpp"
#include "rmw_dds_common/msg/gid__struct.hpp"
#include "rmw_dds_common/msg/gid__rosidl_typesupport_fastrtps_cpp.hpp"
#include "rmw_fastrtps_cpp/visibility_control.h"

// This file is needed and can't be generated by `rosidl_typesupport_cpp`,
// because adding a dependency to that package generates a cyclic dependency
// (`rosidl_typesupport_cpp` exports a dependency on `rmw_implementation`).

namespace rosidl_typesupport_cpp
{

template<>
RMW_FASTRTPS_CPP_PUBLIC
const rosidl_message_type_support_t *
get_message_type_support_handle<rmw_dds_common::msg::Gid>()
{
return ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
rosidl_typesupport_fastrtps_cpp, rmw_dds_common, msg, Gid)();
}

#ifdef __cplusplus
extern "C"
{
#endif

RMW_FASTRTPS_CPP_PUBLIC
const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(
rosidl_typesupport_cpp, rmw_dds_common, msg, Gid)()
ivanpauno marked this conversation as resolved.
Show resolved Hide resolved
{
return get_message_type_support_handle<rmw_dds_common::msg::Gid>();
}

#ifdef __cplusplus
}
#endif
} // namespace rosidl_typesupport_cpp
Loading