From c3d995f1679922dd6ab7495a8b0f7e0ea03ada58 Mon Sep 17 00:00:00 2001 From: tempate Date: Tue, 21 Nov 2023 08:33:36 +0100 Subject: [PATCH] Apply suggestions Signed-off-by: tempate --- ddsrecorder/src/cpp/tool/DdsRecorder.cpp | 47 ++++++++++++------- ddsrecorder/src/cpp/tool/DdsRecorder.hpp | 5 +- .../src/cpp/replayer/ReplayerParticipant.cpp | 4 -- .../cpp/recorder/YamlReaderConfiguration.cpp | 6 --- ddsreplayer/src/cpp/tool/DdsReplayer.cpp | 4 -- docs/rst/recording/usage/configuration.rst | 25 +++++----- docs/rst/replaying/usage/configuration.rst | 26 +++++----- 7 files changed, 58 insertions(+), 59 deletions(-) diff --git a/ddsrecorder/src/cpp/tool/DdsRecorder.cpp b/ddsrecorder/src/cpp/tool/DdsRecorder.cpp index 16750fc27..0139e825c 100644 --- a/ddsrecorder/src/cpp/tool/DdsRecorder.cpp +++ b/ddsrecorder/src/cpp/tool/DdsRecorder.cpp @@ -31,9 +31,10 @@ using namespace eprosima::ddsrecorder::participants; using namespace eprosima::utils; DdsRecorder::DdsRecorder( - yaml::RecorderConfiguration& configuration, + const yaml::RecorderConfiguration& configuration, const DdsRecorderStateCode& init_state, const std::string& file_name) + : configuration_(configuration) { // Create Discovery Database discovery_database_ = std::make_shared(); @@ -42,17 +43,17 @@ DdsRecorder::DdsRecorder( payload_pool_ = std::make_shared(); // Create Thread Pool - thread_pool_ = std::make_shared(configuration.n_threads); + thread_pool_ = std::make_shared(configuration_.n_threads); // Fill MCAP output file settings participants::McapOutputSettings mcap_output_settings; if (file_name == "") { - mcap_output_settings.output_filename = configuration.output_filename; - mcap_output_settings.output_filepath = configuration.output_filepath; + mcap_output_settings.output_filename = configuration_.output_filename; + mcap_output_settings.output_filepath = configuration_.output_filepath; mcap_output_settings.prepend_timestamp = true; - mcap_output_settings.output_timestamp_format = configuration.output_timestamp_format; - mcap_output_settings.output_local_timestamp = configuration.output_local_timestamp; + mcap_output_settings.output_timestamp_format = configuration_.output_timestamp_format; + mcap_output_settings.output_local_timestamp = configuration_.output_local_timestamp; } else { @@ -64,14 +65,14 @@ DdsRecorder::DdsRecorder( // Create MCAP Handler configuration participants::McapHandlerConfiguration handler_config( mcap_output_settings, - configuration.max_pending_samples, - configuration.buffer_size, - configuration.event_window, - configuration.cleanup_period, - configuration.log_publish_time, - configuration.only_with_type, - configuration.mcap_writer_options, - configuration.record_types); + configuration_.max_pending_samples, + configuration_.buffer_size, + configuration_.event_window, + configuration_.cleanup_period, + configuration_.log_publish_time, + configuration_.only_with_type, + configuration_.mcap_writer_options, + configuration_.record_types); // Create MCAP Handler mcap_handler_ = std::make_shared( @@ -81,22 +82,32 @@ DdsRecorder::DdsRecorder( // Create DynTypes Participant dyn_participant_ = std::make_shared( - configuration.simple_configuration, + configuration_.simple_configuration, payload_pool_, discovery_database_); dyn_participant_->init(); // Create Recorder Participant recorder_participant_ = std::make_shared( - configuration.recorder_configuration, + configuration_.recorder_configuration, payload_pool_, discovery_database_, mcap_handler_); // Create an internal topic to transmit the dynamic types - configuration.ddspipe_configuration.builtin_topics.insert( + configuration_.ddspipe_configuration.builtin_topics.insert( utils::Heritable::make_heritable(type_object_topic())); + if (!configuration_.ddspipe_configuration.allowlist.empty()) + { + // The allowlist is not empty. Add the internal topic. + WildcardDdsFilterTopic internal_topic; + internal_topic.topic_name.set_value(TYPE_OBJECT_TOPIC_NAME); + + configuration_.ddspipe_configuration.allowlist.insert( + utils::Heritable::make_heritable(internal_topic)); + } + // Create Participant Database participants_database_ = std::make_shared(); @@ -112,7 +123,7 @@ DdsRecorder::DdsRecorder( // Create DDS Pipe pipe_ = std::make_unique( - configuration.ddspipe_configuration, + configuration_.ddspipe_configuration, discovery_database_, payload_pool_, participants_database_, diff --git a/ddsrecorder/src/cpp/tool/DdsRecorder.hpp b/ddsrecorder/src/cpp/tool/DdsRecorder.hpp index 6392b2a89..0efa7cb4a 100644 --- a/ddsrecorder/src/cpp/tool/DdsRecorder.hpp +++ b/ddsrecorder/src/cpp/tool/DdsRecorder.hpp @@ -65,7 +65,7 @@ class DdsRecorder * @param file_name: Name of the mcap file where data is recorded. If not provided, the one from configuration is used instead. */ DdsRecorder( - yaml::RecorderConfiguration& configuration, + const yaml::RecorderConfiguration& configuration, const DdsRecorderStateCode& init_state, const std::string& file_name = ""); @@ -100,6 +100,9 @@ class DdsRecorder static participants::McapHandlerStateCode recorder_to_handler_state_( const DdsRecorderStateCode& recorder_state); + //! Configuration of the DDS Recorder + yaml::RecorderConfiguration configuration_; + //! Payload Pool std::shared_ptr payload_pool_; diff --git a/ddsrecorder_participants/src/cpp/replayer/ReplayerParticipant.cpp b/ddsrecorder_participants/src/cpp/replayer/ReplayerParticipant.cpp index 3e1fa10d7..e678f445b 100644 --- a/ddsrecorder_participants/src/cpp/replayer/ReplayerParticipant.cpp +++ b/ddsrecorder_participants/src/cpp/replayer/ReplayerParticipant.cpp @@ -33,10 +33,6 @@ ReplayerParticipant::ReplayerParticipant( payload_pool, discovery_database) { - // Delete endpoint discovery/removal callbacks inserted in DDS-Pipe core. - // This is to avoid the creation of useless bridges and tracks created when discovering endpoints in topics other - // than the ones present in MCAP. - discovery_database_->clear_all_callbacks(); } std::shared_ptr ReplayerParticipant::create_reader( diff --git a/ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp b/ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp index 3e235915a..42d972435 100644 --- a/ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp +++ b/ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp @@ -356,12 +356,6 @@ void RecorderConfiguration::load_dds_configuration_( { ddspipe_configuration.allowlist = YamlReader::get_set>(yml, ALLOWLIST_TAG, version); - - // Add to allowlist always the type object topic - WildcardDdsFilterTopic internal_topic; - internal_topic.topic_name.set_value(TYPE_OBJECT_TOPIC_NAME); - ddspipe_configuration.allowlist.insert( - utils::Heritable::make_heritable(internal_topic)); } ///// diff --git a/ddsreplayer/src/cpp/tool/DdsReplayer.cpp b/ddsreplayer/src/cpp/tool/DdsReplayer.cpp index b09c69b9c..6a1e206ab 100644 --- a/ddsreplayer/src/cpp/tool/DdsReplayer.cpp +++ b/ddsreplayer/src/cpp/tool/DdsReplayer.cpp @@ -127,10 +127,6 @@ DdsReplayer::DdsReplayer( // Generate builtin-topics from the topics in the MCAP file configuration.ddspipe_configuration.builtin_topics = generate_builtin_topics_(configuration, input_file); - // Create an internal topic to transmit the dynamic types - configuration.ddspipe_configuration.builtin_topics.insert( - utils::Heritable::make_heritable(type_object_topic())); - // Create DDS Pipe pipe_ = std::make_unique( configuration.ddspipe_configuration, diff --git a/docs/rst/recording/usage/configuration.rst b/docs/rst/recording/usage/configuration.rst index 37abdf448..f244a8e48 100644 --- a/docs/rst/recording/usage/configuration.rst +++ b/docs/rst/recording/usage/configuration.rst @@ -33,6 +33,17 @@ DDS Configuration Configuration related to DDS communication. +.. _recorder_usage_configuration_domain_id: + +DDS Domain +^^^^^^^^^^ + +Tag ``domain`` configures the :term:`Domain Id`. + +.. code-block:: yaml + + domain: 101 + .. _recorder_builtin_topics: Built-in Topics @@ -55,7 +66,7 @@ The ``builtin-topics`` must specify a ``name`` and ``type`` without wildcard cha .. _recorder_topic_filtering: Topic Filtering ---------------- +^^^^^^^^^^^^^^^ The |ddsrecorder| automatically detects the topics that are being used in a DDS Network. The |ddsrecorder| then creates internal DDS :term:`Readers` to record the data published on each topic. @@ -213,18 +224,6 @@ If a ``qos`` is not manually configured, it will get its value by discovery. The :ref:`Topic QoS ` configured in the Manual Topics take precedence over the :ref:`Specs Topic QoS `. -.. _recorder_usage_configuration_domain_id: - -DDS Domain -^^^^^^^^^^ - -Tag ``domain`` configures the :term:`Domain Id`. - -.. code-block:: yaml - - domain: 101 - - .. _recorder_ignore_participant_flags: Ignore Participant Flags diff --git a/docs/rst/replaying/usage/configuration.rst b/docs/rst/replaying/usage/configuration.rst index 799a5f23b..a0eda18fc 100644 --- a/docs/rst/replaying/usage/configuration.rst +++ b/docs/rst/replaying/usage/configuration.rst @@ -32,10 +32,21 @@ DDS Configuration Configuration related to DDS communication. +.. _replayer_usage_configuration_domain_id: + +DDS Domain +^^^^^^^^^^ + +Tag ``domain`` configures the :term:`Domain Id`. + +.. code-block:: yaml + + domain: 101 + .. _replayer_topic_filtering: Topic Filtering ---------------- +^^^^^^^^^^^^^^^ The |ddsreplayer| automatically detects the topics that are being used in a DDS Network. The |ddsreplayer| then creates internal DDS :term:`Writers` to replay the data published on each topic. @@ -156,7 +167,7 @@ By default it is set to ``0``; it sends samples at an unlimited transmission rat .. note:: - The ``max-tx-rate`` tag can be set (in order of precedence) for topics, for participants, and globally in specs. + The ``max-tx-rate`` tag can be set (in order of precedence) for topics and globally in specs. .. _replayer_manual_topics: @@ -182,17 +193,6 @@ If a ``qos`` is not manually configured, it will get its value by discovery. The :ref:`Topic QoS ` configured in the Manual Topics take precedence over the :ref:`Specs Topic QoS `. -.. _replayer_usage_configuration_domain_id: - -DDS Domain -^^^^^^^^^^ - -Tag ``domain`` configures the :term:`Domain Id`. - -.. code-block:: yaml - - domain: 101 - .. _replayer_ignore_participant_flags: