From d63e246a142be532c2d377673908e889f79522cc Mon Sep 17 00:00:00 2001 From: burekn Date: Thu, 18 Apr 2019 14:24:56 -0700 Subject: [PATCH] Upgrades to support Fast-RTPS 1.8.0 --- rmw_fastrtps_cpp/src/rmw_client.cpp | 13 +++++++------ rmw_fastrtps_cpp/src/rmw_service.cpp | 13 +++++++------ rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp | 13 +++++++------ rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp | 13 +++++++------ .../custom_participant_info.hpp | 5 ++--- .../src/rmw_service_server_is_available.cpp | 4 ++-- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/rmw_fastrtps_cpp/src/rmw_client.cpp b/rmw_fastrtps_cpp/src/rmw_client.cpp index b70c47ef2..5cba3591d 100644 --- a/rmw_fastrtps_cpp/src/rmw_client.cpp +++ b/rmw_fastrtps_cpp/src/rmw_client.cpp @@ -129,12 +129,13 @@ rmw_create_client( subscriberParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; subscriberParam.topic.topicDataType = response_type_name; + std::string topic_name; if (!qos_policies->avoid_ros_namespace_conventions) { - subscriberParam.topic.topicName = std::string(ros_service_response_prefix) + service_name; + topic_name = std::string(ros_service_response_prefix) + service_name; } else { - subscriberParam.topic.topicName = service_name; + topic_name = service_name; } - subscriberParam.topic.topicName += "Reply"; + subscriberParam.topic.topicName = topic_name + "Reply"; if (!impl->leave_middleware_default_qos) { publisherParam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE; @@ -145,11 +146,11 @@ rmw_create_client( publisherParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; publisherParam.topic.topicDataType = request_type_name; if (!qos_policies->avoid_ros_namespace_conventions) { - publisherParam.topic.topicName = std::string(ros_service_requester_prefix) + service_name; + topic_name = std::string(ros_service_requester_prefix) + service_name; } else { - publisherParam.topic.topicName = service_name; + topic_name = service_name; } - publisherParam.topic.topicName += "Request"; + publisherParam.topic.topicName = topic_name + "Request"; RCUTILS_LOG_DEBUG_NAMED( "rmw_fastrtps_cpp", diff --git a/rmw_fastrtps_cpp/src/rmw_service.cpp b/rmw_fastrtps_cpp/src/rmw_service.cpp index 0409ff820..904562c3e 100644 --- a/rmw_fastrtps_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_cpp/src/rmw_service.cpp @@ -139,12 +139,13 @@ rmw_create_service( subscriberParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; subscriberParam.topic.topicDataType = request_type_name; + std::string topic_name; if (!qos_policies->avoid_ros_namespace_conventions) { - subscriberParam.topic.topicName = std::string(ros_service_requester_prefix) + service_name; + topic_name = std::string(ros_service_requester_prefix) + service_name; } else { - subscriberParam.topic.topicName = service_name; + topic_name = service_name; } - subscriberParam.topic.topicName += "Request"; + subscriberParam.topic.topicName = topic_name + "Request"; if (!impl->leave_middleware_default_qos) { publisherParam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE; @@ -155,11 +156,11 @@ rmw_create_service( publisherParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; publisherParam.topic.topicDataType = response_type_name; if (!qos_policies->avoid_ros_namespace_conventions) { - publisherParam.topic.topicName = std::string(ros_service_response_prefix) + service_name; + topic_name = std::string(ros_service_response_prefix) + service_name; } else { - publisherParam.topic.topicName = service_name; + topic_name = service_name; } - publisherParam.topic.topicName += "Reply"; + publisherParam.topic.topicName = topic_name + "Reply"; RCUTILS_LOG_DEBUG_NAMED( "rmw_fastrtps_cpp", diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp index 0cbf937b2..f970fb7b6 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_client.cpp @@ -134,12 +134,13 @@ rmw_create_client( subscriberParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; subscriberParam.topic.topicDataType = response_type_name; + std::string topic_name; if (!qos_policies->avoid_ros_namespace_conventions) { - subscriberParam.topic.topicName = std::string(ros_service_response_prefix) + service_name; + topic_name = std::string(ros_service_response_prefix) + service_name; } else { - subscriberParam.topic.topicName = service_name; + topic_name = service_name; } - subscriberParam.topic.topicName += "Reply"; + subscriberParam.topic.topicName = topic_name + "Reply"; if (!impl->leave_middleware_default_qos) { publisherParam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE; @@ -150,11 +151,11 @@ rmw_create_client( publisherParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; publisherParam.topic.topicDataType = request_type_name; if (!qos_policies->avoid_ros_namespace_conventions) { - publisherParam.topic.topicName = std::string(ros_service_requester_prefix) + service_name; + topic_name = std::string(ros_service_requester_prefix) + service_name; } else { - publisherParam.topic.topicName = service_name; + topic_name = service_name; } - publisherParam.topic.topicName += "Request"; + publisherParam.topic.topicName = topic_name + "Request"; RCUTILS_LOG_DEBUG_NAMED( "rmw_fastrtps_dynamic_cpp", diff --git a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp index f11c8b0b1..8a81cf094 100644 --- a/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp +++ b/rmw_fastrtps_dynamic_cpp/src/rmw_service.cpp @@ -144,12 +144,13 @@ rmw_create_service( subscriberParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; subscriberParam.topic.topicDataType = request_type_name; + std::string topic_name; if (!qos_policies->avoid_ros_namespace_conventions) { - subscriberParam.topic.topicName = std::string(ros_service_requester_prefix) + service_name; + topic_name = std::string(ros_service_requester_prefix) + service_name; } else { - subscriberParam.topic.topicName = service_name; + topic_name = service_name; } - subscriberParam.topic.topicName += "Request"; + subscriberParam.topic.topicName = topic_name + "Request"; if (!impl->leave_middleware_default_qos) { publisherParam.qos.m_publishMode.kind = eprosima::fastrtps::ASYNCHRONOUS_PUBLISH_MODE; @@ -160,11 +161,11 @@ rmw_create_service( publisherParam.topic.topicKind = eprosima::fastrtps::rtps::NO_KEY; publisherParam.topic.topicDataType = response_type_name; if (!qos_policies->avoid_ros_namespace_conventions) { - publisherParam.topic.topicName = std::string(ros_service_response_prefix) + service_name; + topic_name = std::string(ros_service_response_prefix) + service_name; } else { - publisherParam.topic.topicName = service_name; + topic_name = service_name; } - publisherParam.topic.topicName += "Reply"; + publisherParam.topic.topicName = topic_name + "Reply"; RCUTILS_LOG_DEBUG_NAMED( "rmw_fastrtps_dynamic_cpp", diff --git a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp index e3a9875a0..c0ad97fdb 100644 --- a/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp +++ b/rmw_fastrtps_shared_cpp/include/rmw_fastrtps_shared_cpp/custom_participant_info.hpp @@ -161,16 +161,15 @@ class ParticipantListener : public eprosima::fastrtps::ParticipantListener auto & topic_cache = is_reader ? reader_topic_cache : writer_topic_cache; - auto fqdn = proxyData.topicName(); bool trigger; { std::lock_guard guard(topic_cache.getMutex()); if (is_alive) { trigger = topic_cache().addTopic(proxyData.RTPSParticipantKey(), - proxyData.topicName(), proxyData.typeName()); + proxyData.topicName().to_string(), proxyData.typeName().to_string()); } else { trigger = topic_cache().removeTopic(proxyData.RTPSParticipantKey(), - proxyData.topicName(), proxyData.typeName()); + proxyData.topicName().to_string(), proxyData.typeName().to_string()); } } if (trigger) { diff --git a/rmw_fastrtps_shared_cpp/src/rmw_service_server_is_available.cpp b/rmw_fastrtps_shared_cpp/src/rmw_service_server_is_available.cpp index bbc9f65f4..fec5f9189 100644 --- a/rmw_fastrtps_shared_cpp/src/rmw_service_server_is_available.cpp +++ b/rmw_fastrtps_shared_cpp/src/rmw_service_server_is_available.cpp @@ -64,12 +64,12 @@ __rmw_service_server_is_available( } auto pub_topic_name = - client_info->request_publisher_->getAttributes().topic.getTopicName(); + client_info->request_publisher_->getAttributes().topic.getTopicName().to_string(); auto pub_fqdn = _demangle_if_ros_topic(pub_topic_name); auto sub_topic_name = - client_info->response_subscriber_->getAttributes().topic.getTopicName(); + client_info->response_subscriber_->getAttributes().topic.getTopicName().to_string(); auto sub_fqdn = _demangle_if_ros_topic(sub_topic_name);