Task batching
Group adjacent moveto and end_effector tasks for one MTC plan while preserving task order. Every other task type forms a single unit.
beambot.core.task_batching · Source
Task execution · Guide · Symbol index
How it is used
After parsing, the orchestrator passes the ordered task list to group_into_batches(). Adjacent moveto and end_effector tasks become one MTC planning unit; a tool exchange, pause, vision task, or other task separates those runs.
The function only groups dictionaries. It does not validate, plan, or execute them. A group can be marked batched even when it contains just one eligible task; disabling batching makes every task a single unit.
Start here
Callable |
Purpose |
|---|---|
Group adjacent motion and gripper tasks while preserving order. Other task types remain single units; even one eligible task forms a |
Example
For grouping purposes, only task_type is inspected. These abbreviated dictionaries illustrate the order; a complete executable task document needs each operation’s required fields.
from beambot.core.task_batching import group_into_batches
tasks = [
{"task_type": "moveto"},
{"task_type": "end_effector"},
{"task_type": "pause"},
{"task_type": "moveto"},
]
groups = group_into_batches(tasks)
assert [(kind, len(items)) for kind, items in groups] == [
("batched", 2), # arm move and gripper state share one plan
("single", 1), # pause remains separate
("batched", 1), # the next motion starts a new planning unit
]
Functions
group_into_batches()
Group adjacent motion and gripper tasks while preserving order. Other task types remain single units; even one eligible task forms a batched unit.
Entry point · Source
group_into_batches(
tasks: list[dict[str, Any]],
enabled: bool = True,
) -> list[tuple[str, list[dict[str, Any]]]]
Parameter |
Meaning |
|---|---|
|
Ordered task dictionaries; returned groups retain the original task objects. |
|
Enable grouping; false returns one single unit per task. |
Returns: Ordered list of (batched_or_single, task_list) tuples; empty input produces an empty list.
Errors: Malformed non-mapping task elements raise during .get access; task fields are otherwise not validated.
Side effects: None; input task dictionaries are not changed.
Referenced in source (1)
MTCOrchestratorServer._execute— beambot.action_servers.orchestrator