Skip to content

Conversation

@ottojo
Copy link
Contributor

@ottojo ottojo commented May 19, 2024

this was changed in #1480, see issue #1660

@ottojo ottojo requested a review from a team as a code owner May 19, 2024 17:23
@ottojo ottojo requested review from gbiggs and jhdcs and removed request for a team May 19, 2024 17:23
@ottojo ottojo force-pushed the fix-example-convert-configs branch from 442781e to 2fc2605 Compare May 19, 2024 17:24
Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good eye! lgtm.

@MichaelOrlov @Barry-Xu-2018 this actually breaks the user configuration as reported. i will go through the documentation again.

@Barry-Xu-2018
Copy link
Contributor

The RecordOptions has already been changed quite a bit.
Refer to the code below.

bool convert<rosbag2_transport::RecordOptions>::decode(
const Node & node, rosbag2_transport::RecordOptions & record_options, int version)
{
optional_assign<bool>(node, "all_topics", record_options.all_topics);
optional_assign<bool>(node, "all_services", record_options.all_services);
optional_assign<bool>(node, "is_discovery_disabled", record_options.is_discovery_disabled);
optional_assign<std::vector<std::string>>(node, "topics", record_options.topics);
optional_assign<std::vector<std::string>>(node, "topic_types", record_options.topic_types);
optional_assign<std::vector<std::string>>(node, "services", record_options.services);
optional_assign<std::string>(
node, "rmw_serialization_format", record_options.rmw_serialization_format);
optional_assign<std::chrono::milliseconds>(
node, "topic_polling_interval", record_options.topic_polling_interval);
optional_assign<std::string>(node, "regex", record_options.regex);
optional_assign<std::string>(node, "exclude_regex", record_options.exclude_regex);
optional_assign<std::vector<std::string>>(node, "exclude_topics", record_options.exclude_topics);
optional_assign<std::vector<std::string>>(
node, "exclude_topic_types",
record_options.exclude_topic_types);
optional_assign<std::vector<std::string>>(
node, "exclude_services", record_options.exclude_service_events);
optional_assign<std::string>(node, "node_prefix", record_options.node_prefix);
optional_assign<std::string>(node, "compression_mode", record_options.compression_mode);
optional_assign<std::string>(node, "compression_format", record_options.compression_format);
optional_assign<uint64_t>(node, "compression_queue_size", record_options.compression_queue_size);
optional_assign<uint64_t>(node, "compression_threads", record_options.compression_threads);
optional_assign<int32_t>(
node, "compression_threads_priority",
record_options.compression_threads_priority);
std::unordered_map<std::string, rclcpp::QoS> qos_overrides;
if (node["topic_qos_profile_overrides"]) {
qos_overrides = YAML::decode_for_version<std::unordered_map<std::string, rclcpp::QoS>>(
node["topic_qos_profile_overrides"], version);
}
record_options.topic_qos_profile_overrides = qos_overrides;
optional_assign<bool>(node, "include_hidden_topics", record_options.include_hidden_topics);
optional_assign<bool>(
node, "include_unpublished_topics",
record_options.include_unpublished_topics);
optional_assign<bool>(
node, "disable_keyboard_controls",
record_options.disable_keyboard_controls);

The current README.md only mentions part of it. Is it necessary to point to the relevant code, so users know what can be configured ? @fujitatomoya @MichaelOrlov

rosbag2/README.md

Lines 221 to 240 in 5a06430

```
output_bags:
- uri: /output/bag1 # required
storage_id: "" # will use the default storage plugin, if unspecified
max_bagfile_size: 0
max_bagfile_duration: 0
storage_preset_profile: ""
storage_config_uri: ""
all: false
topics: []
rmw_serialization_format: "" # defaults to using the format of the input topic
regex: ""
exclude: ""
compression_mode: ""
compression_format: ""
compression_queue_size: 1
compression_threads: 0
include_hidden_topics: false
include_unpublished_topics: false
```

@Barry-Xu-2018
Copy link
Contributor

@ottojo

Additionally. exclude should be changed to exclude_regex.
Please refer to

bool convert<rosbag2_transport::RecordOptions>::decode(
const Node & node, rosbag2_transport::RecordOptions & record_options, int version)
{
optional_assign<bool>(node, "all_topics", record_options.all_topics);
optional_assign<bool>(node, "all_services", record_options.all_services);
optional_assign<bool>(node, "is_discovery_disabled", record_options.is_discovery_disabled);
optional_assign<std::vector<std::string>>(node, "topics", record_options.topics);
optional_assign<std::vector<std::string>>(node, "topic_types", record_options.topic_types);
optional_assign<std::vector<std::string>>(node, "services", record_options.services);
optional_assign<std::string>(
node, "rmw_serialization_format", record_options.rmw_serialization_format);
optional_assign<std::chrono::milliseconds>(
node, "topic_polling_interval", record_options.topic_polling_interval);
optional_assign<std::string>(node, "regex", record_options.regex);
optional_assign<std::string>(node, "exclude_regex", record_options.exclude_regex);
optional_assign<std::vector<std::string>>(node, "exclude_topics", record_options.exclude_topics);
optional_assign<std::vector<std::string>>(
node, "exclude_topic_types",
record_options.exclude_topic_types);
optional_assign<std::vector<std::string>>(
node, "exclude_services", record_options.exclude_service_events);
optional_assign<std::string>(node, "node_prefix", record_options.node_prefix);
optional_assign<std::string>(node, "compression_mode", record_options.compression_mode);
optional_assign<std::string>(node, "compression_format", record_options.compression_format);
optional_assign<uint64_t>(node, "compression_queue_size", record_options.compression_queue_size);
optional_assign<uint64_t>(node, "compression_threads", record_options.compression_threads);
optional_assign<int32_t>(
node, "compression_threads_priority",
record_options.compression_threads_priority);
std::unordered_map<std::string, rclcpp::QoS> qos_overrides;
if (node["topic_qos_profile_overrides"]) {
qos_overrides = YAML::decode_for_version<std::unordered_map<std::string, rclcpp::QoS>>(
node["topic_qos_profile_overrides"], version);
}
record_options.topic_qos_profile_overrides = qos_overrides;
optional_assign<bool>(node, "include_hidden_topics", record_options.include_hidden_topics);
optional_assign<bool>(
node, "include_unpublished_topics",
record_options.include_unpublished_topics);
optional_assign<bool>(
node, "disable_keyboard_controls",
record_options.disable_keyboard_controls);

@ottojo
Copy link
Contributor Author

ottojo commented May 20, 2024

@Barry-Xu-2018 thanks for pointing me to the corresponding parts in the source. I updated the exclude key and added the other keys relevant for topic and service selection. I did not add all keys found in the source, i think some may already be excluded on purpose, because they are not relevant for bag conversion (such as for example disable_keyboard_controls, compression_threads_priority and topic_polling_interval)

@ottojo
Copy link
Contributor Author

ottojo commented May 20, 2024

oh, i also just notice that it's not only the RecordingOptions but also StorageOptions, where the actual options are that i wanted to use prior to hitting this issue:

storage_options.uri = node["uri"].as<std::string>();
optional_assign<std::string>(node, "storage_id", storage_options.storage_id);
optional_assign<uint64_t>(node, "max_bagfile_size", storage_options.max_bagfile_size);
optional_assign<uint64_t>(node, "max_bagfile_duration", storage_options.max_bagfile_duration);
optional_assign<uint64_t>(node, "max_cache_size", storage_options.max_cache_size);
optional_assign<std::string>(
node, "storage_preset_profile", storage_options.storage_preset_profile);
optional_assign<std::string>(node, "storage_config_uri", storage_options.storage_config_uri);
optional_assign<bool>(node, "snapshot_mode", storage_options.snapshot_mode);
optional_assign<int64_t>(node, "start_time_ns", storage_options.start_time_ns);
optional_assign<int64_t>(node, "end_time_ns", storage_options.end_time_ns);
using KEY_VALUE_MAP = std::unordered_map<std::string, std::string>;
optional_assign<KEY_VALUE_MAP>(node, "custom_data", storage_options.custom_data);

Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm.

i do not think we need to introduce all options here, but all options need to be aligned with the implementation.

Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be valuable to add all_services: true for examples with bag compression and bag split.
To avoid other potential questions in the future, like "Why services were lost during conversion?"

ottojo and others added 2 commits May 21, 2024 16:08
Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>
Copy link
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for the PR!

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me as well.

Given that this is a change to documentation, we can merge this without CI, but @MichaelOrlov I'll wait for you to do that. I think we should also backport this to the jazzy branch.

@MichaelOrlov
Copy link
Contributor

Merging without CI run since changes only in the readme.md file.

@MichaelOrlov MichaelOrlov merged commit 938fafa into ros2:rolling May 21, 2024
@MichaelOrlov
Copy link
Contributor

https://github.com/Mergifyio backport jazzy

@mergify
Copy link

mergify bot commented May 21, 2024

backport jazzy

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request May 21, 2024
* fix example conversion configs: all -> all_topics

Signed-off-by: Jonas Otto <[email protected]>

* update topic and service selection arguments in conversion config in readme

Signed-off-by: Jonas Otto <[email protected]>

* add all_services: true to first example

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>

* add all_services: true to second example

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>

---------

Signed-off-by: Jonas Otto <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>
(cherry picked from commit 938fafa)
MichaelOrlov pushed a commit that referenced this pull request May 21, 2024
#1668)

* fix example conversion configs: all -> all_topics

Signed-off-by: Jonas Otto <[email protected]>

* update topic and service selection arguments in conversion config in readme

Signed-off-by: Jonas Otto <[email protected]>

* add all_services: true to first example

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>

* add all_services: true to second example

Co-authored-by: Michael Orlov <[email protected]>
Signed-off-by: Jonas Otto <[email protected]>

---------

Signed-off-by: Jonas Otto <[email protected]>
Co-authored-by: Michael Orlov <[email protected]>
(cherry picked from commit 938fafa)

Co-authored-by: Jonas Otto <[email protected]>
@ottojo ottojo deleted the fix-example-convert-configs branch May 21, 2024 19:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants