Skip to content

Add support for topic QOS for ros2topic bw, delay and hz - #935

Merged
fujitatomoya merged 5 commits into
ros2:rollingfrom
TonyWelte:feature/expand-ros-topic-qos
Mar 12, 2025
Merged

fujitatomoya merged 5 commits into
ros2:rollingfrom
TonyWelte:feature/expand-ros-topic-qos

Conversation

@TonyWelte

Copy link
Copy Markdown
Contributor

This PR adds support for QoS configuration for the verbs: bw, delay and hz.

It moves the logic to decide on the QoS from echo into ros2topic.api to keep the same logic for the 4 verbs.

I'm not really satisfied with my extract_qos_arguments function. It's a bit useless, it might be cleaner to just pass the full args to each _rostopic_verb function

Resolves: #719

@TonyWelte
TonyWelte force-pushed the feature/expand-ros-topic-qos branch from 7f6a506 to 392e320 Compare September 17, 2024 20:16

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

test with QoS arguments would be ideal for hz, bw, deleyand echo. (this also can be a follow-up PR, i think)

Comment thread ros2topic/ros2topic/api/__init__.py Resolved
Comment thread ros2topic/ros2topic/api/__init__.py Resolved
Comment thread ros2topic/ros2topic/verb/bw.py Resolved
Comment thread ros2topic/ros2topic/verb/bw.py Resolved
@TonyWelte

Copy link
Copy Markdown
Contributor Author

I'm planning on adding tests once I have time and figure out how to run the tests without getting 13 failures after over 7 min of runtime

@TonyWelte

Copy link
Copy Markdown
Contributor Author

I’ve explored adding tests for the QoS parameters but couldn’t find a clear starting point. Since the other verbs, pub and echo, don’t have similar tests, there’s no existing reference to build upon. I’ve removed the Draft status, and if reviewers have suggestions on how to approach these tests, I’d be happy to implement them.

Additionally, I made a small change to the existing tests to address an instability in test_topic_bw. If the "bw" timer is triggered immediately after the two default (52 bytes) messages are received, the estimated bandwidth might slightly exceed 100B/s, requiring three digits. This modification resolves that issue.

@TonyWelte
TonyWelte marked this pull request as ready for review November 19, 2024 20:38
@TonyWelte
TonyWelte force-pushed the feature/expand-ros-topic-qos branch from 3b31907 to 399ef65 Compare November 19, 2024 20:39
@fujitatomoya

Copy link
Copy Markdown
Collaborator

I’ve explored adding tests for the QoS parameters but couldn’t find a clear starting point. Since the other verbs, pub and echo, don’t have similar tests, there’s no existing reference to build upon.

# For compatible test, put publisher at very high quality
# and subscription at low
echo_extra_options = [
'--qos-reliability', 'best_effort',
'--qos-durability', 'volatile']

this checks if the QoS is compatible or not with the QoS arguments for ros2 topic echo.

@Yadunund

Copy link
Copy Markdown
Member

@fujitatomoya could you take another look when you get a chance? 🧇

Comment thread ros2topic/ros2topic/verb/bw.py Resolved
Comment thread ros2topic/test/test_cli.py Resolved
- Remove extract_qos_arguments since it's doing nothing useful. The QoS
  arguments are passed to choose_qos with other argument unfiltered
- Move choose_qos outside of the _rostopic_verb method for bw and delay.
  The _rostopic_verb method takes a QoSProfile instead of the cli
  arguments

Signed-off-by: Anthony Welte <[email protected]>
@TonyWelte
TonyWelte force-pushed the feature/expand-ros-topic-qos branch from de2d651 to 609ff7f Compare March 10, 2025 17:47
@TonyWelte
TonyWelte requested a review from fujitatomoya March 10, 2025 18:25

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm with green CI, thanks 👍

f'{default_profile.liveliness_lease_duration})'))


def choose_qos(node, topic_name: str, qos_args):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Note

Although it is okay to move this from echo.py, downstream packages are affected. since this change is only for rolling that is also fine too.

@fujitatomoya

Copy link
Copy Markdown
Collaborator

Pulls: #935
Gist: https://gist.githubusercontent.com/fujitatomoya/791f1f90582172c028c9568bb34e22b5/raw/6e5754a1f820b5119138813455ee64529feafbf7/ros2.repos
BUILD args: --packages-above-and-dependencies ros2topic
TEST args: --packages-above ros2topic
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15333

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@fujitatomoya

Copy link
Copy Markdown
Collaborator

@TonyWelte thanks for the contribution 👍 CI is green, i will go ahead to merge this.

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.

Add qos parameters to ros2 topic hz

3 participants