ros2 / examples

Example packages for ROS 2
Apache License 2.0
681 stars 308 forks source link

add ContentFilteredTopic example. #341

Closed fujitatomoya closed 2 years ago

fujitatomoya commented 2 years ago

should be linked to ROS 2 ContentFitleredTopic tutorial. (https://github.com/ros2/design/pull/282)

related to https://github.com/ros2/demos/pull/557

Signed-off-by: Tomoya Fujita Tomoya.Fujita@sony.com

fujitatomoya commented 2 years ago

CC: @wjwwood @ivanpauno @iuhilnehc-ynos

fujitatomoya commented 2 years ago

@wjwwood thanks for the comment, i borrowed your suggestions.

fujitatomoya commented 2 years ago

CI:

fujitatomoya commented 2 years ago

CI (address uncrustify errors):

fujitatomoya commented 2 years ago

example output for each rmw implementation.

ros2 run examples_rclcpp_minimal_publisher publisher_member_function
# ros2 run examples_rclcpp_minimal_subscriber subscriber_content_filtering
[INFO] [1650647654.909896684] [minimal_contentfiltering_subscriber]: Subscribed to topic "/topic" with content filtering
[INFO] [1650647654.909990922] [minimal_contentfiltering_subscriber]: Content filtering expression and parameter are "data = %0" and "'Hello, world! 10'"
[INFO] [1650647663.337609015] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 10'
[INFO] [1650647663.338324998] [minimal_contentfiltering_subscriber]: Content filtering expression and parameter are "data = %0" and "'Hello, world! 20'"
[INFO] [1650647668.337454893] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 20'
[INFO] [1650647668.338167047] [minimal_contentfiltering_subscriber]: Content filtering expression and parameter are "data = %0" and "'Hello, world! 30'"
...<snip>
# RMW_IMPLEMENTATION=rmw_connextdds ros2 run examples_rclcpp_minimal_subscriber subscriber_content_filtering
RTI Connext DDS Non-commercial license is for academic, research, evaluation and personal use only. USE FOR COMMERCIAL PURPOSES IS PROHIBITED. See RTI_LICENSE.TXT for terms. Download free tools at rti.com/ncl. License issued to Non-Commercial User license@rti.com For non-production use only.
Expires on 00-jan-00 See www.rti.com for more information.
[INFO] [1650647909.339308552] [minimal_contentfiltering_subscriber]: Subscribed to topic "/topic" with content filtering
[INFO] [1650647909.339387411] [minimal_contentfiltering_subscriber]: Content filtering expression and parameter are "data = %0" and "'Hello, world! 10'"
[INFO] [1650647926.630042121] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 10'
[INFO] [1650647926.631364854] [minimal_contentfiltering_subscriber]: Content filtering expression and parameter are "data = %0" and "'Hello, world! 20'"
...<snip>
# RMW_IMPLEMENTATION=rmw_cyclonedds_cpp ros2 run examples_rclcpp_minimal_subscriber subscriber_content_filtering
[WARN] [1650647987.733083073] [minimal_contentfiltering_subscriber]: Content filter is not enabled since it's not supported
[INFO] [1650647990.514812843] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 0'
[INFO] [1650647991.014601673] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 1'
[INFO] [1650647991.514611925] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 2'
[INFO] [1650647992.014454205] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 3'
[INFO] [1650647992.514540176] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 4'
[INFO] [1650647993.014640461] [minimal_contentfiltering_subscriber]: I heard: 'Hello, world! 5'
...<snip>
fujitatomoya commented 2 years ago

Note: cross-vendor content filtering works between rmw_fastrtps and rmw_connextdds using this example.

fujitatomoya commented 2 years ago

either @ivanpauno or @wjwwood , could you help to merge this? i do not have access permission for this repo.

clalancette commented 2 years ago

either @ivanpauno or @wjwwood , could you help to merge this? i do not have access permission for this repo.

Let's hold off until next week; we are trying to branch for Humble right now.

fujitatomoya commented 2 years ago

sorry, forgot that. thanks!

wjwwood commented 2 years ago

Yeah, this is ready, just waiting on Humble to unblock.

fujitatomoya commented 2 years ago

@clalancette could you merge this into master? so that i can link this example from https://github.com/ros2/ros2_documentation/pull/2396 (release note).

fujitatomoya commented 2 years ago

@Mergifyio backport rolling humble

mergify[bot] commented 2 years ago

backport rolling humble

✅ Backports have been created

* Backport to branch `rolling` failed: Branch not found * [#342 add ContentFilteredTopic example. (backport #341)](https://github.com/ros2/examples/pull/342) has been created for branch `humble`