Class CallbackIsolatedAgnocastExecutor

Inheritance Relationships

Base Type

  • public rclcpp::Executor

Class Documentation

class CallbackIsolatedAgnocastExecutor : public rclcpp::Executor

Callback-isolated executor for Stage 1. Assigns a dedicated thread to each callback group, ensuring that callbacks in different groups never run concurrently on the same thread. Handles both ROS 2 and Agnocast callbacks.

Public Functions

explicit AGNOCAST_PUBLIC CallbackIsolatedAgnocastExecutor(const rclcpp::ExecutorOptions &options = rclcpp::ExecutorOptions(), int next_exec_timeout_ms = 50, int monitor_polling_interval_ms = 100)

Construct the executor.

Parameters:
  • options – Executor options.

  • next_exec_timeout_ms – Timeout in ms for waiting on the next executable.

  • monitor_polling_interval_ms – Polling interval in ms for monitoring new callback groups.

AGNOCAST_PUBLIC void spin () override

Block the calling thread and process callbacks in a loop until rclcpp::shutdown() is called or the executor is cancelled.

AGNOCAST_PUBLIC void cancel ()

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

void stop_callback_group(const rclcpp::CallbackGroup::SharedPtr &group_ptr)

Stop the child executor running the given callback group, join its thread, and remove it. If group_ptr is nullptr or not found, this is a no-op.

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

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 std::vector< rclcpp::CallbackGroup::WeakPtr > get_all_callback_groups () override

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 () override

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 () override

Return callback groups automatically discovered from added nodes.

Returns:

Vector of weak pointers to callback groups.

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

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 void add_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify=true) override

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 (rclcpp::Node::SharedPtr node_ptr, bool notify=true) override

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 remove_node (rclcpp::node_interfaces::NodeBaseInterface::SharedPtr node_ptr, bool notify=true) override

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 (rclcpp::Node::SharedPtr node_ptr, bool notify=true) override

Remove a node from this executor.

Parameters:
  • node_ptrNode to remove.

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