Skip to content

Commit

Permalink
Manually fix a set of Topic QoS, and implement the max-tx-rate, max-r…
Browse files Browse the repository at this point in the history
…x-rate, and downsampling (#403)

* Max-reception-rate & downsampling

Signed-off-by: tempate <[email protected]>

* Documentation

Signed-off-by: tempate <[email protected]>

* Add features to forthcoming verison

Signed-off-by: tempate <[email protected]>

* Unittests

Signed-off-by: tempate <[email protected]>

* Rename max-reception-rate to max-rx-rate

Signed-off-by: tempate <[email protected]>

* Load manual topic configuration into participants

Signed-off-by: tempate <[email protected]>

* Support Max Transmission Rate configuration

Signed-off-by: tempate <[email protected]>

* Minor fixes

Signed-off-by: tempate <[email protected]>

* Max transmission rate documentation

Signed-off-by: tempate <[email protected]>

* Manual topics documentation

Signed-off-by: tempate <[email protected]>

* Manual topics configuration

Signed-off-by: tempate <[email protected]>

* Make the DdsPipeConfiguration required

Signed-off-by: tempate <[email protected]>

* Simplify the DdsPipe's constructor

Signed-off-by: tempate <[email protected]>

* Remove redundant test

Signed-off-by: tempate <[email protected]>

* Docker tests for the configurable frequency

Signed-off-by: tempate <[email protected]>

* Docker test for the manual topics

Signed-off-by: tempate <[email protected]>

* Minor fixes

Signed-off-by: tempate <[email protected]>

* Apply suggestions

Signed-off-by: tempate <[email protected]>

* More docker tests

Signed-off-by: tempate <[email protected]>

* Pack the QoSs in specs on a Topic QoS object

Signed-off-by: tempate <[email protected]>

* Configure the QoS in specs under the qos tag

Signed-off-by: tempate <[email protected]>

* Minor corrections to the documentation

Signed-off-by: tempate <[email protected]>

* Minor fixes

Signed-off-by: tempate <[email protected]>

* Rewrite topic filtering & simplify builtin topics

Signed-off-by: tempate <[email protected]>

* Minor fixes to the documentation

Signed-off-by: tempate <[email protected]>

* Uncrustify

Signed-off-by: tempate <[email protected]>

* Slow down manual topics precedence test

Signed-off-by: tempate <[email protected]>

* Apply suggestions

Signed-off-by: tempate <[email protected]>

* Slow down docker test

Signed-off-by: tempate <[email protected]>

* Remove Topic QoS from the built-in topics

Signed-off-by: tempate <[email protected]>

* Update version from v3.1 to v4.0

Signed-off-by: tempate <[email protected]>

* Apply DdsPipe suggestions

Signed-off-by: tempate <[email protected]>

* Apply suggestions

Signed-off-by: tempate <[email protected]>

* Apply suggestions

Signed-off-by: tempate <[email protected]>

* Apply suggestions

Signed-off-by: tempate <[email protected]>

* Apply more suggestions

Signed-off-by: tempate <[email protected]>

* Minor fixes to the version update

Signed-off-by: tempate <[email protected]>

* Deactivate outdated tests in CMake

Signed-off-by: tempate <[email protected]>

* Minor fixes to YAML version

Signed-off-by: tempate <[email protected]>

* Remove Topic Filtering outdated note

Signed-off-by: tempate <[email protected]>

* Fix python-linter errors

Signed-off-by: tempate <[email protected]>

* Uncrustify

Signed-off-by: Juan Lopez Fernandez <[email protected]>

---------

Signed-off-by: tempate <[email protected]>
Signed-off-by: Juan Lopez Fernandez <[email protected]>
Co-authored-by: Juan Lopez Fernandez <[email protected]>
  • Loading branch information
Tempate and juanlofer-eprosima authored Nov 8, 2023
1 parent f37e91b commit 6140c85
Show file tree
Hide file tree
Showing 154 changed files with 1,748 additions and 742 deletions.
4 changes: 2 additions & 2 deletions ddsrouter_core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Include module is the public API used to configure a DDS Router and to interact

* **Configuration**: configuration objects that contains the information needed for a DDS Router. Are divided in:
* *ParticipantConfiguration*: configuration for each participant inside the DDS Router.
* *DdsRouterConfiguration*: configuration to execute a DDS Router, with its Participants and allowed lists.
* *DdsRouterReloadConfiguration*: configuration to change topics in a running DDS Router.
* *DdsRouterConfiguration*: configuration to execute a DDS Router, with its Participants and DdsPipeConfiguration.
* *DdsPipeConfiguration*: configuration to execute a DDS Pipe, with its allowlist, blocklist, manual topics, and built-in topics.

* **Core**: it only contains the proxy of DDS Router class, which implementation is inside private modules.
It allows to execute a DDS Router, and to interact with it while running.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <ddspipe_participants/configuration/ParticipantConfiguration.hpp>
#include <ddspipe_participants/xml/XmlHandlerConfiguration.hpp>

#include <ddsrouter_core/configuration/DdsRouterReloadConfiguration.hpp>
#include <ddsrouter_core/configuration/SpecsConfiguration.hpp>
#include <ddsrouter_core/types/ParticipantKind.hpp>

Expand All @@ -35,11 +34,11 @@ namespace core {

/**
* This data struct joins every DdsRouter feature configuration such as:
* - Modifiable values (from \c DdsRouterReloadConfiguration ).
* - DdsPipe configuration.
* - Participant configurations.
* - Advanced configurations.
*/
struct DdsRouterConfiguration : public DdsRouterReloadConfiguration
struct DdsRouterConfiguration : public ddspipe::core::IConfiguration
{

/////////////////////////
Expand All @@ -53,10 +52,6 @@ struct DdsRouterConfiguration : public DdsRouterReloadConfiguration
// METHODS
/////////////////////////

//! Set internal values with the values reloaded
DDSROUTER_CORE_DllAPI void reload(
const DdsRouterReloadConfiguration& new_configuration);

//! Override \c is_valid method.
DDSROUTER_CORE_DllAPI bool is_valid(
utils::Formatter& error_msg) const noexcept override;
Expand All @@ -65,9 +60,6 @@ struct DdsRouterConfiguration : public DdsRouterReloadConfiguration
// VARIABLES
/////////////////////////

//! Builtin topics to create at the beggining of the execution
std::set<utils::Heritable<ddspipe::core::types::DistributedTopic>> builtin_topics {};

//! Participant configurations
std::set<
std::pair<
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ struct SpecsConfiguration : public ddspipe::core::IConfiguration

unsigned int number_of_threads = 12;

/**
* @brief Maximum of History depth by default in those topics where it is not specified.
*
* @note Default value is 5000 as in Fast DDS.
*/
ddspipe::core::types::HistoryDepthType max_history_depth = 5000;

/**
* @brief Whether readers that aren't connected to any writers should be deleted.
*
Expand All @@ -70,6 +63,9 @@ struct SpecsConfiguration : public ddspipe::core::IConfiguration
* @warning Setting it to true is incompatible with transient-local durability.
*/
bool remove_unused_entities = false;

//! The globally configured Topic QoS.
ddspipe::core::types::TopicQoS topic_qos{};
};

} /* namespace core */
Expand Down
11 changes: 2 additions & 9 deletions ddsrouter_core/include/ddsrouter_core/core/DdsRouter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#include <ddsrouter_core/core/ParticipantFactory.hpp>
#include <ddsrouter_core/configuration/DdsRouterConfiguration.hpp>
#include <ddsrouter_core/configuration/DdsRouterReloadConfiguration.hpp>
#include <ddsrouter_core/library/library_dll.h>

namespace eprosima {
Expand Down Expand Up @@ -78,7 +77,7 @@ class DdsRouter
* @throw \c ConfigurationException in case the new yaml is not well-formed
*/
DDSROUTER_CORE_DllAPI utils::ReturnCode reload_configuration(
const DdsRouterReloadConfiguration& configuration);
const DdsRouterConfiguration& configuration);

/**
* @brief Start communication in DDS Router
Expand All @@ -104,13 +103,6 @@ class DdsRouter

protected:

/**
* @brief Load allowed topics from configuration
*
* @throw \c ConfigurationException in case the yaml inside allowlist is not well-formed
*/
void init_allowed_topics_();

/**
* @brief Create participants and add them to the participants database
*
Expand All @@ -119,6 +111,7 @@ class DdsRouter
*/
void init_participants_();


DdsRouterConfiguration configuration_;

std::shared_ptr<ddspipe::core::DiscoveryDatabase> discovery_database_;
Expand Down
14 changes: 0 additions & 14 deletions ddsrouter_core/src/cpp/configuration/DdsRouterConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,15 @@
#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>

#include <ddsrouter_core/configuration/DdsRouterConfiguration.hpp>
#include <ddsrouter_core/configuration/DdsRouterReloadConfiguration.hpp>
#include <ddsrouter_core/types/ParticipantKind.hpp>

namespace eprosima {
namespace ddsrouter {
namespace core {

void DdsRouterConfiguration::reload(
const DdsRouterReloadConfiguration& new_configuration)
{
this->allowlist = new_configuration.allowlist;
this->blocklist = new_configuration.blocklist;
}

bool DdsRouterConfiguration::is_valid(
utils::Formatter& error_msg) const noexcept
{
// Check Allow list topics
if (!DdsRouterReloadConfiguration::is_valid(error_msg))
{
return false;
}

// Check there are at least two participants
if (participants_configurations.size() < 1)
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ bool SpecsConfiguration::is_valid(
return false;
}

if (max_history_depth == 0)
if (topic_qos.history_depth == 0U)
{
logWarning(DDSROUTER_SPECS, "Using non limited histories could lead to memory exhaustion in long executions.");
}
Expand Down
34 changes: 6 additions & 28 deletions ddsrouter_core/src/cpp/core/DdsRouter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <ddspipe_core/types/dds/TopicQoS.hpp>

#include <ddsrouter_core/configuration/DdsRouterConfiguration.hpp>
#include <ddsrouter_core/configuration/DdsRouterReloadConfiguration.hpp>
#include <ddsrouter_core/core/DdsRouter.hpp>

namespace eprosima {
Expand All @@ -53,38 +52,20 @@ DdsRouter::DdsRouter(
"Configuration for DDS Router is invalid: " << error_msg);
}

// Set default value for history
ddspipe::core::types::TopicQoS::default_history_depth.store(
configuration_.advanced_options.max_history_depth);

// Init topic allowed
init_allowed_topics_();
// Load Participants
init_participants_();

// Create DdsPipe instance
// Initialize the DdsPipe
ddspipe_ = std::unique_ptr<ddspipe::core::DdsPipe>(new ddspipe::core::DdsPipe(
allowed_topics_,
configuration_.ddspipe_configuration,
discovery_database_,
payload_pool_,
participants_database_,
thread_pool_,
configuration_.builtin_topics,
false,
configuration_.ddspipe_configuration));
thread_pool_));

logDebug(DDSROUTER, "DDS Router created.");
}

void DdsRouter::init_allowed_topics_()
{
allowed_topics_ = std::make_shared<ddspipe::core::AllowedTopicList>(
configuration_.allowlist,
configuration_.blocklist);

logInfo(DDSROUTER, "DDS Router configured with allowed topics: " << *allowed_topics_);
}

void DdsRouter::init_participants_()
{
for (std::pair<types::ParticipantKind,
Expand Down Expand Up @@ -125,7 +106,7 @@ void DdsRouter::init_participants_()
}

utils::ReturnCode DdsRouter::reload_configuration(
const DdsRouterReloadConfiguration& new_configuration)
const DdsRouterConfiguration& new_configuration)
{
// Check that the configuration is correct
utils::Formatter error_msg;
Expand All @@ -136,11 +117,8 @@ utils::ReturnCode DdsRouter::reload_configuration(
"Configuration for Reload DDS Router is invalid: " << error_msg);
}

allowed_topics_ = std::make_shared<ddspipe::core::AllowedTopicList>(
new_configuration.allowlist,
new_configuration.blocklist);

return ddspipe_->reload_allowed_topics(allowed_topics_);
// Reload the DdsPipe configuration, since it is the only reconfigurable attribute.
return ddspipe_->reload_configuration(new_configuration.ddspipe_configuration);
}

utils::ReturnCode DdsRouter::start() noexcept
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ DdsRouterConfiguration router_configuration(
// One topic
core::types::WildcardDdsFilterTopic topic;
topic.topic_name.set_value(TOPIC_NAME);
conf.allowlist.insert(
conf.ddspipe_configuration.allowlist.insert(
utils::Heritable<core::types::WildcardDdsFilterTopic>::make_heritable(topic));

// Two participants, one custom and other simple. If server, simple will work in 0, if not in 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DdsRouterConfiguration dds_test_simple_configuration(
// Always filter the test topics by topic name
core::types::WildcardDdsFilterTopic topic;
topic.topic_name.set_value(TOPIC_NAME);
conf.allowlist.insert(
conf.ddspipe_configuration.allowlist.insert(
utils::Heritable<core::types::WildcardDdsFilterTopic>::make_heritable(topic));

if (disable_dynamic_discovery)
Expand All @@ -81,8 +81,9 @@ DdsRouterConfiguration dds_test_simple_configuration(
topic_keyed.type_name = "HelloWorldKeyed";
topic_keyed.topic_qos.keyed = true;

conf.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(topic));
conf.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(topic_keyed));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(topic));
conf.ddspipe_configuration.builtin_topics.insert(utils::Heritable<core::types::DdsTopic>::make_heritable(
topic_keyed));
}

// Two simple participants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ DdsRouterConfiguration dds_test_simple_configuration()
// Always filter the test topics by topic name
core::types::WildcardDdsFilterTopic topic;
topic.topic_name.set_value(TOPIC_NAME);
conf.allowlist.insert(
conf.ddspipe_configuration.allowlist.insert(
utils::Heritable<core::types::WildcardDdsFilterTopic>::make_heritable(topic));

// Two simple participants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ DdsRouterConfiguration router_configuration(
// One topic
core::types::WildcardDdsFilterTopic topic;
topic.topic_name.set_value(TOPIC_NAME);
conf.allowlist.insert(
conf.ddspipe_configuration.allowlist.insert(
utils::Heritable<core::types::WildcardDdsFilterTopic>::make_heritable(topic));

// Two participants, one custom and other simple. If server, simple will work in 0, if not in 1
Expand Down
Loading

0 comments on commit 6140c85

Please sign in to comment.