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

[20509] Update repository for Fast DDS 3.0.0 compatibility #86

Merged
merged 10 commits into from
Sep 16, 2024
Merged
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
4 changes: 2 additions & 2 deletions docs/rst/developer_manual/installation/sources/linux.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following packages will be installed:

- ``foonathan_memory_vendor``, an STL compatible C++ memory allocation library.
- ``fastcdr``, a C++ library that serializes according to the standard CDR serialization mechanism.
- ``fastrtps``, the core library of eProsima Fast DDS library.
- ``fastdds``, the core library of eProsima Fast DDS library.
- ``cmake_utils``, an eProsima utils library for CMake.
- ``cpp_utils``, an eProsima utils library for C++.
- ``ddspipe``, an eProsima internal library that enables the communication of DDS interfaces.
Expand Down Expand Up @@ -93,7 +93,7 @@ Use the following command to download the code:

.. code-block:: bash

git clone --branch release-1.11.0 https://github.com/google/googletest src/googletest-distribution
git clone --branch release-1.12.0 https://github.com/google/googletest src/googletest-distribution


.. _dependencies:
Expand Down
4 changes: 2 additions & 2 deletions docs/rst/developer_manual/installation/sources/windows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The following packages will be installed:

- ``foonathan_memory_vendor``, an STL compatible C++ memory allocation library.
- ``fastcdr``, a C++ library that serializes according to the standard CDR serialization mechanism.
- ``fastrtps``, the core library of eProsima Fast DDS library.
- ``fastdds``, the core library of eProsima Fast DDS library.
- ``cmake_utils``, an eProsima utils library for CMake.
- ``cpp_utils``, an eProsima utils library for C++.
- ``ddspipe``, an eProsima internal library that enables the communication of DDS interfaces.
Expand Down Expand Up @@ -255,7 +255,7 @@ There are two possibilities:
However, when running an instance of a |spy| compiled using CMake, it must be linked with its dependencies where the packages have been installed.
This can be done by opening the *Edit system environment variables* control panel and adding to the ``PATH`` the |espy|, *Fast DDS*, *Fast CDR*, *DDS Pipe* installation directories:

* *Fast DDS*: ``C:\\Program Files\\fastrtps``
* *Fast DDS*: ``C:\\Program Files\\fastdds``
* *Fast CDR*: ``C:\\Program Files\\fastcdr``
* *DDS Pipe*: ``C:\\Program Files\\ddspipe``
* |espy|: ``C:\\Program Files\\ddsrecord``
Expand Down
4 changes: 0 additions & 4 deletions docs/rst/user_manual/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,6 @@ The type of the logs published is defined as follows:
string timestamp;
};

.. note::

The type of the logs can be published by setting ``publish-type: true``.

**Example of usage**

.. code-block:: yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@
#include <iostream>
#include <functional>
#include <shared_mutex>
#include <tuple>

#include <fastrtps/types/DynamicTypePtr.h>
#include <fastcdr/cdr/fixed_size_string.hpp>

#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>

#include <ddspipe_core/types/topic/dds/DdsTopic.hpp>
#include <ddspipe_core/types/dds/Payload.hpp>
Expand All @@ -39,7 +42,7 @@ class DataStreamer : public TopicRateCalculator

using CallbackType = std::function<void (
const ddspipe::core::types::DdsTopic&,
const fastrtps::types::DynamicType_ptr&,
const fastdds::dds::DynamicType::_ref_type&,
const ddspipe::core::types::RtpsPayloadData&)>;

FASTDDSSPY_PARTICIPANTS_DllAPI
Expand All @@ -56,7 +59,8 @@ class DataStreamer : public TopicRateCalculator

FASTDDSSPY_PARTICIPANTS_DllAPI
void add_schema(
const fastrtps::types::DynamicType_ptr& dynamic_type) override;
const fastdds::dds::DynamicType::_ref_type& dynamic_type,
const fastdds::dds::xtypes::TypeIdentifier& type_identifier) override;

FASTDDSSPY_PARTICIPANTS_DllAPI
void add_data(
Expand All @@ -80,7 +84,7 @@ class DataStreamer : public TopicRateCalculator

ddspipe::core::types::DdsTopic activated_topic_;

std::map<std::string, fastrtps::types::DynamicType_ptr> types_discovered_;
std::map<std::string, fastdds::dds::DynamicType::_ref_type> types_discovered_;

mutable std::shared_timed_mutex mutex_;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

#pragma once

#include <fastrtps/types/DynamicTypePtr.h>

#include <cpp_utils/collection/database/SafeDatabase.hpp>
#include <cpp_utils/types/Atomicable.hpp>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

#pragma once

#include <fastdds/rtps/builtin/data/ParticipantBuiltinTopicData.hpp>
#include <fastdds/rtps/builtin/data/PublicationBuiltinTopicData.hpp>
#include <fastdds/rtps/builtin/data/SubscriptionBuiltinTopicData.hpp>
#include <fastdds/rtps/participant/ParticipantDiscoveryInfo.hpp>
#include <fastdds/rtps/participant/RTPSParticipant.hpp>
#include <fastdds/rtps/reader/ReaderDiscoveryStatus.hpp>
#include <fastdds/rtps/writer/WriterDiscoveryStatus.hpp>

#include <ddspipe_participants/participant/dynamic_types/DynTypesParticipant.hpp>
#include <ddspipe_core/types/dds/Endpoint.hpp>

Expand Down Expand Up @@ -47,19 +55,25 @@ class SpyDdsParticipant : public ddspipe::participants::DynTypesParticipant
const ddspipe::core::ITopic& topic) override;

FASTDDSSPY_PARTICIPANTS_DllAPI
virtual void on_participant_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::ParticipantDiscoveryInfo&& info) override;
void on_participant_discovery(
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::ParticipantDiscoveryStatus reason,
const fastdds::rtps::ParticipantBuiltinTopicData& info,
bool& should_be_ignored) override;

FASTDDSSPY_PARTICIPANTS_DllAPI
virtual void on_subscriber_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info);
void on_reader_discovery(
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::ReaderDiscoveryStatus reason,
const fastdds::rtps::SubscriptionBuiltinTopicData& info,
bool& should_be_ignored) override;

FASTDDSSPY_PARTICIPANTS_DllAPI
virtual void on_publisher_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info);
void on_writer_discovery(
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::WriterDiscoveryStatus reason,
const fastdds::rtps::PublicationBuiltinTopicData& info,
bool& should_be_ignored) override;

protected:

Expand Down
2 changes: 1 addition & 1 deletion fastddsspy_participants/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<depend>cpp_utils</depend>
<depend>ddspipe_core</depend>
<depend>ddspipe_participants</depend>
<depend>fastrtps</depend>
<depend>fastdds</depend>

<doc_depend>doxygen</doc_depend>

Expand Down
4 changes: 2 additions & 2 deletions fastddsspy_participants/project_settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ set(MODULE_SUMMARY

set(MODULE_FIND_PACKAGES
fastcdr
fastrtps
fastdds
cpp_utils
ddspipe_core
ddspipe_participants)

set(fastrtps_MINIMUM_VERSION "2.8")
set(fastdds_MINIMUM_VERSION "3.0.0")

set(MODULE_DEPENDENCIES
$<$<BOOL:${WIN32}>:iphlpapi$<SEMICOLON>Shlwapi>
Expand Down
29 changes: 16 additions & 13 deletions fastddsspy_participants/src/cpp/model/DataStreamer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

#include <mutex>

#include <fastrtps/types/DynamicType.h>
#include <fastrtps/types/DynamicPubSubType.h>
#include <fastrtps/types/DynamicData.h>
#include <fastrtps/types/DynamicDataFactory.h>
#include <fastrtps/types/DynamicDataHelper.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicPubSubType.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicDataFactory.hpp>

#include <cpp_utils/utils.hpp>

Expand Down Expand Up @@ -48,7 +47,7 @@ bool DataStreamer::activate(
{
if (!is_topic_type_discovered(topic_to_activate))
{
logWarning(FASTDDSSPY_DATASTREAMER,
EPROSIMA_LOG_WARNING(FASTDDSSPY_DATASTREAMER,
"Type <" << topic_to_activate.type_name <<
"> for topic <" << topic_to_activate.topic_name() << "> is not discovered.");
return false;
Expand All @@ -73,15 +72,19 @@ void DataStreamer::deactivate()
}

void DataStreamer::add_schema(
const fastrtps::types::DynamicType_ptr& dynamic_type)
const fastdds::dds::DynamicType::_ref_type& dynamic_type,
const fastdds::dds::xtypes::TypeIdentifier& type_identifier)
{
static_cast<void>(type_identifier);

std::unique_lock<std::shared_timed_mutex> _(mutex_);

// Add type to map if not yet
// NOTE: it does not matter if it is already in set
types_discovered_[dynamic_type->get_name()] = dynamic_type;
auto const type_name = dynamic_type->get_name().to_string();
types_discovered_[type_name] = dynamic_type;

logInfo(FASTDDSSPY_DATASTREAMER, "\nAdding schema with name " << dynamic_type->get_name() << ".");
EPROSIMA_LOG_INFO(FASTDDSSPY_DATASTREAMER, "\nAdding schema with name " << type_name << ".");
}

void DataStreamer::add_data(
Expand All @@ -90,7 +93,7 @@ void DataStreamer::add_data(
{
TopicRateCalculator::add_data(topic, data);

fastrtps::types::DynamicType_ptr dyn_type;
fastdds::dds::DynamicType::_ref_type dyn_type;

{
std::shared_lock<std::shared_timed_mutex> _(mutex_);
Expand All @@ -106,7 +109,7 @@ void DataStreamer::add_data(
if (!is_topic_type_discovered_nts_(topic))
{
// If all activated, add it only if schema is available, otherwise skip
logWarning(
EPROSIMA_LOG_WARNING(
FASTDDSSPY_DATASTREAMER,
"All activated but schema not is available.");
return;
Expand All @@ -117,14 +120,14 @@ void DataStreamer::add_data(
if (!(activated_topic_ == topic))
{
// If not all activated, and this is not the activated topic skip
logWarning(
EPROSIMA_LOG_WARNING(
FASTDDSSPY_DATASTREAMER,
"Not all activated, and this is not the activated topic.");
return;
}
}

logInfo(
EPROSIMA_LOG_INFO(
FASTDDSSPY_DATASTREAMER,
"Adding data in topic " << topic);

Expand Down
57 changes: 33 additions & 24 deletions fastddsspy_participants/src/cpp/participant/SpyDdsParticipant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include <fastdds/rtps/participant/RTPSParticipant.h>

#include <ddspipe_participants/utils/utils.hpp>

#include <fastddsspy_participants/participant/SpyDdsParticipant.hpp>
Expand Down Expand Up @@ -57,56 +55,69 @@ std::shared_ptr<ddspipe::core::IReader> SpyDdsParticipant::create_reader(
}

void SpyDdsParticipant::on_participant_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::ParticipantDiscoveryInfo&& discovery_info)
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::ParticipantDiscoveryStatus reason,
const fastdds::rtps::ParticipantBuiltinTopicData& info,
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(discovery_info.info.m_guid))
if (come_from_this_participant_(info.guid))
{
return;
}

ParticipantInfo info;
info.active = (discovery_info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::DISCOVERED_PARTICIPANT
|| discovery_info.status == eprosima::fastrtps::rtps::ParticipantDiscoveryInfo::CHANGED_QOS_PARTICIPANT);
info.name = std::string(discovery_info.info.m_participantName);
info.guid = discovery_info.info.m_guid;
ParticipantInfo participant_info;
participant_info.active = (reason == fastdds::rtps::ParticipantDiscoveryStatus::DISCOVERED_PARTICIPANT
|| reason == fastdds::rtps::ParticipantDiscoveryStatus::CHANGED_QOS_PARTICIPANT);
participant_info.name = std::string(info.participant_name);
participant_info.guid = info.guid;

ddspipe::participants::rtps::CommonParticipant::on_participant_discovery(participant, reason, info,
should_be_ignored);

internal_notify_participant_discovered_(info);
internal_notify_participant_discovered_(participant_info);
}

void SpyDdsParticipant::on_subscriber_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::ReaderDiscoveryInfo&& info)
void SpyDdsParticipant::on_reader_discovery(
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::ReaderDiscoveryStatus reason,
const fastdds::rtps::SubscriptionBuiltinTopicData& info,
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(info.info.guid()))
if (come_from_this_participant_(info.guid))
{
return;
}

EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id());

// If participant left or dropped, this notification arrives as well
endpoint_info.active = !(info.status == fastrtps::rtps::ReaderDiscoveryInfo::DISCOVERY_STATUS::REMOVED_READER);
endpoint_info.active = !(reason == fastdds::rtps::ReaderDiscoveryStatus::REMOVED_READER);

ddspipe::participants::DynTypesParticipant::on_reader_discovery(participant, reason, info, should_be_ignored);

internal_notify_endpoint_discovered_(endpoint_info);
}

void SpyDdsParticipant::on_publisher_discovery(
fastdds::dds::DomainParticipant* participant,
fastrtps::rtps::WriterDiscoveryInfo&& info)
void SpyDdsParticipant::on_writer_discovery(
fastdds::rtps::RTPSParticipant* participant,
fastdds::rtps::WriterDiscoveryStatus reason,
const fastdds::rtps::PublicationBuiltinTopicData& info,
bool& should_be_ignored)
{
// If comes from this participant is not interesting
if (come_from_this_participant_(info.info.guid()))
if (come_from_this_participant_(info.guid))
{
return;
}

EndpointInfo endpoint_info = ddspipe::participants::detail::create_endpoint_from_info_(info, id());

// If participant left or dropped, this notification arrives as well
endpoint_info.active = !(info.status == fastrtps::rtps::WriterDiscoveryInfo::DISCOVERY_STATUS::REMOVED_WRITER);
endpoint_info.active = !(reason == fastdds::rtps::WriterDiscoveryStatus::REMOVED_WRITER);

ddspipe::participants::DynTypesParticipant::on_writer_discovery(participant, reason, info, should_be_ignored);

internal_notify_endpoint_discovered_(endpoint_info);
}
Expand Down Expand Up @@ -140,9 +151,7 @@ void SpyDdsParticipant::internal_notify_endpoint_discovered_(
bool SpyDdsParticipant::come_from_this_participant_(
const ddspipe::core::types::Guid& guid) const noexcept
{
return (guid.guid_prefix() == dds_participant_->guid().guidPrefix
|| guid.guid_prefix() == rtps_participant_->getGuid().guidPrefix
);
return (guid.guid_prefix() == rtps_participant_->getGuid().guidPrefix);
}

} /* namespace participants */
Expand Down
2 changes: 1 addition & 1 deletion fastddsspy_participants/src/cpp/testing/random_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ddspipe::core::types::Guid random_guid_same_prefix(
unsigned int seed /* = 1 */)
{
ddspipe::core::types::Guid guid;
guid.entityId.value[3] = static_cast<eprosima::fastrtps::rtps::octet>(seed);
guid.entityId.value[3] = static_cast<eprosima::fastdds::rtps::octet>(seed);
guid.guidPrefix.value[0] = 0x01;
guid.guidPrefix.value[1] = 0x0f;
return guid;
Expand Down
4 changes: 2 additions & 2 deletions fastddsspy_participants/test/blackbox/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ set(TEST_LIST

set(TEST_EXTRA_LIBRARIES
fastcdr
fastrtps
fastdds
cpp_utils
ddspipe_core
ddspipe_participants
Expand Down Expand Up @@ -80,7 +80,7 @@ set(TEST_LIST

set(TEST_EXTRA_LIBRARIES
fastcdr
fastrtps
fastdds
cpp_utils
ddspipe_core
ddspipe_participants
Expand Down
2 changes: 1 addition & 1 deletion fastddsspy_participants/test/unittest/model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ set(TEST_LIST

set(TEST_EXTRA_LIBRARIES
fastcdr
fastrtps
fastdds
cpp_utils
ddspipe_core
ddspipe_participants
Expand Down
Loading
Loading