-
Notifications
You must be signed in to change notification settings - Fork 479
Added optional TimerInfo to timer callback #2343
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -383,7 +383,7 @@ Executor::execute_any_executable(AnyExecutable & any_exec) | |
| TRACETOOLS_TRACEPOINT( | ||
| rclcpp_executor_execute, | ||
| static_cast<const void *>(any_exec.timer->get_timer_handle().get())); | ||
| execute_timer(any_exec.timer); | ||
| execute_timer(any_exec.timer, any_exec.data); | ||
| } | ||
| if (any_exec.subscription) { | ||
| TRACETOOLS_TRACEPOINT( | ||
|
|
@@ -547,9 +547,9 @@ Executor::execute_subscription(rclcpp::SubscriptionBase::SharedPtr subscription) | |
| } | ||
|
|
||
| void | ||
| Executor::execute_timer(rclcpp::TimerBase::SharedPtr timer) | ||
| Executor::execute_timer(rclcpp::TimerBase::SharedPtr timer, const std::shared_ptr<void> & dataPtr) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this pointer be the actual type instead of
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The return from take_data() is void as it's the standard in the rest of the code. Therefore this pointer is also void. |
||
| { | ||
| timer->execute_callback(); | ||
| timer->execute_callback(dataPtr); | ||
| } | ||
|
|
||
| void | ||
|
|
@@ -690,6 +690,7 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable) | |
| if (entity_iter != current_collection_.timers.end()) { | ||
| auto callback_group = entity_iter->second.callback_group.lock(); | ||
| if (callback_group && !callback_group->can_be_taken_from()) { | ||
| current_timer_index++; | ||
| continue; | ||
| } | ||
| // At this point the timer is either ready for execution or was perhaps | ||
|
|
@@ -698,14 +699,17 @@ Executor::get_next_ready_executable(AnyExecutable & any_executable) | |
| // it from the wait result. | ||
| wait_result_->clear_timer_with_index(current_timer_index); | ||
| // Check that the timer should be called still, i.e. it wasn't canceled. | ||
| if (!timer->call()) { | ||
| any_executable.data = timer->call(); | ||
| if (!any_executable.data) { | ||
| current_timer_index++; | ||
| continue; | ||
| } | ||
| any_executable.timer = timer; | ||
| any_executable.callback_group = callback_group; | ||
| valid_executable = true; | ||
| break; | ||
| } | ||
| current_timer_index++; | ||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.