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

Windows support #58

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [pull_request]

jobs:
build_and_test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: ros-tooling/[email protected]
Expand Down
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ target_link_libraries(${PROJECT_NAME}_lib "${cpp_typesupport_target}")

set_target_properties(${PROJECT_NAME}_lib PROPERTIES OUTPUT_NAME ${PROJECT_NAME})

# Causes the visibility macros to use dllexport rather than dllimport,
# which is appropriate when building the dll but not consuming it.
target_compile_definitions(${PROJECT_NAME}_lib
PRIVATE "DOMAIN_BRIDGE_BUILDING_LIBRARY"
)

add_executable(${PROJECT_NAME}_exec
src/domain_bridge.cpp
)
Expand Down
4 changes: 4 additions & 0 deletions include/domain_bridge/service_bridge_impl.inc
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ namespace detail
// service_name, from_domain_id, to_domain_id
using ServiceBridge = std::tuple<std::string, size_t, size_t>;

DOMAIN_BRIDGE_PUBLIC
bool
is_bridging_service(
const DomainBridgeImpl & impl, const ServiceBridge & service_bridge);

DOMAIN_BRIDGE_PUBLIC
void
add_service_bridge(
DomainBridgeImpl & impl,
Expand All @@ -49,9 +51,11 @@ add_service_bridge(
std::function<std::shared_ptr<rclcpp::ServiceBase>()> create_service,
std::shared_ptr<rclcpp::ClientBase> client);

DOMAIN_BRIDGE_PUBLIC
rclcpp::Node::SharedPtr
get_node_for_domain(DomainBridgeImpl & impl, std::size_t domain_id);

DOMAIN_BRIDGE_PUBLIC
const std::string &
get_node_name(const DomainBridgeImpl & impl);
} // namespace detail
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<depend>rcutils</depend>
<depend>rosbag2_cpp</depend>
<depend>rosidl_typesupport_cpp</depend>
<depend>yaml-cpp</depend>
<depend>yaml_cpp_vendor</depend>
<depend>zstd_vendor</depend>

<exec_depend>rosidl_default_runtime</exec_depend>
Expand Down
17 changes: 14 additions & 3 deletions src/domain_bridge/parse_domain_bridge_yaml_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <yaml-cpp/yaml.h>
#ifdef _WIN32
// TODO(jacobperron): Remove after https://github.com/ros2/yaml_cpp_vendor/issues/10 is resolved
#define YAML_CPP_DLL
// TODO(jacobperron): Silence warnings until they are resolved upstream
#pragma warning(push)
#pragma warning(disable: 4251)
#pragma warning(disable: 4275)
#include "yaml-cpp/yaml.h"
#pragma warning(pop)
#else
#include "yaml-cpp/yaml.h"
#endif

// cpplint thinks this is a C system header
#include <filesystem>
Expand Down Expand Up @@ -173,7 +184,7 @@ update_domain_bridge_config_from_yaml(
throw YamlParsingError(file_path, "file does not exist");
}

YAML::Node config = YAML::LoadFile(file_path);
YAML::Node config = YAML::LoadFile(file_path.string());

if (config["name"]) {
domain_bridge_config.options.name(config["name"].as<std::string>());
Expand Down Expand Up @@ -248,7 +259,7 @@ update_domain_bridge_config_from_yaml(
if (topic_info["remap"]) {
options.remap_name(topic_info["remap"].as<std::string>());
}
options.qos_options(parse_qos_options(topic_info, file_path));
options.qos_options(parse_qos_options(topic_info, file_path.string()));

if (topic_info["bidirectional"]) {
options.bidirectional(topic_info["bidirectional"].as<bool>());
Expand Down
2 changes: 1 addition & 1 deletion test/domain_bridge/test_domain_bridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST_F(TestDomainBridge, construction_destruction)
}
// With options
{
domain_bridge::DomainBridge bridge(domain_bridge::DomainBridgeOptions());
domain_bridge::DomainBridge bridge{domain_bridge::DomainBridgeOptions()};
}
}

Expand Down
4 changes: 2 additions & 2 deletions test/domain_bridge/wait_for_publisher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ inline bool wait_for_publisher(
node->wait_for_graph_change(graph_event, sleep_period);
time_slept = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - start);
} while (!predicate() &&
time_slept < std::chrono::duration_cast<std::chrono::microseconds>(timeout));
} while (
!predicate() && time_slept < std::chrono::duration_cast<std::chrono::microseconds>(timeout));

return predicate();
}
Expand Down