Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: tempate <danieldiaz@eprosima.com>
  • Loading branch information
Tempate committed Nov 21, 2023
1 parent 648046b commit c3d995f
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 59 deletions.
47 changes: 29 additions & 18 deletions ddsrecorder/src/cpp/tool/DdsRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DiscoveryDatabase>();
Expand All @@ -42,17 +43,17 @@ DdsRecorder::DdsRecorder(
payload_pool_ = std::make_shared<FastPayloadPool>();

// Create Thread Pool
thread_pool_ = std::make_shared<SlotThreadPool>(configuration.n_threads);
thread_pool_ = std::make_shared<SlotThreadPool>(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
{
Expand All @@ -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<participants::McapHandler>(
Expand All @@ -81,22 +82,32 @@ DdsRecorder::DdsRecorder(

// Create DynTypes Participant
dyn_participant_ = std::make_shared<DynTypesParticipant>(
configuration.simple_configuration,
configuration_.simple_configuration,
payload_pool_,
discovery_database_);
dyn_participant_->init();

// Create Recorder Participant
recorder_participant_ = std::make_shared<SchemaParticipant>(
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<DistributedTopic>::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<WildcardDdsFilterTopic>::make_heritable(internal_topic));
}

// Create Participant Database
participants_database_ = std::make_shared<ParticipantsDatabase>();

Expand All @@ -112,7 +123,7 @@ DdsRecorder::DdsRecorder(

// Create DDS Pipe
pipe_ = std::make_unique<DdsPipe>(
configuration.ddspipe_configuration,
configuration_.ddspipe_configuration,
discovery_database_,
payload_pool_,
participants_database_,
Expand Down
5 changes: 4 additions & 1 deletion ddsrecorder/src/cpp/tool/DdsRecorder.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "");

Expand Down Expand Up @@ -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<ddspipe::core::PayloadPool> payload_pool_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<IReader> ReplayerParticipant::create_reader(
Expand Down
6 changes: 0 additions & 6 deletions ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,6 @@ void RecorderConfiguration::load_dds_configuration_(
{
ddspipe_configuration.allowlist = YamlReader::get_set<utils::Heritable<IFilterTopic>>(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<WildcardDdsFilterTopic>::make_heritable(internal_topic));
}

/////
Expand Down
4 changes: 0 additions & 4 deletions ddsreplayer/src/cpp/tool/DdsReplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DistributedTopic>::make_heritable(type_object_topic()));

// Create DDS Pipe
pipe_ = std::make_unique<DdsPipe>(
configuration.ddspipe_configuration,
Expand Down
25 changes: 12 additions & 13 deletions docs/rst/recording/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<DataReader>` to record the data published on each topic.
Expand Down Expand Up @@ -213,18 +224,6 @@ If a ``qos`` is not manually configured, it will get its value by discovery.

The :ref:`Topic QoS <recorder_topic_qos>` configured in the Manual Topics take precedence over the :ref:`Specs Topic QoS <recorder_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
Expand Down
26 changes: 13 additions & 13 deletions docs/rst/replaying/usage/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<DataWriter>` to replay the data published on each topic.
Expand Down Expand Up @@ -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:

Expand All @@ -182,17 +193,6 @@ If a ``qos`` is not manually configured, it will get its value by discovery.

The :ref:`Topic QoS <replayer_topic_qos>` configured in the Manual Topics take precedence over the :ref:`Specs Topic QoS <replayer_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:

Expand Down

0 comments on commit c3d995f

Please sign in to comment.