Class DelayedActionTaskRunner

Class Documentation

class DelayedActionTaskRunner

Background helper that runs actions at specific ROS times.

Uses a dedicated thread with a priority queue to execute callbacks once the node clock reaches a scheduled timestamp. Keeps waitset/service threads free from long sleeps.

Public Functions

explicit DelayedActionTaskRunner(rclcpp::Node *node)

Construct a runner bound to the provided node.

Parameters:

node – Node used for logging and to query current time.

~DelayedActionTaskRunner()

Default destructor.

void start()

Start the background thread.

Note

Subsequent calls are no-ops while the thread is running.

void stop()

Stop the background thread and clear outstanding actions.

Note

Safe to call multiple times.

void schedule(const rclcpp::Time &scheduled_time, std::function<void()> action, const std::string &description)

Schedule an action at a specific ROS time.

Parameters:
  • scheduled_time – Absolute time when the action should fire.

  • action – Callback executed when scheduled time is reached.

  • description – Human-readable label used for debug logging.