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

Add QoS Profile override to CLI #347

Merged
merged 15 commits into from
Apr 7, 2020

Conversation

piraka9011
Copy link
Contributor

@piraka9011 piraka9011 commented Apr 3, 2020

  • Add a --qos-profile-overrides CLI option
  • Parse a yaml file with overrides into a QoSProfile
  • Test different scenarios (complete, partial, and non-existent yaml overrides).

This PR as it stands is non-functional.
However, it ties in to the PR's related to #125 by overriding the qos_profiles introduced in the RecordOptions.

Part of #125
Part of ros-tooling/aws-roadmap#218

Signed-off-by: Anas Abou Allaban [email protected]

Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/test/resources/incomplete_qos_profile.yaml Outdated Show resolved Hide resolved
Signed-off-by: Anas Abou Allaban <[email protected]>
Copy link
Collaborator

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

This one's also looking a lot better.

The one open missing feature is providing enum values by name/string, rather than integer value. I think that's critical to the feature, we can't ask users to provide reliability: 2, those values aren't documented anywhere and are error prone.

ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
ros2bag/package.xml Show resolved Hide resolved
'reliability': rclpy.qos.QoSReliabilityPolicy.get_from_short_key,
'durability': rclpy.qos.QoSDurabilityPolicy.get_from_short_key,
'liveliness': rclpy.qos.QoSLivelinessPolicy.get_from_short_key
}
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we make sure those two will stay in-sync? Can't we just get the user to pass the short key?

Copy link
Contributor Author

@piraka9011 piraka9011 Apr 7, 2020

Choose a reason for hiding this comment

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

We can have the user specify in the override yaml file the enum integer for each policy (ex. reliability: 0 which is the same as reliability: system_default) but that's not good UX.
I don't think there's a 'better' way to get these values beside using these helper methods provided by each policy.
Maybe using importlib to import all modules with the name *Policy in rclpy.qos but that's hacky IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, we should at least add a comment explaining this needs to be updated when rclpy.qos is updated.
Consider also using a frozenset() here as you don't really need a map to store x => x.foo for multiple values of x, unless you plan to have elements that would break this pattern, but it's probably YAGNI.

ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
ros2bag/ros2bag/verb/record.py Outdated Show resolved Hide resolved
@@ -52,6 +78,7 @@ rosbag2_transport_record(PyObject * Py_UNUSED(self), PyObject * args, PyObject *
"max_cache_size",
"topics",
"include_hidden_topics",
"qos_profile_overrides",
Copy link
Contributor

Choose a reason for hiding this comment

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

alphasort?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alphasorting these argument will introduce irrelevant changes that I'd prefer not to have as a part of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, sgtm. Please link the PR back here once it's done.

Signed-off-by: Anas Abou Allaban <[email protected]>
Signed-off-by: Anas Abou Allaban <[email protected]>
Copy link
Collaborator

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

This LGTM now. I think a followup for this is a wiki page on rosbag2 usage with a specific section on this feature. It's going to be completely non-discoverable as-is

Signed-off-by: Anas Abou Allaban <[email protected]>
@piraka9011
Copy link
Contributor Author

piraka9011 commented Apr 7, 2020

@ros2/aws-oncall - please run this CI job
Gist: https://gist.githubusercontent.com/piraka9011/b0eaa784659cc6e98bb09ea175d97367/raw/f99f2a68258a11bac3d4e9c09ff6e723d6d05ee1/ros2.repos
BUILD args: --packages-up-to ros2bag rosbag2_transport
TEST args: --packages-select ros2bag rosbag2_transport
Job: ci_launcher

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@piraka9011
Copy link
Contributor Author

@emersonknapp Looks like the same issue as before here. Let me know when it's ready to merge (or feel free to do so).

@piraka9011 piraka9011 changed the title Add QoS Profile command to CLI Add QoS Profile override to CLI Apr 7, 2020
@piraka9011 piraka9011 merged commit 9ef734f into ros2:master Apr 7, 2020
@piraka9011 piraka9011 deleted the override-subscription-cli branch April 7, 2020 20:13
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.

3 participants