diff --git a/.bazelrc b/.bazelrc index b32dd3bb..c53f8050 100644 --- a/.bazelrc +++ b/.bazelrc @@ -32,7 +32,7 @@ build:clang --linkopt="-fuse-ld=lld" # CycloneDDS is used as DDS vendor in the ROS Middleware by default in this repo. # To use FastDDS, invoke Bazel with `--config=fastdds`. -build:fastdds --//ros2:dds_vendor=fastdds +build:fastdds --@com_github_mvukov_rules_ros2//ros2:dds_vendor=fastdds # Load any settings specific to the current user. # user.bazelrc should appear in .gitignore so that settings are not shared with diff --git a/README.md b/README.md index f6f0c5ab..175ed1d7 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Available features: - Defining ROS 2 deployments with `ros2_launch` Bazel macro. - Defining ROS 2 tests with `ros2_test` Bazel macro. - Defining ROS 2 plugins with `ros2_plugin` Bazel macro. -- Only CycloneDDS middleware can be used at the moment. +- CycloneDDS (default) and FastDDS middleware are supported. - Zero copy transport via shared memory backend ([iceoryx](https://github.com/eclipse-iceoryx/iceoryx)) for CycloneDDS. - Utilities: - [`foxglove_bridge`](https://github.com/foxglove/ros-foxglove-bridge) for visualization and debugging diff --git a/repositories/patches/rmw_fastrtps-fix-typesupport-conditions-bug.patch b/repositories/patches/rmw_fastrtps-fix-typesupport-conditions-bug.patch new file mode 100644 index 00000000..093d1d40 --- /dev/null +++ b/repositories/patches/rmw_fastrtps-fix-typesupport-conditions-bug.patch @@ -0,0 +1,21 @@ +diff --git a/rmw_fastrtps_dynamic_cpp/src/type_support_common.cpp b/rmw_fastrtps_dynamic_cpp/src/type_support_common.cpp +index d602069..62e4362 100644 +--- a/rmw_fastrtps_dynamic_cpp/src/type_support_common.cpp ++++ b/rmw_fastrtps_dynamic_cpp/src/type_support_common.cpp +@@ -25,12 +25,13 @@ + bool + using_introspection_c_typesupport(const char * typesupport_identifier) + { +- return typesupport_identifier == rosidl_typesupport_introspection_c__identifier; ++ return !std::string(typesupport_identifier) ++ .compare(rosidl_typesupport_introspection_c__identifier); + } + + bool + using_introspection_cpp_typesupport(const char * typesupport_identifier) + { +- return typesupport_identifier == +- rosidl_typesupport_introspection_cpp::typesupport_identifier; ++ return !std::string(typesupport_identifier) ++ .compare(rosidl_typesupport_introspection_cpp::typesupport_identifier); + } diff --git a/repositories/ros2_repositories_impl.bzl b/repositories/ros2_repositories_impl.bzl index b2365057..fe6e8f20 100644 --- a/repositories/ros2_repositories_impl.bzl +++ b/repositories/ros2_repositories_impl.bzl @@ -275,6 +275,8 @@ def ros2_repositories_impl(): http_archive, name = "ros2_rmw_fastrtps", build_file = "@com_github_mvukov_rules_ros2//repositories:rmw_fastrtps.BUILD.bazel", + patch_args = ["-p1"], + patches = ["@com_github_mvukov_rules_ros2//repositories/patches:rmw_fastrtps-fix-typesupport-conditions-bug.patch"], sha256 = "a0145b414207a2528fd56e98a56bd6d4c3f0353dcd58f4b3a65224af8bd52284", strip_prefix = "rmw_fastrtps-6.2.3", url = "https://github.com/ros2/rmw_fastrtps/archive/refs/tags/6.2.3.tar.gz", diff --git a/repositories/rosidl_typesupport_fastrtps.BUILD.bazel b/repositories/rosidl_typesupport_fastrtps.BUILD.bazel index 8dd8769e..fc58f712 100644 --- a/repositories/rosidl_typesupport_fastrtps.BUILD.bazel +++ b/repositories/rosidl_typesupport_fastrtps.BUILD.bazel @@ -41,71 +41,3 @@ ros2_cpp_library( "@ros2_rosidl//:rosidl_runtime_c", ], ) - -py_library( - name = "rosidl_typesupport_fastrtps_generator_c_lib", - srcs = ["rosidl_typesupport_fastrtps_c/rosidl_typesupport_fastrtps_c/__init__.py"], - imports = ["rosidl_typesupport_fastrtps_c"], - visibility = ["//visibility:public"], - deps = [ - "@ros2_rosidl//:rosidl_cmake", - "@ros2_rosidl//:rosidl_parser", - ], -) - -_ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_C_APP_PY = "rosidl_typesupport_fastrtps_generator_c_app.py" - -copy_file( - name = "rosidl_typesupport_fastrtps_generator_c_copy", - src = "rosidl_typesupport_fastrtps_c/bin/rosidl_typesupport_fastrtps_c", - out = _ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_C_APP_PY, -) - -py_binary( - name = "rosidl_typesupport_fastrtps_generator_c_app", - srcs = [_ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_C_APP_PY], - legacy_create_init = False, - main = _ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_C_APP_PY, - visibility = ["//visibility:public"], - deps = [":rosidl_typesupport_fastrtps_generator_c_lib"], -) - -filegroup( - name = "rosidl_typesupport_fastrtps_generator_c_templates", - srcs = glob(["rosidl_typesupport_fastrtps_c/resource/*.em"]), - visibility = ["//visibility:public"], -) - -py_library( - name = "rosidl_typesupport_fastrtps_generator_cpp_lib", - srcs = ["rosidl_typesupport_fastrtps_cpp/rosidl_typesupport_fastrtps_cpp/__init__.py"], - imports = ["rosidl_typesupport_fastrtps_cpp"], - visibility = ["//visibility:public"], - deps = [ - "@ros2_rosidl//:rosidl_cmake", - "@ros2_rosidl//:rosidl_parser", - ], -) - -_ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_CPP_APP_PY = "rosidl_typesupport_fastrtps_generator_cpp_app.py" - -copy_file( - name = "rosidl_typesupport_fastrtps_generator_cpp_copy", - src = "rosidl_typesupport_fastrtps_cpp/bin/rosidl_typesupport_fastrtps_cpp", - out = _ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_CPP_APP_PY, -) - -py_binary( - name = "rosidl_typesupport_fastrtps_generator_cpp_app", - srcs = [_ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_CPP_APP_PY], - legacy_create_init = False, - main = _ROSIDL_TYPESUPPORT_FASTRTPS_GENERATOR_CPP_APP_PY, - visibility = ["//visibility:public"], - deps = [":rosidl_typesupport_fastrtps_generator_cpp_lib"], -) - -filegroup( - name = "rosidl_typesupport_fastrtps_generator_cpp_templates", - srcs = glob(["rosidl_typesupport_fastrtps_cpp/resource/*.em"]), - visibility = ["//visibility:public"], -)