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 Foxy support #60

Open
wants to merge 28 commits into
base: foxy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
0c05dab
Add Foxy support
aprotyas Oct 28, 2021
cce4273
Update CI to target Foxy
jacobperron Oct 28, 2021
9f3b66a
Use explicit `rclcpp::Duration(int64_t ns)` ctor
aprotyas Oct 28, 2021
925a5e1
Obtain domain ID from `rcl_node_options_t`
aprotyas Oct 29, 2021
699ab3a
Use `rmw` types for QoS options class
aprotyas Oct 29, 2021
1562d57
Define a `rmw_time_t` to `rclcpp::Duration` func
aprotyas Oct 29, 2021
cfb36cf
Remove unused function
aprotyas Oct 29, 2021
e614643
Update distribution references in documentation
aprotyas Oct 29, 2021
3272a48
Set domain ID through the `rcl` layer
aprotyas Oct 30, 2021
baa184d
Explicitly find `rmw` package in CMake
aprotyas Oct 30, 2021
549654a
Move utility functions to library headers
aprotyas Oct 30, 2021
eb58092
Use utility func to set node domain ID in tests
aprotyas Oct 30, 2021
ffd9bc3
Linter fixes in the utility functions
aprotyas Oct 30, 2021
b619145
Add utility function to get domain ID from node
aprotyas Oct 30, 2021
80418ac
Use updated util signatures
aprotyas Oct 30, 2021
6e262b8
Get tests to compile
aprotyas Oct 30, 2021
2a0c60d
Uncrustify fix in tests
aprotyas Oct 30, 2021
efa97ae
Use `rcl_init_options_[set/get]_domain_id` in util
aprotyas Nov 4, 2021
0153bf2
Ensure sources are compiling with new utility
aprotyas Nov 4, 2021
e29b864
Fix getting domain ID process
aprotyas May 31, 2022
6460754
Ensure correct callback is being triggered
aprotyas May 31, 2022
ff41c31
Pass rcl_serialized_msg pointer properly
aprotyas May 31, 2022
d5c0c78
Add docblocks for util functions
aprotyas Jun 1, 2022
2df3969
Change to ASSERT_EQ and improve test readability
aprotyas Jun 1, 2022
4bf6b8d
Instill const-correctness in util code
aprotyas Jun 1, 2022
b93f9e0
Convert shared_ptr<T> to T::SharedPtr
aprotyas Jun 1, 2022
a91fbbd
Add from_rmw_time function reference
aprotyas Jun 1, 2022
4af13e7
Remove unnecessary ostream op overload
aprotyas Jun 1, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
- uses: ros-tooling/[email protected]
with:
install-connext: true
required-ros-distributions: galactic
required-ros-distributions: foxy
- uses: ros-tooling/[email protected]
with:
package-name: domain_bridge
target-ros2-distro: galactic
target-ros2-distro: foxy
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake REQUIRED)
find_package(rcl REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rcutils REQUIRED)
# Leverage rosbag2's generic type support utilities
find_package(rosbag2_cpp REQUIRED)
find_package(rosidl_typesupport_cpp REQUIRED)
find_package(rosidl_default_generators REQUIRED)
find_package(rmw REQUIRED)
find_package(yaml_cpp_vendor REQUIRED)
find_package(zstd_vendor REQUIRED)
find_package(zstd REQUIRED)
Expand All @@ -34,10 +36,13 @@ add_library(${PROJECT_NAME}_lib SHARED
src/${PROJECT_NAME}/compress_messages.cpp
src/${PROJECT_NAME}/domain_bridge.cpp
src/${PROJECT_NAME}/domain_bridge_options.cpp
src/${PROJECT_NAME}/generic_publisher.cpp
src/${PROJECT_NAME}/generic_subscription.cpp
src/${PROJECT_NAME}/parse_domain_bridge_yaml_config.cpp
src/${PROJECT_NAME}/qos_options.cpp
src/${PROJECT_NAME}/service_bridge_options.cpp
src/${PROJECT_NAME}/topic_bridge_options.cpp
src/${PROJECT_NAME}/utils.cpp
)

target_include_directories(${PROJECT_NAME}_lib PUBLIC
Expand All @@ -50,10 +55,12 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()

ament_target_dependencies(${PROJECT_NAME}_lib
rcl
rclcpp
rcutils
rosbag2_cpp
rosidl_typesupport_cpp
rmw
yaml_cpp_vendor
zstd
)
Expand Down Expand Up @@ -122,9 +129,11 @@ install(DIRECTORY examples launch

ament_export_targets(export_${PROJECT_NAME})
ament_export_dependencies(
rcl
rclcpp
rosbag2_cpp
rcutils
rosbag2_cpp
rmw
yaml_cpp_vendor
zstd_vendor
zstd
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ See the [design document](doc/design.md) for more details about how the bridge w

## Prerequisites

- [ROS 2](https://index.ros.org/doc/ros2/Installation) (Galactic or newer)
- [ROS 2](https://index.ros.org/doc/ros2/Installation) (Foxy or newer)

## Installation

Expand Down
22 changes: 11 additions & 11 deletions include/domain_bridge/qos_options.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <optional>

#include "rclcpp/qos.hpp"
#include "rmw/types.h"

#include "domain_bridge/visibility_control.hpp"

Expand All @@ -34,7 +34,7 @@ class QosOptions
*
* - reliability = nullopt_t (detect automatically)
* - durability = nullopt_t (detect automatically)
* - history = rclcpp::HistoryPolicy::KeepLast
* - history = RMW_QOS_POLICY_HISTORY_KEEP_LAST
* - depth = 10
* - deadline = 0 (RMW default)
* - lifespan = 0 (RMW default)
Expand All @@ -44,33 +44,33 @@ class QosOptions

/// Get reliability.
DOMAIN_BRIDGE_PUBLIC
std::optional<rclcpp::ReliabilityPolicy>
std::optional<rmw_qos_reliability_policy_t>
reliability() const;

/// Set reliability.
DOMAIN_BRIDGE_PUBLIC
QosOptions &
reliability(const rclcpp::ReliabilityPolicy & reliability);
reliability(rmw_qos_reliability_policy_t reliability);

/// Get durability.
DOMAIN_BRIDGE_PUBLIC
std::optional<rclcpp::DurabilityPolicy>
std::optional<rmw_qos_durability_policy_t>
durability() const;

/// Set durability.
DOMAIN_BRIDGE_PUBLIC
QosOptions &
durability(const rclcpp::DurabilityPolicy & durability);
durability(rmw_qos_durability_policy_t durability);

/// Get history.
DOMAIN_BRIDGE_PUBLIC
rclcpp::HistoryPolicy
rmw_qos_history_policy_t
history() const;

/// Set history.
DOMAIN_BRIDGE_PUBLIC
QosOptions &
history(const rclcpp::HistoryPolicy & history);
history(rmw_qos_history_policy_t history);

/// Get history depth.
DOMAIN_BRIDGE_PUBLIC
Expand Down Expand Up @@ -129,9 +129,9 @@ class QosOptions
lifespan_auto();

private:
std::optional<rclcpp::ReliabilityPolicy> reliability_;
std::optional<rclcpp::DurabilityPolicy> durability_;
rclcpp::HistoryPolicy history_{rclcpp::HistoryPolicy::KeepLast};
std::optional<rmw_qos_reliability_policy_t> reliability_;
std::optional<rmw_qos_durability_policy_t> durability_;
rmw_qos_history_policy_t history_{RMW_QOS_POLICY_HISTORY_KEEP_LAST};
std::size_t depth_{10};
std::optional<std::int64_t> deadline_{0};
std::optional<std::int64_t> lifespan_{0};
Expand Down
52 changes: 52 additions & 0 deletions include/domain_bridge/utils.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright 2021, 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 DOMAIN_BRIDGE__UTILS_HPP_
#define DOMAIN_BRIDGE__UTILS_HPP_

#include <string>
#include <memory>

#include "rclcpp/duration.hpp"
#include "rclcpp/node.hpp"
#include "rmw/types.h"

#include "domain_bridge/visibility_control.hpp"

namespace domain_bridge
{

namespace utils
{

DOMAIN_BRIDGE_PUBLIC
rclcpp::Duration from_rmw_time(rmw_time_t duration);

DOMAIN_BRIDGE_PUBLIC
rclcpp::Node::SharedPtr
create_node(
const std::string & name,
std::size_t domain_id,
std::shared_ptr<rclcpp::Context> context = nullptr);

DOMAIN_BRIDGE_PUBLIC
std::size_t
get_domain_id_from_node(
rclcpp::Node & node);

} // namespace utils

} // namespace domain_bridge

#endif // DOMAIN_BRIDGE__UTILS_HPP_
5 changes: 4 additions & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>rosidl_default_generators</buildtool_depend>

<build_depend>rcl</build_depend>
<build_depend>rmw</build_depend>

<depend>rclcpp</depend>
<depend>rcutils</depend>
<depend>rosbag2_cpp</depend>
Expand All @@ -30,7 +33,7 @@
<test_depend>test_msgs</test_depend>

<!-- Ensure the following Tier 1 RMW implementations are available for testing -->
<test_depend>rmw_connextdds</test_depend>
<test_depend>rmw_connext_cpp</test_depend>
<test_depend>rmw_cyclonedds_cpp</test_depend>
<test_depend>rmw_fastrtps_cpp</test_depend>

Expand Down
Loading