Class AgnocastOnlyExecutor

Inheritance Relationships

Derived Types

Class Documentation

class AgnocastOnlyExecutor

Base class for Stage 2 executors that handle only Agnocast callbacks (no RMW). Used with agnocast::Node.

Subclassed by agnocast::AgnocastOnlyCallbackIsolatedExecutor, agnocast::AgnocastOnlyMultiThreadedExecutor, agnocast::AgnocastOnlySingleThreadedExecutor

Public Functions

explicit AGNOCAST_PUBLIC AgnocastOnlyExecutor()

Construct the executor.

virtual ~AgnocastOnlyExecutor()
virtual AGNOCAST_PUBLIC void spin ()=0

Block the calling thread and process Agnocast callbacks in a loop until cancel() is called.

virtual AGNOCAST_PUBLIC void cancel ()

Request the executor to stop spinning. Causes the current or next spin() call to return.

AGNOCAST_PUBLIC void add_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify=true)

Add a callback group to this executor.

Parameters:
  • group_ptr – Callback group to add.

  • node_ptrNode the group belongs to.

  • notify – If true, wake the executor so it picks up the change immediately.

AGNOCAST_PUBLIC void remove_callback_group (rclcpp::CallbackGroup::SharedPtr group_ptr, bool notify=true)

Remove a callback group from this executor.

Parameters:
  • group_ptr – Callback group to remove.

  • notify – If true, wake the executor so it picks up the change immediately.

AGNOCAST_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_all_callback_groups ()

Return all callback groups known to this executor.

Returns:

Vector of weak pointers to callback groups.

AGNOCAST_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_manually_added_callback_groups ()

Return callback groups that were manually added.

Returns:

Vector of weak pointers to callback groups.

AGNOCAST_PUBLIC std::vector< rclcpp::CallbackGroup::WeakPtr > get_automatically_added_callback_groups_from_nodes ()

Return callback groups automatically discovered from added nodes.

Returns:

Vector of weak pointers to callback groups.

AGNOCAST_PUBLIC void add_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify=true)

Add a node to this executor.

Parameters:
  • node_ptrNode to add.

  • notify – If true, wake the executor so it picks up the change immediately.

AGNOCAST_PUBLIC void add_node (const std::shared_ptr< agnocast::Node > &node, bool notify=true)

Add a node to this executor.

Parameters:
  • nodeNode to add.

  • notify – If true, wake the executor so it picks up the change immediately.

AGNOCAST_PUBLIC void remove_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify=true)

Remove a node from this executor.

Parameters:
  • node_ptrNode to remove.

  • notify – If true, wake the executor so it picks up the change immediately.

AGNOCAST_PUBLIC void remove_node (const std::shared_ptr< agnocast::Node > &node, bool notify=true)

Remove a node from this executor.

Parameters:
  • nodeNode to remove.

  • notify – If true, wake the executor so it picks up the change immediately.

Protected Functions

WeakCallbackGroupsToNodesMap weak_groups_associated_with_executor_to_nodes_ RCPPUTILS_TSA_GUARDED_BY (mutex_)
WeakCallbackGroupsToNodesMap weak_groups_to_nodes_associated_with_executor_ RCPPUTILS_TSA_GUARDED_BY (mutex_)
std::list< rclcpp::node_interfaces::NodeBaseInterface::WeakPtr > weak_nodes_ RCPPUTILS_TSA_GUARDED_BY (mutex_)
bool get_next_agnocast_executable(AgnocastExecutable &agnocast_executable, const int timeout_ms, bool &shutdown_detected)
bool get_next_ready_agnocast_executable(AgnocastExecutable &agnocast_executable)
void execute_agnocast_executable(AgnocastExecutable &agnocast_executable)
bool is_callback_group_associated(const rclcpp::CallbackGroup::SharedPtr &group)
void add_callback_groups_from_nodes_associated_to_executor()

Protected Attributes

std::atomic_bool spinning_
int epoll_fd_
int shutdown_event_fd_
pid_t my_pid_
std::mutex ready_agnocast_executables_mutex_
std::vector<AgnocastExecutable> ready_agnocast_executables_
mutable std::mutex mutex_