3. Configuration¶
3.1. DDS Recorder Configuration¶
A DDS Recorder is configured by a .yaml configuration file. This .yaml file contains all the information regarding the DDS interface configuration, recording parameters, and DDS Recorder specifications. Thus, this file has four major configuration groups:
dds
: configuration related to DDS communication.recorder
: configuration of data writing in the database.remote-controller
: configuration of the remote controller of the DDS Recorder.specs
: configuration of the internal operation of the DDS Recorder.
3.1.1. DDS Configuration¶
Configuration related to DDS communication.
3.1.1.2. Built-in Topics¶
The discovery phase can be accelerated by listing topics under the builtin-topics
tag.
The DDS Recorder will create the DataWriters and DataReaders for these topics in the DDS Recorder initialization.
The Topic QoS for these topics can be manually configured with the Manual Topic and with the Specs Topic QoS; if a Topic QoS is not configured, it will take its default value.
The builtin-topics
must specify a name
and type
without wildcard characters.
Example of usage:
builtin-topics: - name: HelloWorldTopic type: HelloWorld
3.1.1.3. Topic Filtering¶
The DDS Recorder automatically detects the topics that are being used in a DDS Network.
The DDS Recorder then creates internal DDS Readers to record the data published on each topic.
The DDS Recorder allows filtering DDS Topics to allow users to configure the DDS Topics that must be recorded.
These data filtering rules can be configured under the allowlist
and blocklist
tags.
If the allowlist
and blocklist
are not configured, the DDS Recorder will recorded the data published on every topic it discovers.
If both the allowlist
and blocklist
are configured and a topic appears in both of them, the blocklist
has priority and the topic will be blocked.
Topics are determined by the tags name
(required) and type
, both of which accept wildcard characters.
Note
Placing quotation marks around values in a YAML file is generally optional, but values containing wildcard characters do require single or double quotation marks.
Consider the following example:
allowlist:
- name: AllowedTopic1
type: Allowed
- name: AllowedTopic2
type: "*"
- name: HelloWorldTopic
type: HelloWorld
blocklist:
- name: "*"
type: HelloWorld
In this example, the data published in the topic AllowedTopic1
with type Allowed
and in the topic AllowedTopic2
with any type will be recorded by the DDS Recorder.
The data published in the topic HelloWorldTopic
with type HelloWorld
will be blocked, since the blocklist
is blocking all topics with any name and with type HelloWorld
.
3.1.1.4. Topic QoS¶
The following is the set of QoS that are configurable for a topic. For more information on topics, please read the Fast DDS Topic section.
Quality of Service |
Yaml tag |
Data type |
Default value |
QoS set |
---|---|---|---|---|
Reliability |
|
bool |
|
|
Durability |
|
bool |
|
|
Ownership |
|
bool |
|
|
Partitions |
|
bool |
|
Topic with / without partitions |
Key |
|
bool |
|
Topic with / without key |
History Depth |
|
unsigned integer |
|
|
Max Reception Rate |
|
float |
|
|
Downsampling |
|
unsigned integer |
|
Warning
Manually configuring TRANSIENT_LOCAL
durability may lead to incompatibility issues when the discovered reliability is BEST_EFFORT
.
Please ensure to always configure the reliability
when configuring the durability
to avoid the issue.
3.1.1.4.1. History Depth¶
The history-depth
tag configures the history depth of the Fast DDS internal entities.
By default, the depth of every RTPS History instance is 5000
, which sets a constraint on the maximum number of samples a DDS Recorder instance can deliver to late joiner Readers configured with TRANSIENT_LOCAL
DurabilityQosPolicyKind.
Its value should be decreased when the sample size and/or number of created endpoints (increasing with the number of topics) are big enough to cause memory exhaustion issues.
If enough memory is available, however, the history-depth
could be increased to deliver a greater number of samples to late joiners.
3.1.1.4.2. Max Reception Rate¶
The max-rx-rate
tag limits the frequency [Hz] at which samples are processed by discarding messages received before 1/max-rx-rate
seconds have passed since the last processed message.
It only accepts non-negative numbers.
By default it is set to 0
; it processes samples at an unlimited reception rate.
3.1.1.4.3. Downsampling¶
The downsampling
tag reduces the sampling rate of the received data by only keeping 1 out of every n samples received (per topic), where n is the value specified under the downsampling
tag.
When the max-rx-rate
tag is also set, downsampling only applies to messages that have passed the max-rx-rate
filter.
It only accepts positive integers.
By default it is set to 1
; it accepts every message.
3.1.1.5. Manual Topics¶
A subset of Topic QoS can be manually configured for a specific topic under the tag topics
.
The tag topics
has a required name
tag that accepts wildcard characters.
It also has two optional tags: a type
tag that accepts wildcard characters, and a qos
tag with the Topic QoS that the user wants to manually configure.
If a qos
is not manually configured, it will get its value by discovery.
topics:
- name: "temperature/*"
type: "temperature/types/*"
qos:
max-rx-rate: 15
downsampling: 2
Note
The Topic QoS configured in the Manual Topics take precedence over the Specs Topic QoS.
3.1.1.6. Ignore Participant Flags¶
A set of discovery traffic filters can be defined in order to add an extra level of isolation.
This configuration option can be set through the ignore-participant-flags
tag:
ignore-participant-flags: no_filter # No filter (default)
# or
ignore-participant-flags: filter_different_host # Discovery traffic from another host is discarded
# or
ignore-participant-flags: filter_different_process # Discovery traffic from another process on same host is discarded
# or
ignore-participant-flags: filter_same_process # Discovery traffic from own process is discarded
# or
ignore-participant-flags: filter_different_and_same_process # Discovery traffic from own host is discarded
See Ignore Participant Flags for more information.
3.1.1.7. Custom Transport Descriptors¶
By default, DDS Recorder internal participants are created with enabled UDP and Shared Memory transport descriptors.
The use of one or the other for communication will depend on the specific scenario, and whenever both are viable candidates, the most efficient one (Shared Memory Transport) is automatically selected.
However, a user may desire to force the use of one of the two, which can be accomplished via the transport
configuration tag.
transport: builtin # UDP & SHM (default)
# or
transport: udp # UDP only
# or
transport: shm # SHM only
Warning
When configured with transport: shm
, DDS Recorder will only communicate with applications using Shared Memory Transport exclusively (with disabled UDP transport).
3.1.1.8. Interface Whitelist¶
Optional tag whitelist-interfaces
allows to limit the network interfaces used by UDP and TCP transport.
This may be useful to only allow communication within the host (note: same can be done with Ignore Participant Flags).
Example:
whitelist-interfaces:
- "127.0.0.1" # Localhost only
See Interface Whitelist for more information.
3.1.2. Recorder Configuration¶
Configuration of data writing in the database.
3.1.2.1. Output File¶
The recorder output file does support the following configuration settings under the output
tag:
Parameter |
Tag |
Description |
Data type |
Default value |
---|---|---|---|---|
File path |
|
Configure the path to save the output file. |
|
|
File name |
|
Configure the name of the output file. |
|
|
Timestamp format |
|
Configure the format of the output file |
|
|
Local timestamp |
|
Whether to use a local or global (GMT) |
|
|
Safety margin |
|
Configure safety margin (bytes) used |
|
|
Resource limits |
|
|
|
When DDS Recorder application is launched (or when remotely controlled, every time a start/pause
command is received while in SUSPENDED/STOPPED
state), a temporary file with filename
name (+timestamp prefix) and .mcap.tmp~
extension is created in path
.
This file is not readable until the application terminates, receives a suspend/stop/close
command, or the file reaches its maximum size (see Resource Limits).
On such event, the temporal file is renamed to have .mcap
extension in the same location, and is then ready to be processed.
3.1.2.1.1. Resource Limits¶
The resource-limits
tag allows users to limit the size of the DDS Recorder’s output.
The max-file-size
tag specifies the maximum size of each output file and the max-size
tag specifies the maximum aggregate size of all output files.
If the max-size
is higher than the max-file-size
, the DDS Recorder will create multiple files with a maximum size of max-file-size
.
By default, however, the max-file-size
is unlimited (0B
) and the max-size
is the same as the max-file-size
; that is, by default the DDS Recorder creates a single file of unlimited size.
Warning
If the max-file-size
or the max-size
are set to a value lower than the available space in the disk, the DDS Recorder will replace them with the available space in the disk.
To keep the DDS Recorder recording after reaching the max-size
, users can set the file-rotation
tag to true
.
Enabling file-rotation
allows the DDS Recorder to overwrite old files to free space for new ones.
Note
To keep the DDS Recorder from overwriting previous output files, users can set {"avoid_overwriting_output": true}
as the argument ("args"
) of the stop
command (see Control Commands).
If set, the DDS Recorder will not overwrite its output files, at the cost of possibly exceeding the max-size
.
Note
If an output file is moved, deleted, or renamed, the DDS Recorder will keep the size of the file reserved and rotate between the remaining files.
Example of usage
resource-limits:
max-file-size: 250KB
max-size: 2MiB
file-rotation: true
3.1.2.2. Buffer size¶
buffer-size
indicates the number of samples to be stored in the process memory before the dump to disk.
This avoids disk access each time a sample is received.
By default, its value is set to 100
.
3.1.2.3. Event Window¶
DDS Recorder can be configured to continue saving data when it is in paused mode.
Thus, when an event is triggered from the remote controller, samples received in the last event-window
seconds are stored in the database.
In other words, the event-window
acts as a sliding time window that allows to save the collected samples in this time window only when the remote controller event is received.
By default, its value is set to 20
seconds.
3.1.2.4. Log Publish Time¶
By default (log-publish-time: false
) received messages are stored in the MCAP file with logTime
value equals to the reception timestamp.
Additionally, the timestamp corresponding to when messages were initially published (publishTime
) is also included in the information dumped to MCAP files.
In some applications, it may be required to use the publishTime
as logTime
, which can be achieved by providing the log-publish-time: true
configuration option.
3.1.2.5. Only With Type¶
By default, all (allowed) received messages are recorded regardless of whether their associated type information has been received.
However, a user can enforce that only samples whose type is received are recorded by setting only-with-type: true
.
3.1.2.6. Compression¶
Compression settings for writing to an MCAP file can be specified under the compression
configuration tag.
The supported compression options are:
Parameter |
Tag |
Description |
Data type |
Default value |
Possible values |
---|---|---|---|---|---|
Compression Algorithm |
|
Compression algorithm to |
|
|
|
Compression Level |
|
Compression level to use |
|
|
|
Force Compression |
|
Force compression on all |
|
|
|
3.1.2.7. Record Types¶
By default, all type information received during execution is stored in a dedicated MCAP file section.
This information is then leveraged by DDS Replayer on playback, publishing recorded types in addition to data samples, which may be required for receiver applications relying on Dynamic Types (see Replay Types).
However, a user may choose to disable this feature by setting record-types: false
.
3.1.2.8. Topic type format¶
The optional ros2-types
tag enables specification of the format for storing schemas.
When set to true
, schemas are stored in ROS 2 message format (.msg).
If set to false
, schemas are stored in OMG IDL format (.idl).
By default it is set to false
.
3.1.3. Remote Controller¶
Configuration of the DDS remote control system. Please refer to Remote Control for further information on how to use DDS Recorder remotely. The supported configurations are:
Parameter |
Tag |
Description |
Data type |
Default value |
Possible values |
---|---|---|---|---|---|
Enable |
|
Enable DDS remote |
|
|
|
DDS Domain |
|
DDS Domain of the |
|
DDS domain being |
From |
Initial state |
|
Initial state of |
|
|
|
Command Topic Name |
|
Name of Controller |
|
|
|
Status Topic Name |
|
Name of Controller |
|
|
3.1.4. Specs Configuration¶
The internals of a DDS Recorder can be configured using the specs
optional tag that contains certain options related with the overall configuration of the DDS Recorder instance to run.
The values available to configure are:
3.1.4.1. Number of Threads¶
specs
supports a threads
optional value that allows the user to set a maximum number of threads for the internal ThreadPool
.
This ThreadPool allows to limit the number of threads spawned by the application.
This improves the performance of the internal data communications.
This value should be set by each user depending on each system characteristics.
In case this value is not set, the default number of threads used is 12
.
3.1.4.2. Maximum Number of Pending Samples¶
It is possible that a DDS Recorder starts receiving data from a topic that it has not yet registered, i.e. a topic for which it does not know the data type. In this case, messages are kept in an internal circular buffer until their associated type information is received, event on which they are written to disk.
However, the recorder execution might end before this event ever occurs. Depending on configuration (see Only With Type), messages kept in the pending samples buffer will be stored or not on closure. Hence, note that memory consumption would continuously grow whenever a sample with unknown type information is received.
To avoid the exhaustion of memory resources in such scenarios, a configuration option is provided which lets the user set a limit on memory usage.
The max-pending-samples
parameter allows to configure the size of the aforementioned circular buffers for each topic that is discovered.
The default value is equal to 5000
samples, with -1
meaning no limit, and 0
no pending samples.
Depending on the combination of this configuration option and the value of only-with-type
, the following situations may arise when a message with unknown type is received:
If
max-pending-samples
is-1
, or if it is greater than0
and the circular buffer is not full, the sample is added to the collection.If
max-pending-samples
is greater than0
and the circular buffer reaches its maximum capacity, the oldest sample with same type as the received one is popped, and either written without type (only-with-type: false
) or discarded (only-with-type: true
).If
max-pending-samples
is0
, the message is written without type ifonly-with-type: false
, and discarded otherwise.
3.1.4.3. Cleanup Period¶
As explained in Event Window, a DDS Recorder in paused mode awaits for an event command to write in disk all samples received in the last event-window
seconds.
To accomplish this, received samples are stored in memory until the aforementioned event is triggered and, in order to limit memory consumption, outdated (received more than event-window
seconds ago) samples are removed from this buffer every cleanup-period
seconds.
By default, its value is equal to twice the event-window
.
3.1.4.4. QoS¶
specs
supports a qos
optional tag to configure the default values of the Topic QoS.
Note
The Topic QoS configured in specs
can be overwritten by the Manual Topics.
3.1.4.5. Logging¶
specs
supports a logging
optional tag to configure the DDS Recorder logs.
Under the logging
tag, users can configure the type of logs to display and filter the logs based on their content and category.
When configuring the verbosity to info
, all types of logs, including informational messages, warnings, and errors, will be displayed.
Conversely, setting it to warning
will only show warnings and errors, while choosing error
will exclusively display errors.
By default, the filter allows all errors to be displayed, while selectively permitting warning and informational messages from DDSRECORDER
category.
Note
Configuring the logs via the Command-Line is still active and takes precedence over YAML configuration when both methods are used simultaneously.
Logging |
Yaml tag |
Description |
Data type |
Default value |
Possible values |
---|---|---|---|---|---|
Verbosity |
|
Show messages of equal |
enum |
|
|
Filter |
|
Regex to filter the category |
string |
info : |
Regex string |
Note
For the logs to function properly, the -DLOG_INFO=ON
compilation flag is required.
The DDS Recorder prints the logs by default (warnings and errors in the standard error and info traces in the standard output).
The DDS Recorder, however, can also publish the logs in a DDS topic.
To publish the logs, under the tag publish
, set enable: true
and set a domain
and a topic-name
.
The type of the logs published is defined as follows:
LogEntry.idl
const long UNDEFINED = 0x10000000;
const long SAMPLE_LOST = 0x10000001;
const long TOPIC_MISMATCH_TYPE = 0x10000002;
const long TOPIC_MISMATCH_QOS = 0x10000003;
const long FAIL_MCAP_CREATION = 0x12000001;
const long FAIL_MCAP_WRITE = 0x12000002;
enum Kind {
Info,
Warning,
Error
};
struct LogEntry {
@key long event;
Kind kind;
string category;
string message;
string timestamp;
};
Example of usage
logging:
verbosity: info
filter:
error: "DDSPIPE|DDSRECORDER"
warning: "DDSPIPE|DDSRECORDER"
info: "DDSRECORDER"
publish:
enable: true
domain: 84
topic-name: "DdsRecorderLogs"
stdout: true
3.1.4.6. Monitor¶
specs
supports a monitor
optional tag to publish internal data from the DDS Recorder.
If the monitor is enabled, it publishes (and logs under the MONITOR_DATA
log filter) the DDS Recorder’s internal data on a domain
, under a topic-name
, once every period
(in milliseconds).
If the monitor is not enabled, the DDS Recorder will not collect or publish any data.
Note
The data published is relative to each period. The DDS Recorder will reset its tracked data after publishing it.
In particular, the DDS Recorder can monitor its internal status and its topics. When monitoring its internal status, the DDS Recorder will track different errors of the DDS Recorder. The type of the data published is defined as follows:
DdsRecorderMonitoringStatus.idl
struct MonitoringErrorStatus {
boolean type_mismatch;
boolean qos_mismatch;
};
struct MonitoringStatus {
MonitoringErrorStatus error_status;
boolean has_errors;
};
struct DdsRecorderMonitoringErrorStatus {
boolean mcap_file_creation_failure;
boolean disk_full;
};
struct DdsRecorderMonitoringStatus : MonitoringStatus {
DdsRecorderMonitoringErrorStatus ddsrecorder_error_status;
};
When monitoring its topics, the DDS Recorder will track the number of messages lost, received, and the message reception rate [Hz] of each topic. It will also track if a topic’s type is discovered, if there is a type mismatch, and if there is a QoS mismatch. The type of the data published is defined as follows:
MonitoringTopics.idl
struct DdsTopicData
{
string participant_id;
unsigned long msgs_lost;
unsigned long msgs_received;
double msg_rx_rate;
};
struct DdsTopic
{
string name;
string type_name;
boolean type_discovered;
boolean type_mismatch;
boolean qos_mismatch;
sequence<DdsTopicData> data;
};
struct MonitoringTopics
{
sequence<DdsTopic> topics;
};
Example of usage
monitor:
domain: 10
status:
enable: true
domain: 11
period: 2000
topic-name: "DdsRecorderStatus"
topics:
enable: true
domain: 12
period: 1500
topic-name: "DdsRecorderTopics"
3.1.5. General Example¶
A complete example of all the configurations described on this page can be found below.
Warning
This example can be used as a quick reference, but it may not be correct due to incompatibility or exclusive properties. Do not take it as a working example.
dds:
domain: 0
allowlist:
- name: "topic_name"
type: "topic_type"
blocklist:
- name: "topic_name"
type: "topic_type"
builtin-topics:
- name: "HelloWorldTopic"
type: "HelloWorld"
topics:
- name: "temperature/*"
type: "temperature/types/*"
qos:
max-rx-rate: 15
downsampling: 2
ignore-participant-flags: no_filter
transport: builtin
whitelist-interfaces:
- "127.0.0.1"
recorder:
output:
filename: "output"
path: "."
timestamp-format: "%Y-%m-%d_%H-%M-%S_%Z"
local-timestamp: false
safety-margin: 500
resource-limits:
max-file-size: 250KB
max-size: 2MiB
file-rotation: true
buffer-size: 50
event-window: 60
log-publish-time: false
only-with-type: false
compression:
algorithm: lz4
level: slowest
force: true
record-types: true
ros2-types: false
remote-controller:
enable: true
domain: 10
initial-state: "PAUSED"
command-topic-name: "/ddsrecorder/command"
status-topic-name: "/ddsrecorder/status"
specs:
threads: 8
max-pending-samples: 10
cleanup-period: 90
qos:
max-rx-rate: 20
downsampling: 3
logging:
verbosity: info
filter:
error: "DDSPIPE|DDSRECORDER"
warning: "DDSPIPE|DDSRECORDER"
info: "DDSRECORDER"
publish:
enable: true
domain: 84
topic-name: "DdsRecorderLogs"
stdout: true
monitor:
domain: 10
topics:
enable: true
domain: 11
period: 1000
topic-name: "DdsRecorderTopics"
status:
enable: true
domain: 12
period: 2000
topic-name: "DdsRecorderStatus"
3.2. Fast DDS Configuration¶
DDS Recorder instance stores (by default) all data regardless of whether their associated data type is received or not. Some applications rely on this information being recorded and written in the resulting MCAP file, which requires that the user application is configured to send the necessary type information. By default, Fast DDS automatically sends the data type information, so no additional configuration is required.
Feel free to review this section, where it is explained in detail how to configure a Fast DDS Publisher/Subscriber leveraging Dynamic Types.