feat: Added callback group events executor#3097
feat: Added callback group events executor#3097jmachowinski wants to merge 10 commits intoros2:rollingfrom
Conversation
273c322 to
66467b3
Compare
rclcpp/include/rclcpp/executors/events_cbg_executor/events_cbg_executor.hpp
Show resolved
Hide resolved
rclcpp/include/rclcpp/executors/events_cbg_executor/events_cbg_executor.hpp
Show resolved
Hide resolved
rclcpp/include/rclcpp/experimental/executors/events_cbg_executor/events_cbg_executor.hpp
Outdated
Show resolved
Hide resolved
rclcpp/include/rclcpp/experimental/executors/events_cbg_executor/events_cbg_executor.hpp
Outdated
Show resolved
Hide resolved
rclcpp/include/rclcpp/executors/events_cbg_executor/events_cbg_executor.hpp
Outdated
Show resolved
Hide resolved
rclcpp/src/rclcpp/executors/events_cbg_executor/events_cbg_executor.cpp
Outdated
Show resolved
Hide resolved
rclcpp/src/rclcpp/experimental/executors/events_cbg_executor/events_cbg_executor.cpp
Outdated
Show resolved
Hide resolved
|
@jmachowinski can you add this to the executor unit-tests? |
f7b3021 to
7eb2fca
Compare
This commit adds the callback group events executor. It features: - multithreading support - correct handling of sim time - usage of the events subsystem Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <j.machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <j.machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <j.machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <j.machowinski@cellumation.com>
4933042 to
26fd9db
Compare
Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
…ager This code was copied straight from the executor and seems to be a workaround for the multithreaded executor, that breaks in this use case. The correct solution for us is to do the timer->call() from within the worker thread. This fixes a deadlock due to double acquisition of an internal lock within the timer manager. Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
In case the next timer wakeup time is not changed by an insertion of a timer, don't wake up the timer thread. Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
26fd9db to
430c2dd
Compare
|
Pulls: #3097 |
Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
Signed-off-by: Janosch Machowinski <J.Machowinski@cellumation.com>
skyegalaxy
left a comment
There was a problem hiding this comment.
Aside from some spelling nits and a handful of small implementation questions, this is looking great! Very excited to get this over the finish line soon.
| return FutureReturnCode::INTERRUPTED; | ||
| } | ||
|
|
||
| /// We need these fuction to be public, as we use them in the callback_group_scheduler |
There was a problem hiding this comment.
| /// We need these fuction to be public, as we use them in the callback_group_scheduler | |
| /// We need these functions to be public, as we use them in the callback_group_scheduler |
| added_nodes_cpy = added_nodes; | ||
| } | ||
|
|
||
| // *3 is a rough estimate of how many callback_group a node may have |
There was a problem hiding this comment.
What would happen in the case where a node might have more than 3 callback groups?
| } | ||
| } | ||
|
|
||
| // FIXME inform scheduler about remove cbgs |
There was a problem hiding this comment.
what are the side-effects of leaving this as is and not informing the scheduler here?
| // we need to shut down the timer manager first, as it might access the Schedulers | ||
| timer_manager->stop(); | ||
|
|
||
| bool was_spining = spinning; |
There was a problem hiding this comment.
| bool was_spining = spinning; | |
| bool was_spinning = spinning; |
| scheduler->unblock_one_worker_thread(); | ||
| } | ||
|
|
||
| ready_entity.entitiy->execute_function(); |
There was a problem hiding this comment.
| ready_entity.entitiy->execute_function(); | |
| ready_entity.entity->execute_function(); |
| } | ||
| } | ||
|
|
||
| template<class Executer> |
There was a problem hiding this comment.
| template<class Executer> | |
| template<class Executor> |
| template<class Executer> | ||
| void benchmark_wait_for_work(benchmark::State & st) | ||
| { | ||
| class ExecuterDerived : public Executer |
There was a problem hiding this comment.
| class ExecuterDerived : public Executer | |
| class ExecutorDerived : public Executor |
| // start the cascasde | ||
| waitables[0]->trigger(); | ||
|
|
||
| cascase_done.wait_for(lk, 500ms); |
There was a problem hiding this comment.
| cascase_done.wait_for(lk, 500ms); | |
| cascade_done.wait_for(lk, 500ms); |
| * This is needed, as clocks may be deleted during normal operation, | ||
| * and be don't have a way to create a permanent ros time clock. | ||
| */ | ||
| class ClockConditionalVariable |
There was a problem hiding this comment.
I think it could be worth eventually merging the functionality of this ClockConditionalVariable variant with the existing one and cutting down on the duplicate code if it's not too complex to do.
| public: | ||
| static rclcpp::Clock::SharedPtr get_clock(const rclcpp::TimerBase & timer) | ||
| { | ||
| // SUPER ugly hack, but we need the correct clock |
There was a problem hiding this comment.
is it worth expanding the timer API to provide access to its clock, or declaring the timer manager a friend class of TimerBase so the access is still limited?
This commit adds the callback group events executor. It features:
Description
This moved the events cbg executor from cm_executors into rlcpp mainline.
Did you use Generative AI?
No