ROS 2 rclcpp + rcl - jazzy  jazzy
ROS 2 C++ Client Library with ROS Client Library
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
rclcpp::executors::cbg_executor::CBGScheduler Class Referenceabstract
Inheritance diagram for rclcpp::executors::cbg_executor::CBGScheduler:
Inheritance graph
[legend]

Classes

struct  CallbackEventType
 
struct  CallbackGroupHandle
 
struct  ExecutableEntity
 
struct  ExecutableEntityWithInfo
 
struct  WaitableWithEventType
 

Public Member Functions

 CBGScheduler (std::function< void()> sync_function)
 
 CBGScheduler (const CBGScheduler &)=delete
 
 CBGScheduler (CBGScheduler &&)=delete
 
CBGScheduleroperator= (const CBGScheduler &)=delete
 
CBGScheduleroperator= (CBGScheduler &&)=delete
 
CallbackGroupHandleadd_callback_group (const rclcpp::CallbackGroup::SharedPtr &callback_group)
 
void remove_callback_group (const CallbackGroupHandle *callback_handle)
 
void callback_group_ready (CallbackGroupHandle *handle, bool callback_group_was_idle)
 
ExecutableEntityWithInfo get_next_ready_entity ()
 
ExecutableEntityWithInfo get_next_ready_entity (GlobalEventIdProvider::MonotonicId max_id)
 
virtual ExecutableEntityWithInfo get_next_ready_entity_intern ()=0
 
virtual ExecutableEntityWithInfo get_next_ready_entity_intern (GlobalEventIdProvider::MonotonicId max_id)=0
 
void trigger_sync ()
 
void mark_entity_as_executed (const ExecutableEntity &e)
 
void unblock_one_worker_thread ()
 
void block_worker_thread ()
 
void block_worker_thread_for (std::chrono::nanoseconds timeout)
 
void release_all_worker_threads ()
 

Protected Member Functions

virtual std::unique_ptr< CallbackGroupHandleget_handle_for_callback_group (const rclcpp::CallbackGroup::SharedPtr &callback_group)=0
 

Protected Attributes

std::function< void()> sync_function
 
bool needs_sync = false
 
std::mutex ready_callback_groups_mutex
 
std::deque< CallbackGroupHandle * > ready_callback_groups
 
bool release_workers = false
 
bool release_worker_once = false
 
std::condition_variable work_ready_conditional
 
std::list< std::unique_ptr< CallbackGroupHandle > > callback_groups
 

Detailed Description

Definition at line 31 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ CBGScheduler()

rclcpp::executors::cbg_executor::CBGScheduler::CBGScheduler ( std::function< void()>  sync_function)
inlineexplicit
Parameters
sync_functionA special purpose sync function, that shall be executed with high priority if triggered by trigger_sync();

Definition at line 182 of file scheduler.hpp.

Member Function Documentation

◆ callback_group_ready()

void rclcpp::executors::cbg_executor::CBGScheduler::callback_group_ready ( CallbackGroupHandle handle,
bool  callback_group_was_idle 
)
inline

Will be called, by CallbackGroupHandle if any entity in the cb group is ready for execution and the cb group was idle before

Parameters
callback_group_was_idleIs false, if no entity of the callback group was executed, before this call was made. This means we need to wakeup a a new thread.

Definition at line 219 of file scheduler.hpp.

References unblock_one_worker_thread().

Referenced by rclcpp::executors::cbg_executor::CBGScheduler::CallbackGroupHandle::add_ready_entity(), and rclcpp::executors::cbg_executor::CBGScheduler::CallbackGroupHandle::mark_as_executed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_next_ready_entity()

ExecutableEntityWithInfo rclcpp::executors::cbg_executor::CBGScheduler::get_next_ready_entity ( )
inline

Returns the next ready entity that shall be executed. If a entity is removed here, the scheduler may assume that it will be executed, and that the function mark_entity_as_executed will be called afterwards.

Definition at line 243 of file scheduler.hpp.

◆ mark_entity_as_executed()

void rclcpp::executors::cbg_executor::CBGScheduler::mark_entity_as_executed ( const ExecutableEntity e)
inline

Must be called, after a entity was executed. This function will normally be used, to mark the associated callback group as ready again.

Definition at line 306 of file scheduler.hpp.

References rclcpp::executors::cbg_executor::CBGScheduler::CallbackGroupHandle::mark_as_executed().

Here is the call graph for this function:

◆ trigger_sync()

void rclcpp::executors::cbg_executor::CBGScheduler::trigger_sync ( )
inline

If this function was triggered, a worker thread must be woken up, and the next call to get_next_ready_entity must return a ExecutableEntityWithInfo with the sync function in it.Or reworded if this function is triggered the sync function will be executed as the next exent by the executor.

Definition at line 286 of file scheduler.hpp.

References unblock_one_worker_thread().

Here is the call graph for this function:

◆ unblock_one_worker_thread()

void rclcpp::executors::cbg_executor::CBGScheduler::unblock_one_worker_thread ( )
inline

Wakes up a worker thread

Definition at line 316 of file scheduler.hpp.

Referenced by callback_group_ready(), and trigger_sync().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: