Skip to content

Commit

Permalink
Patched rmw_fastrtps so string comparison is correct
Browse files Browse the repository at this point in the history
  • Loading branch information
henriksod committed Jul 29, 2023
1 parent 905f04c commit 47ca620
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
2 changes: 2 additions & 0 deletions repositories/ros2_repositories_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
68 changes: 0 additions & 68 deletions repositories/rosidl_typesupport_fastrtps.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)

0 comments on commit 47ca620

Please sign in to comment.