Skip to content

Conversation

@mergify
Copy link

@mergify mergify bot commented Apr 9, 2025

Fixes #983

  1. Added a conditional statement to set the raw flag when creating subscriptions for topics based on the value of filter_expr. If the --filter flag is used, filter_expr is not None and deserializing subscriptions are created. Otherwise filter_expr is None and 'raw' subscriptions are created.

  2. As for the bw verb, it already uses 'raw' subscriptions and there is no case where desrialization of topics is required. Hence no changes made there.

Manual Testing

  1. Run an example publisher:
$ ros2 run examples_rclcpp_minimal_publisher publisher_member_function
[INFO] [1744209999.094889429] [minimal_publisher]: Publishing: 'Hello, world! 0'
[INFO] [1744209999.594917828] [minimal_publisher]: Publishing: 'Hello, world! 1'
[INFO] [1744210000.094935314] [minimal_publisher]: Publishing: 'Hello, world! 2'
[INFO] [1744210000.594921529] [minimal_publisher]: Publishing: 'Hello, world! 3'
[INFO] [1744210001.094927741] [minimal_publisher]: Publishing: 'Hello, world! 4'
  1. Run simple topic hz:
$ ros2 topic hz /topic
average rate: 2.002
        min: 0.500s max: 0.500s std dev: 0.00000s window: 1
average rate: 2.000
        min: 0.499s max: 0.501s std dev: 0.00105s window: 3
average rate: 2.000
        min: 0.499s max: 0.501s std dev: 0.00084s window: 5
  1. Run topic hz with filter that only selects messages with even numbers:
$ ros2 topic hz /topic --filter 'int(m.data.rpartition(\"! \")[-1]) % 2 == 0'
average rate: 1.000
        min: 1.000s max: 1.000s std dev: 0.00000s window: 1
average rate: 1.000
        min: 0.999s max: 1.000s std dev: 0.00024s window: 2
average rate: 1.000
        min: 0.999s max: 1.001s std dev: 0.00065s window: 3
  1. Verifying the message deserialization directly with:
$ ros2 topic hz /topic --filter 'print(type(m.data))'
<class 'str'>
<class 'str'>
<class 'str'>
```<hr>This is an automatic backport of pull request #1005 done by [Mergify](https://mergify.com).

Signed-off-by: Kostubh Khandelwal <khandelwalkostubh@gmail.com>
(cherry picked from commit bfc5245)

# Conflicts:
#	ros2topic/ros2topic/verb/hz.py
@mergify
Copy link
Author

mergify bot commented Apr 9, 2025

Cherry-pick of bfc5245 has failed:

On branch mergify/bp/humble/pr-1005
Your branch is up to date with 'origin/humble'.

You are currently cherry-picking commit bfc5245.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   ros2topic/ros2topic/verb/hz.py

no changes added to commit (use "git add" and/or "git commit -a")

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
@christophebedard
Copy link
Member

Pulls: #1007
Gist: https://gist.githubusercontent.com/christophebedard/66d2d13d0e38a5d08594392f41a8698f/raw/d302484003fa5b154d1a9e91c69945fa597a69f5/ros2.repos
BUILD args: --packages-above-and-dependencies ros2topic
TEST args: --packages-above ros2topic
ROS Distro: humble
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/15645

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

@christophebedard christophebedard merged commit 33082a9 into humble Apr 9, 2025
2 of 3 checks passed
@christophebedard christophebedard deleted the mergify/bp/humble/pr-1005 branch April 9, 2025 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants