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

Manually fix a set of Topic QoS, and implement the max-tx-rate, max-rx-rate, and downsampling #64

Merged
merged 41 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
767afd5
Max-reception-rate & downsampling in RTPS participants
Tempate Oct 2, 2023
41639fa
Max-reception-rate & downsampling in DDS participants
Tempate Oct 2, 2023
2414719
Rename max-reception-rate to max-rx-rate
Tempate Oct 4, 2023
eba59e2
Basic support for manual topics tag
Tempate Oct 4, 2023
3d7aa54
Read all TopicQoS in the manual topics
Tempate Oct 5, 2023
d86f91e
Implement max transmission rate
Tempate Oct 5, 2023
7394ef2
Minor fixes
Tempate Oct 5, 2023
48b7deb
Fix bugs and clean code
Tempate Oct 6, 2023
061dead
Fix rebase error
Tempate Oct 9, 2023
a3e9f68
Make the DdsPipeConfiguration required
Tempate Oct 10, 2023
030f41d
Apply manual topics by default to all participants
Tempate Oct 10, 2023
115d282
Remove Wildcard Topic without name test
Tempate Oct 10, 2023
6096e9f
Simplify the DdsPipe's constructor
Tempate Oct 10, 2023
2912be3
Minor fixes
Tempate Oct 11, 2023
6678aba
Support on_data_available with multiple messages
Tempate Oct 16, 2023
ac8b5b6
Uncrustify
Tempate Oct 17, 2023
61d1a46
Fix compilation in Ubuntu 20.04 debug
Tempate Oct 17, 2023
3b30130
Support manual topics in the dds participant
Tempate Oct 17, 2023
ad4a249
Uncrustify
Tempate Oct 17, 2023
6e3353e
Minor fixes
Tempate Oct 17, 2023
fd7839f
Fix bug customizing a topic in the DdsBridge
Tempate Oct 18, 2023
0bdb91f
Apply suggestions
Tempate Oct 18, 2023
aef399c
Avoid using DdsTopics in the DdsBridge
Tempate Oct 19, 2023
55dc7bc
Minor fixes
Tempate Oct 19, 2023
44fa4c8
Add Topic QoS to the SchemaParticipant
Tempate Oct 19, 2023
268e148
Bugfix copy method
Tempate Oct 19, 2023
2f78320
Uncrustify & Windows fix
Tempate Oct 19, 2023
24e5c49
Allowed topics test
Tempate Oct 19, 2023
7fedb4a
Pack the QoSs in specs on a Topic QoS object
Tempate Oct 20, 2023
3e5a5e0
Fix default Topic QoS variable
Tempate Oct 23, 2023
f4ddf38
Apply suggestions
Tempate Oct 23, 2023
ad29663
Rename max-depth to history-depth
Tempate Oct 23, 2023
9c64eda
Uncrustify
Tempate Oct 23, 2023
ad75b36
Remove test that checks parsing QoS in a DdsTopic
Tempate Oct 23, 2023
3d7e898
Fix compilation in Ubuntu 20.04 debug
Tempate Oct 23, 2023
c72b5ec
Improve test according to suggestion
Tempate Oct 24, 2023
ef730a7
Apply specs TopicQoS over discovery TopicQoS
Tempate Oct 25, 2023
e13ca48
Apply suggestions
Tempate Oct 30, 2023
1f9a662
Apply suggestions
Tempate Nov 2, 2023
b9d2c47
Apply more suggestions
Tempate Nov 6, 2023
0c5fff5
Add missing Windows header
Tempate Nov 7, 2023
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
27 changes: 22 additions & 5 deletions ddspipe_core/include/ddspipe_core/communication/dds/DdsBridge.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include <ddspipe_core/communication/dds/Track.hpp>
#include <ddspipe_core/configuration/RoutesConfiguration.hpp>
#include <ddspipe_core/types/topic/dds/DistributedTopic.hpp>
#include <ddspipe_core/types/topic/filter/ManualTopic.hpp>
#include <ddspipe_core/types/topic/filter/WildcardDdsFilterTopic.hpp>

namespace eprosima {
namespace ddspipe {
Expand Down Expand Up @@ -58,7 +60,8 @@ class DdsBridge : public Bridge
const std::shared_ptr<PayloadPool>& payload_pool,
const std::shared_ptr<utils::SlotThreadPool>& thread_pool,
const RoutesConfiguration& routes_config,
const bool remove_unused_entities);
const bool remove_unused_entities,
const std::vector<core::types::ManualTopic>& manual_topics);

DDSPIPE_CORE_DllAPI
~DdsBridge();
Expand Down Expand Up @@ -124,8 +127,6 @@ class DdsBridge : public Bridge
* If the Participant's IReader doesn't exist, create it.
* If the Participant's Track doesn't exist, create it.
*
* Thread safe
*
* @param writers: The map of ids to writers that are required for the tracks.
*
* @throw InitializationException in case \c IReaders creation fails.
Expand All @@ -140,8 +141,6 @@ class DdsBridge : public Bridge
* If the Participant's IReader doesn't exist, create it.
* If the Participant's Track doesn't exist, create it.
*
* Thread safe
*
* @param writers: The map of ids to writers that are required for the tracks.
*
* @throw InitializationException in case \c IReaders creation fails.
Expand All @@ -150,10 +149,28 @@ class DdsBridge : public Bridge
void add_writers_to_tracks_nts_(
std::map<types::ParticipantId, std::shared_ptr<IWriter>>& writers);

/**
* @brief Impose the Topic QoS that have been pre-configured for a participant.
*
* First, it imposes the Topic QoS configured at \c manual_topics and then the ones configured at \c participants.
*/
DDSPIPE_CORE_DllAPI
utils::Heritable<types::DistributedTopic> create_topic_for_participant_nts_(
const std::shared_ptr<IParticipant>& participant) noexcept;

/////////////////////////
// VARIABLES
/////////////////////////

//! Topic associated to the DdsBridge.
utils::Heritable<types::DistributedTopic> topic_;

//! Routes associated to the Topic.
RoutesConfiguration::RoutesMap routes_;

//! Topics that explicitally set a QoS attribute for this participant.
juanlofer-eprosima marked this conversation as resolved.
Show resolved Hide resolved
std::vector<types::ManualTopic> manual_topics_;

/**
* Inside \c Tracks
* They are indexed by the Id of the participant that is source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <ddspipe_core/configuration/TopicRoutesConfiguration.hpp>
#include <ddspipe_core/types/participant/ParticipantId.hpp>
#include <ddspipe_core/types/topic/dds/DistributedTopic.hpp>
#include <ddspipe_core/types/topic/filter/ManualTopic.hpp>

#include <ddspipe_core/library/library_dll.h>

Expand Down Expand Up @@ -73,10 +74,29 @@ struct DdsPipeConfiguration : public IConfiguration
RoutesConfiguration get_routes_config(
const utils::Heritable<types::DistributedTopic>& topic) const noexcept;

/**
* @brief Select the \c manual_topics for a topic.
*
* @return The manual topics for a specific topic.
*/
DDSPIPE_CORE_DllAPI
std::vector<core::types::ManualTopic> get_manual_topics(
const core::ITopic& topic) const noexcept;

/////////////////////////
// VARIABLES
/////////////////////////

//! Topic lists to build the AllowedTopics
std::set<utils::Heritable<ddspipe::core::types::IFilterTopic>> allowlist{};
std::set<utils::Heritable<ddspipe::core::types::IFilterTopic>> blocklist{};

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

//! Set of manually configured Topic QoS
std::vector<ddspipe::core::types::ManualTopic> manual_topics{};

//! Configuration of the generic routes.
RoutesConfiguration routes{};

Expand All @@ -85,6 +105,9 @@ struct DdsPipeConfiguration : public IConfiguration

//! Whether entities should be removed when they have no writers connected to them.
bool remove_unused_entities = false;

//! Whether the DDS Pipe should be initialized enabled.
bool init_enabled = false;
};

} /* namespace core */
Expand Down
61 changes: 41 additions & 20 deletions ddspipe_core/include/ddspipe_core/core/DdsPipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,11 @@ class DdsPipe
*/
DDSPIPE_CORE_DllAPI
DdsPipe(
const std::shared_ptr<AllowedTopicList>& allowed_topics,
const DdsPipeConfiguration& configuration,
const std::shared_ptr<DiscoveryDatabase>& discovery_database,
const std::shared_ptr<PayloadPool>& payload_pool,
const std::shared_ptr<ParticipantsDatabase>& participants_database,
const std::shared_ptr<utils::SlotThreadPool>& thread_pool,
const std::set<utils::Heritable<types::DistributedTopic>>& builtin_topics = {},
bool start_enable = false,
const DdsPipeConfiguration& configuration = {});
const std::shared_ptr<utils::SlotThreadPool>& thread_pool);

/**
* @brief Destroy the DdsPipe object
Expand All @@ -85,19 +82,21 @@ class DdsPipe
/////////////////////////

/**
* @brief Reload the allowed topic configuration
* @brief Reload the DdsPipe configuration.
*
* @param [in] configuration : new configuration
* @param [in] new_configuration : new configuration.
*
* @return \c RETCODE_OK if configuration has been updated correctly
* @return \c RETCODE_NO_DATA if new configuration has not changed
* @return \c RETCODE_ERROR if any other error has occurred
* @return \c RETCODE_OK if the configuration has been updated correctly.
* @return \c RETCODE_NO_DATA if the new configuration has not changed.
* @return \c RETCODE_ERROR if any other error has occurred.
*
* @throw \c ConfigurationException in case the new yaml is not well-formed
* @note This method checks that the new configuration file is valid and calls \c reload_allowed_topics_
*
* @throw \c ConfigurationException in case the new yaml is not well-formed.
*/
DDSPIPE_CORE_DllAPI
utils::ReturnCode reload_allowed_topics(
const std::shared_ptr<AllowedTopicList>& allowed_topics);
utils::ReturnCode reload_configuration(
const DdsPipeConfiguration& new_configuration);

/////////////////////////
// ENABLING METHODS
Expand Down Expand Up @@ -129,6 +128,28 @@ class DdsPipe

protected:

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

/**
* @brief Reload the allowed topics configuration.
*
* @param [in] allowed_topics : new allowed topics.
*
* @return \c RETCODE_OK if the allowed topics have been updated correctly.
* @return \c RETCODE_NO_DATA if the new allowed topics have not changed.
* @return \c RETCODE_ERROR if any other error has occurred.
*/
utils::ReturnCode reload_allowed_topics_(
const std::shared_ptr<AllowedTopicList>& allowed_topics);

/////////////////////////
// CALLBACK METHODS
/////////////////////////
Expand Down Expand Up @@ -308,6 +329,13 @@ class DdsPipe
*/
void deactivate_all_topics_nts_() noexcept;

//////////////////////////
// CONFIGURATION VARIABLES
//////////////////////////

//! Configuration of the DDS Pipe
DdsPipeConfiguration configuration_;

/////////////////////////
// SHARED DATA STORAGE
/////////////////////////
Expand Down Expand Up @@ -378,13 +406,6 @@ class DdsPipe
* @brief Internal mutex for concurrent calls
*/
mutable std::mutex mutex_;

//////////////////////////
// CONFIGURATION VARIABLES
//////////////////////////

//! Configuration of the DDS Pipe
DdsPipeConfiguration configuration_;
};

} /* namespace core */
Expand Down
17 changes: 8 additions & 9 deletions ddspipe_core/include/ddspipe_core/interface/IParticipant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include <ddspipe_core/interface/IReader.hpp>
#include <ddspipe_core/interface/IWriter.hpp>
#include <ddspipe_core/types/dds/TopicQoS.hpp>
#include <ddspipe_core/types/participant/ParticipantId.hpp>
#include <ddspipe_core/types/topic/Topic.hpp>

Expand Down Expand Up @@ -43,24 +44,22 @@ class IParticipant
DDSPIPE_CORE_DllAPI
virtual ~IParticipant() = default;

/**
* @brief Return the unique identifier of this Participant.
*
* @return This Participant id
*/
//! The Participant's unique identifier.
DDSPIPE_CORE_DllAPI
virtual types::ParticipantId id() const noexcept = 0;

//! Whether this participant is RTPS
//! Whether the Participant is RTPS.
DDSPIPE_CORE_DllAPI
virtual bool is_rtps_kind() const noexcept = 0;

/**
* @brief Whether this Participant requires to connect ist own readers with its own writers.
*/
//! Whether the Participant requires to connect its own readers with its own writers.
DDSPIPE_CORE_DllAPI
virtual bool is_repeater() const noexcept = 0;

//! The Participant's Topic QoS.
DDSPIPE_CORE_DllAPI
virtual types::TopicQoS topic_qos() const noexcept = 0;

/**
* @brief Return a new Writer
*
Expand Down
5 changes: 5 additions & 0 deletions ddspipe_core/include/ddspipe_core/interface/ITopic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <string>

#include <cpp_utils/Formatter.hpp>
#include <cpp_utils/memory/Heritable.hpp>

#include <ddspipe_core/library/library_dll.h>
#include <ddspipe_core/types/topic/TopicInternalTypeDiscriminator.hpp>
Expand Down Expand Up @@ -60,6 +61,10 @@ class ITopic
DDSPIPE_CORE_DllAPI
virtual std::string serialize() const noexcept = 0;

//! Make a copy of the ITopic
DDSPIPE_CORE_DllAPI
virtual utils::Heritable<ITopic> copy() const noexcept = 0;

/**
* This refers to an internal used identifier that declares which kind of data type is going to be
* transmitted in this Itopic inside the core.
Expand Down
Loading
Loading