robokudo.tree_components.query_based_task_scheduler

Query-based task scheduling for behavior trees.

This module provides a task scheduler that uses queries in the CAS (Common Analysis Structure) to determine which perception subtree to execute. It allows dynamic selection of perception pipelines based on the current query state.

Original implementation by Malte Huerkamp.

Classes

QueryBasedScheduler

A Task Scheduler that checks the active Query in the CAS to infer which perception subtree to execute.

Module Contents

class robokudo.tree_components.query_based_task_scheduler.QueryBasedScheduler(name='QueryBasedScheduler', tasks=None, filter_fn: Callable[[robokudo_msgs.action.Query.Goal], str] = None)

Bases: robokudo.tree_components.task_scheduler.TaskSchedulerBase, robokudo.annotators.core.BaseAnnotator

A Task Scheduler that checks the active Query in the CAS to infer which perception subtree to execute. You can apply a function to infer per use-case which perception tree you want to incorporate.

Original implementation by Malte Huerkamp

Variables:
  • tasks – Dictionary mapping task identifiers to behavior trees

  • filter_fn – Function that maps queries to task identifiers

tasks = None
filter_fn = None
setup(timeout: float = None, node: rclpy.node.Node = None, **kwargs)

Set up all task trees.

Parameters:
  • timeout (float) – Maximum time allowed for setup

  • node (rclpy.node.Node) – a ros node

Returns:

True if setup successful

Return type:

bool

plan_new_job() py_trees.composites.Sequence | None

Plan the next job based on the current query.

This method: * Gets the current query from CAS * Uses filter_fn to determine which task to run * Creates a new sequence with the selected task

Returns:

New job sequence containing selected task, or None if no task found

Return type:

Optional[py_trees.Sequence]