Skip to content

Conversation

@EsipovPA
Copy link
Contributor

Description

Added a tutorial regarding the usage of SimpleFilter for building custom filters in python.
Minor fixes to the Subscriber class interface and __init__.

Relates to #130

Is this user-facing behavior change?

Yes. Better documentation.

Did you use Generative AI?

No, I did not.

Additional Information

…ter errors in case of incorrect arguments passed to '__init__'. Minor class body style fixes.

Signed-off-by: EsipovPA <[email protected]>
self.count += 1

def print_counter_value(self):
print(f"Filter conter value: {self.count}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(f"Filter conter value: {self.count}")
print(f"Filter counter value: {self.count}")

self.count += 1

def print_counter_value(self):
print(f"Filter conter value: {self.count}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
print(f"Filter conter value: {self.count}")
print(f"Filter counter value: {self.count}")

self.cache.new_message_callback
)

After the ``pubisher`` and ``Subscruber`` are set up, we initialize ``LastMessageCache`` and ``CounterWithCallback`` filter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
After the ``pubisher`` and ``Subscruber`` are set up, we initialize ``LastMessageCache`` and ``CounterWithCallback`` filter.
After the ``publisher`` and ``Subscruber`` are set up, we initialize ``LastMessageCache`` and ``CounterWithCallback`` filter.

Comment on lines 434 to 453
Filter conter value: 0
Cache is empty

Filter conter value: 1
Last cached message: Example string data № 0

Filter conter value: 2
Last cached message: Example string data № 1

Filter conter value: 3
Last cached message: Example string data № 2

Filter conter value: 4
Last cached message: Example string data № 3

Filter conter value: 5
Last cached message: Example string data № 4

Filter conter value: 6
Last cached message: Example string data № 5
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Filter conter value: 0
Cache is empty
Filter conter value: 1
Last cached message: Example string data № 0
Filter conter value: 2
Last cached message: Example string data № 1
Filter conter value: 3
Last cached message: Example string data № 2
Filter conter value: 4
Last cached message: Example string data № 3
Filter conter value: 5
Last cached message: Example string data № 4
Filter conter value: 6
Last cached message: Example string data № 5
Filter counter value: 0
Cache is empty
Filter counter value: 1
Last cached message: Example string data № 0
Filter counter value: 2
Last cached message: Example string data № 1
Filter counter value: 3
Last cached message: Example string data № 2
Filter counter value: 4
Last cached message: Example string data № 3
Filter counter value: 5
Last cached message: Example string data № 4
Filter counter value: 6
Last cached message: Example string data № 5

...

def callback_with_args(message: MsgT, *args):
# # Some work done here
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# # Some work done here
# Some work done here

Comment on lines 376 to 378
<depend>rclpy</depend>
<depend>message_filters</depend>
<depend>std_msgs</depend>
Copy link
Contributor

Choose a reason for hiding this comment

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

alphabetize

@EsipovPA EsipovPA force-pushed the add_simple_filter_tutorials branch from d633578 to 47a4de9 Compare December 3, 2025 21:09
@EsipovPA
Copy link
Contributor Author

EsipovPA commented Dec 3, 2025

@ahcorde Thank you for the review! Have applied all the changes that you've proposed. Also alphabetized dependency description sections in other tutorials in a separate commit

@ahcorde ahcorde merged commit c31a7a9 into ros2:rolling Dec 4, 2025
2 checks passed
@ahcorde
Copy link
Contributor

ahcorde commented Dec 4, 2025

I think we can backport this to other distro but the Subscription contructor has a diferrent signature. Do you mind to review it @EsipovPA ?

@ahcorde
Copy link
Contributor

ahcorde commented Dec 4, 2025

https://github.com/Mergifyio backport kilted jazzy humble

@mergify
Copy link

mergify bot commented Dec 4, 2025

backport kilted jazzy humble

✅ Backports have been created

mergify bot pushed a commit that referenced this pull request Dec 4, 2025
Signed-off-by: EsipovPA <[email protected]>
(cherry picked from commit c31a7a9)

# Conflicts:
#	src/message_filters/__init__.py
mergify bot pushed a commit that referenced this pull request Dec 4, 2025
Signed-off-by: EsipovPA <[email protected]>
(cherry picked from commit c31a7a9)

# Conflicts:
#	src/message_filters/__init__.py
mergify bot pushed a commit that referenced this pull request Dec 4, 2025
Signed-off-by: EsipovPA <[email protected]>
(cherry picked from commit c31a7a9)

# Conflicts:
#	src/message_filters/__init__.py
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.

2 participants