From ca4ae59f9c6d8dfde9376f493f61ea69902e8912 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 3 Mar 2022 14:59:10 -0300 Subject: [PATCH 1/6] Fill publication_sequence_number in all rmw_take_*_with_info() functions Signed-off-by: Ivan Santiago Paunovic --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 44747129e..87568c2e5 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -47,6 +47,10 @@ _assign_message_info( { message_info->source_timestamp = sinfo->source_timestamp.to_ns(); message_info->received_timestamp = sinfo->reception_timestamp.to_ns(); + auto fastdds_sn = sinfo->sample_identity.sequence_number(); + message_info->publication_sequence_number = (static_cast(fastdds_sn.high)) << + 32 | static_cast(fastdds_sn.low); + message_info->reception_sequence_number = sinfo->reception_timestamp.to_ns(); rmw_gid_t * sender_gid = &message_info->publisher_gid; sender_gid->implementation_identifier = identifier; memset(sender_gid->data, 0, RMW_GID_STORAGE_SIZE); From fe02f4a54c4360eba0cefa8ea3710a9a955103f5 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 10 Mar 2022 16:19:38 -0300 Subject: [PATCH 2/6] Implement rmw_feature_supported() Signed-off-by: Ivan Santiago Paunovic --- rmw_fastrtps_cpp/CMakeLists.txt | 1 + rmw_fastrtps_cpp/src/rmw_features.cpp | 27 +++++++++++++++++++ rmw_fastrtps_dynamic_cpp/CMakeLists.txt | 1 + rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp | 27 +++++++++++++++++++ rmw_fastrtps_shared_cpp/CMakeLists.txt | 1 + .../rmw_fastrtps_shared_cpp/rmw_common.hpp | 5 ++++ rmw_fastrtps_shared_cpp/src/rmw_features.cpp | 26 ++++++++++++++++++ 7 files changed, 88 insertions(+) create mode 100644 rmw_fastrtps_cpp/src/rmw_features.cpp create mode 100644 rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp create mode 100644 rmw_fastrtps_shared_cpp/src/rmw_features.cpp diff --git a/rmw_fastrtps_cpp/CMakeLists.txt b/rmw_fastrtps_cpp/CMakeLists.txt index 7a086e258..d34ac9768 100644 --- a/rmw_fastrtps_cpp/CMakeLists.txt +++ b/rmw_fastrtps_cpp/CMakeLists.txt @@ -62,6 +62,7 @@ add_library(rmw_fastrtps_cpp src/rmw_compare_gids_equal.cpp src/rmw_count.cpp src/rmw_event.cpp + src/rmw_features.cpp src/rmw_get_gid_for_publisher.cpp src/rmw_get_implementation_identifier.cpp src/rmw_get_serialization_format.cpp diff --git a/rmw_fastrtps_cpp/src/rmw_features.cpp b/rmw_fastrtps_cpp/src/rmw_features.cpp new file mode 100644 index 000000000..13745a7ae --- /dev/null +++ b/rmw_fastrtps_cpp/src/rmw_features.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 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 "rmw/features.h" + +#include "rmw_fastrtps_shared_cpp/rmw_common.hpp" + +extern "C" +{ + +bool +rmw_feature_supported(rmw_feature_t feature) +{ + return rmw_fastrtps_shared_cpp::__rmw_feature_supported(feature); +} +} // extern "C" diff --git a/rmw_fastrtps_dynamic_cpp/CMakeLists.txt b/rmw_fastrtps_dynamic_cpp/CMakeLists.txt index de6be2bbe..3c34ef7b2 100644 --- a/rmw_fastrtps_dynamic_cpp/CMakeLists.txt +++ b/rmw_fastrtps_dynamic_cpp/CMakeLists.txt @@ -64,6 +64,7 @@ add_library(rmw_fastrtps_dynamic_cpp src/rmw_compare_gids_equal.cpp src/rmw_count.cpp src/rmw_event.cpp + src/rmw_features.cpp src/rmw_get_gid_for_publisher.cpp src/rmw_get_implementation_identifier.cpp src/rmw_get_serialization_format.cpp diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp new file mode 100644 index 000000000..13745a7ae --- /dev/null +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_features.cpp @@ -0,0 +1,27 @@ +// Copyright 2022 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 "rmw/features.h" + +#include "rmw_fastrtps_shared_cpp/rmw_common.hpp" + +extern "C" +{ + +bool +rmw_feature_supported(rmw_feature_t feature) +{ + return rmw_fastrtps_shared_cpp::__rmw_feature_supported(feature); +} +} // extern "C" diff --git a/rmw_fastrtps_shared_cpp/CMakeLists.txt b/rmw_fastrtps_shared_cpp/CMakeLists.txt index 3c30f3101..fbf765686 100644 --- a/rmw_fastrtps_shared_cpp/CMakeLists.txt +++ b/rmw_fastrtps_shared_cpp/CMakeLists.txt @@ -61,6 +61,7 @@ add_library(rmw_fastrtps_shared_cpp src/rmw_compare_gids_equal.cpp src/rmw_count.cpp src/rmw_event.cpp + src/rmw_features.cpp src/rmw_get_endpoint_network_flow.cpp src/rmw_get_gid_for_publisher.cpp src/rmw_get_topic_endpoint_info.cpp diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp index 2f11c4794..0bc82c770 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/rmw_common.hpp @@ -19,6 +19,7 @@ #include "rmw/error_handling.h" #include "rmw/event.h" +#include "rmw/features.h" #include "rmw/rmw.h" #include "rmw/topic_endpoint_info_array.h" #include "rmw/types.h" @@ -514,6 +515,10 @@ __rmw_event_set_callback( rmw_event_callback_t callback, const void * user_data); +RMW_FASTRTPS_SHARED_CPP_PUBLIC +bool +__rmw_feature_supported(rmw_feature_t feature); + } // namespace rmw_fastrtps_shared_cpp #endif // RMW_FASTRTPS_SHARED_CPP__RMW_COMMON_HPP_ diff --git a/rmw_fastrtps_shared_cpp/src/rmw_features.cpp b/rmw_fastrtps_shared_cpp/src/rmw_features.cpp new file mode 100644 index 000000000..5296c58b1 --- /dev/null +++ b/rmw_fastrtps_shared_cpp/src/rmw_features.cpp @@ -0,0 +1,26 @@ +// Copyright 2022 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 "rmw/features.h" + +#include "rmw_fastrtps_shared_cpp/rmw_common.hpp" + +bool +rmw_fastrtps_shared_cpp::__rmw_feature_supported(rmw_feature_t feature) +{ + if (feature == RMW_FEATURE_MESSAGE_INFO_PUBLICATION_SEQUENCE_NUMBER) { + return true; + } + return false; +} From 4d08e0bd7525f20e6871b6f4bd7c1e1dfa921a6b Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 10 Mar 2022 16:26:25 -0300 Subject: [PATCH 3/6] Set message_info->reception_sequence_number to RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED Signed-off-by: Ivan Santiago Paunovic --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 87568c2e5..8253ec061 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -50,7 +50,7 @@ _assign_message_info( auto fastdds_sn = sinfo->sample_identity.sequence_number(); message_info->publication_sequence_number = (static_cast(fastdds_sn.high)) << 32 | static_cast(fastdds_sn.low); - message_info->reception_sequence_number = sinfo->reception_timestamp.to_ns(); + message_info->reception_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED; rmw_gid_t * sender_gid = &message_info->publisher_gid; sender_gid->implementation_identifier = identifier; memset(sender_gid->data, 0, RMW_GID_STORAGE_SIZE); From 13757f5c35a4ce5da17bf775f2e30ab2565263b2 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Fri, 11 Mar 2022 12:15:54 -0300 Subject: [PATCH 4/6] Use uint64_t Signed-off-by: Ivan Santiago Paunovic --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index 8253ec061..b5f8ef6db 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -48,8 +48,8 @@ _assign_message_info( message_info->source_timestamp = sinfo->source_timestamp.to_ns(); message_info->received_timestamp = sinfo->reception_timestamp.to_ns(); auto fastdds_sn = sinfo->sample_identity.sequence_number(); - message_info->publication_sequence_number = (static_cast(fastdds_sn.high)) << - 32 | static_cast(fastdds_sn.low); + message_info->publication_sequence_number = (static_cast(fastdds_sn.high)) << + 32 | static_cast(fastdds_sn.low); message_info->reception_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED; rmw_gid_t * sender_gid = &message_info->publisher_gid; sender_gid->implementation_identifier = identifier; From 0253e7e8f37630aa732a94bbaeffb4e80fae5f2b Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Mon, 14 Mar 2022 16:22:08 -0300 Subject: [PATCH 5/6] Improve readability Signed-off-by: Ivan Santiago Paunovic Co-authored-by: William Woodall --- rmw_fastrtps_shared_cpp/src/rmw_take.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp index b5f8ef6db..8c7515d81 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_take.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_take.cpp @@ -48,8 +48,9 @@ _assign_message_info( message_info->source_timestamp = sinfo->source_timestamp.to_ns(); message_info->received_timestamp = sinfo->reception_timestamp.to_ns(); auto fastdds_sn = sinfo->sample_identity.sequence_number(); - message_info->publication_sequence_number = (static_cast(fastdds_sn.high)) << - 32 | static_cast(fastdds_sn.low); + message_info->publication_sequence_number = + (static_cast(fastdds_sn.high) << 32) | + static_cast(fastdds_sn.low); message_info->reception_sequence_number = RMW_MESSAGE_INFO_SEQUENCE_NUMBER_UNSUPPORTED; rmw_gid_t * sender_gid = &message_info->publisher_gid; sender_gid->implementation_identifier = identifier; From 2ded7818c84a44ccf6ecfa40a999255ef05bf330 Mon Sep 17 00:00:00 2001 From: Ivan Santiago Paunovic Date: Thu, 17 Mar 2022 17:19:23 -0300 Subject: [PATCH 6/6] please linters Signed-off-by: Ivan Santiago Paunovic --- rmw_fastrtps_cpp/src/rmw_features.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/rmw_fastrtps_cpp/src/rmw_features.cpp b/rmw_fastrtps_cpp/src/rmw_features.cpp index 13745a7ae..79379b892 100644 --- a/rmw_fastrtps_cpp/src/rmw_features.cpp +++ b/rmw_fastrtps_cpp/src/rmw_features.cpp @@ -18,7 +18,6 @@ extern "C" { - bool rmw_feature_supported(rmw_feature_t feature) {