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 wait set examples #315

Merged
merged 59 commits into from
Jul 31, 2021
Merged

Add wait set examples #315

merged 59 commits into from
Jul 31, 2021

Conversation

carlossvg
Copy link
Contributor

@carlossvg carlossvg commented Jun 25, 2021

This PR adds examples for how to use the new rclcpp::WaitSet classes. It is an extension of the existing PR #262 created by @wjwwood.

This PR includes the following additional examples:

  • wait_set_subscriber.cpp uses a rclcpp::WaitSet to wait and poll for data
  • static_wait_set_subscriber.cpp uses a rclcpp::StaticWaitSet to wait and poll for data
  • time_triggered_wait_set_subscriber.cpp uses a rclcpp::Waitset and a timer to poll for data
    periodically
  • wait_set.cpp: Simple example showing how to use the default wait-set with a dynamic
    storage policy and a sequential (no thread-safe) synchronization policy.
  • static_wait_set.cpp: Simple example showing how to use the static wait-set with a static
    storage policy.
  • thread_safe_wait_set.cpp: Simple example showing how to use the thread-safe wait-set with a
    thread-safe synchronization policy.
  • wait_set_topics_and_timer.cpp: Simple example using multiple subscriptions,
    publishers, and a timer.
  • wait_set_random_order.cpp: An example showing user-defined
    data handling and a random publisher. executor_random_order.cpp run the same node logic
    using SingleThreadedExecutor to compare the data handling order.
  • wait_set_and_executor_composition.cpp: An example showing how to combine a
    SingleThreadedExecutor and a wait-set.
  • wait_set_topics_with_different_rate.cpp: An example showing how to use a custom trigger
    condition to handle topics with different topic rates.

Some of the examples may be moved to ros2/tutorials or ros2/demos.

Connects to ros2/rclcpp#1047

@carlossvg
Copy link
Contributor Author

@wjwwood I will add more comments, add a readme and probably rename the examples. Could briefly you take a look and see if you miss an example or a specific usage we want to show?

@carlossvg carlossvg force-pushed the wait_set_examples branch 2 times, most recently from f66bb18 to df31c38 Compare June 25, 2021 11:19
@carlossvg carlossvg force-pushed the wait_set_examples branch 7 times, most recently from db0a78e to 3432aa7 Compare June 30, 2021 08:31
@carlossvg carlossvg force-pushed the wait_set_examples branch 3 times, most recently from 57148df to aa1f133 Compare July 6, 2021 13:31
@carlossvg carlossvg requested a review from wjwwood July 7, 2021 07:49
@carlossvg
Copy link
Contributor Author

carlossvg commented Jul 7, 2021

@wjwwood This PR should be ready to review.

@carlossvg carlossvg changed the title Draft: Add wait set examples Add wait set examples Jul 7, 2021
rclcpp/minimal_subscriber/README.md Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/waitset.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/waitset_time_triggered.cpp Outdated Show resolved Hide resolved
rclcpp/wait_set/README.md Outdated Show resolved Hide resolved
rclcpp/wait_set/README.md Show resolved Hide resolved
rclcpp/wait_set/thread_safe_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/wait_set/wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/wait_set/wait_set_and_executor_composition.cpp Outdated Show resolved Hide resolved
rclcpp/wait_set/wait_set_topics_and_timer.cpp Outdated Show resolved Hide resolved
rclcpp/wait_set/wait_set_random_order.cpp Outdated Show resolved Hide resolved
@wjwwood
Copy link
Member

wjwwood commented Jul 16, 2021

@Mergifyio rebase

@mergify
Copy link
Contributor

mergify bot commented Jul 16, 2021

Command rebase: success

Branch has been successfully rebased

Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

I left some additional comments, mostly minor things.

I would like to discuss (in a call if we can) the examples in examples_rclcpp_wait_set, just to help me understand better.

I think that if we can avoid the headers (may or may not be possible) then it would save us some trouble, but we can discuss that too.

rclcpp/README.md Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/static_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/static_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/static_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/static_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/static_wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/wait_set.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/wait_set_time_triggered.cpp Outdated Show resolved Hide resolved
rclcpp/minimal_subscriber/wait_set_time_triggered.cpp Outdated Show resolved Hide resolved
@carlossvg carlossvg force-pushed the wait_set_examples branch 2 times, most recently from 997a4ca to bee789d Compare July 20, 2021 16:12
@carlossvg
Copy link
Contributor Author

@wjwwood I addressed your comments. You can review it again.

@carlossvg carlossvg requested a review from wjwwood July 20, 2021 16:25
carlossvg and others added 22 commits July 23, 2021 16:25
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Co-authored-by: William Woodall <william+github@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Co-authored-by: William Woodall <william+github@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Co-authored-by: William Woodall <william+github@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.sanvicente@apex.ai>
Signed-off-by: William Woodall <william@osrfoundation.org>
Co-authored-by: William Woodall <william+github@osrfoundation.org>
Signed-off-by: Carlos San Vicente <carlos.svic@gmail.com>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
@wjwwood
Copy link
Member

wjwwood commented Jul 23, 2021

CI:

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

@wjwwood
Copy link
Member

wjwwood commented Jul 29, 2021

I fixed some of the warning, but didn't follow up yet on the rest. I can do that hopefully tonight and get this merged.

Signed-off-by: William Woodall <william@osrfoundation.org>
@wjwwood
Copy link
Member

wjwwood commented Jul 31, 2021

CI:

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

@wjwwood wjwwood merged commit 4501468 into ros2:master Jul 31, 2021
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