Work in progress: this documentation is still being written and reviewed. Check details against the source code.

Demo task orchestrator๏ƒ

Dispatch demo print and named-state motion tasks in sequence.

src.demos.hello_orchestrator_py.scripts.orchestrator_server ยท Source

Examples and demos ยท Guide ยท Symbol index

How it is used๏ƒ

The teaching orchestrator receives one demo JSON sequence, dispatches print or named-state move actions, and publishes progress between steps. Follow _execute() for sequencing and _dispatch_print() / _dispatch_move() for the child requests. ROS invokes the admission, cancellation, and execution callbacks.

Cancellation is checked between tasks. A child timeout fails the sequence without canceling that child. The implementation retains the default callback group and executor configuration; it is not the production EROBS orchestrator.

Start here๏ƒ

Callable

Purpose

main

Initialize ROS and the demo orchestrator, spin until interrupted and clean up in finally.

OrchestratorServer._execute

Run demo print and move tasks in order, publish step feedback, and count completed tasks. Check cancellation between tasks; abort for a missing or unknown type or a failed child action.

OrchestratorServer._dispatch_print

Require message, populate a PrintMessage goal and invoke the print client with a ten-second result deadline.

OrchestratorServer._dispatch_move

Require target_pose, populate a MoveToNamedState goal and invoke the move client with a 60-second result deadline.

Functions๏ƒ

main()๏ƒ

Initialize ROS and the demo orchestrator, spin until interrupted and clean up in finally.

Entry point ยท Source

main(args=None)

Parameter

Meaning

args

Optional ROS initialization arguments.

Returns: None after spin ends.

Errors: KeyboardInterrupt during spin is swallowed; construction errors precede the cleanup try and can bypass it.

Side effects: Starts/spins/destroys the orchestrator node and ROS context.

OrchestratorServer๏ƒ

A ROS action node that interprets the demo task schema and sequences its print and motion child actions.

Inherits from: Node.

OrchestratorServer._execute()๏ƒ

Run demo print and move tasks in order, publish step feedback, and count completed tasks. Check cancellation between tasks; abort for a missing or unknown type or a failed child action.

Method ยท Source

_execute(self, goal_handle: ServerGoalHandle) -> OrchestratorTask.Result

Parameter

Meaning

goal_handle

Handle carrying request.task_json with tasks list of mappings.

Returns: Result {success,completed_steps,error_message}; empty task list succeeds; cancellation/failure preserves completed count.

Errors: JSONDecodeError/missing tasks KeyError become aborted invalid-JSON result. Wrong JSON/task types, dispatch exceptions and callback failures are not caught. Cancellation after the final task can be missed because no final check runs.

Side effects: Executes child print/move actions, publishes feedback, logs and sets parent action terminal state.

Referenced in source (1)

OrchestratorServer._dispatch_print()๏ƒ

Require message, populate a PrintMessage goal and invoke the print client with a ten-second result deadline.

Internal helper ยท Source

_dispatch_print(self, task: dict) -> bool

Parameter

Meaning

task

Mapping with message string; other keys are ignored.

Returns: False for missing message, otherwise child action Boolean.

Errors: Message type/send/future errors propagate; missing field logs.

Side effects: Sends a logging task through print_message_py.

Referenced in source (1)

OrchestratorServer._dispatch_move()๏ƒ

Require target_pose, populate a MoveToNamedState goal and invoke the move client with a 60-second result deadline.

Internal helper ยท Source

_dispatch_move(self, task: dict) -> bool

Parameter

Meaning

task

Mapping with target_pose SRDF named-state string.

Returns: False for missing target_pose, otherwise child action Boolean.

Errors: Malformed goal/send/future errors propagate; missing field logs.

Side effects: May command robot movement through move_to_named_state_py.

Referenced in source (1)

OrchestratorServer.__init__()๏ƒ

Create print/move clients and the orchestrator_task_py action server with busy-goal and cancellation callbacks.

Lifecycle ยท Source

__init__(self)

Errors: ROS initialization/client/server errors propagate.

Side effects: Creates orchestrator_server_py node and three action interfaces, then logs startup.

Referenced in source (1)
  • main โ€” src.demos.hello_orchestrator_py.scripts.orchestrator_server

Internal callbacks and helpers๏ƒ

OrchestratorServer._goal_callback()๏ƒ

Accept goals only while _executing is false, without inspecting their JSON.

Callback ยท Source

_goal_callback(self, goal_request) -> GoalResponse

Parameter

Meaning

goal_request

Incoming OrchestratorTask goal; unused.

Returns: ACCEPT when idle, REJECT when busy.

Errors: No JSON validation at acceptance; flag is set later in execute callback.

Side effects: Logs busy rejection.

Referenced in source (1)

OrchestratorServer._cancel_callback()๏ƒ

Accept cancellation; execution will inspect it before dispatching the next task.

Callback ยท Source

_cancel_callback(self, goal_handle: ServerGoalHandle) -> CancelResponse

Parameter

Meaning

goal_handle

Current action goal handle; unused by this callback.

Returns: CancelResponse.ACCEPT.

Errors: No local failure handling.

Side effects: No direct child cancellation or motion stop; returns acceptance only.

Referenced in source (1)

OrchestratorServer._execute_callback()๏ƒ

Wrap _execute with the busy flag and clear it in finally.

Callback ยท Source

_execute_callback(self, goal_handle: ServerGoalHandle)

Parameter

Meaning

goal_handle

Accepted OrchestratorTask server handle.

Returns: OrchestratorTask.Result returned by _execute.

Errors: Exceptions propagate while _executing is still reset.

Side effects: Updates busy state and dispatches execution.

Referenced in source (1)

OrchestratorServer._call_action()๏ƒ

Wait five seconds for a child server, up to ten seconds for acceptance and timeout_sec for completion; expose the child payload success.

Internal helper ยท Source

_call_action(self, client, goal, timeout_sec: float=60.0) -> bool

Parameter

Meaning

client

ROS ActionClient for PrintMessage or MoveToNamedState.

goal

Matching generated child goal.

timeout_sec

Seconds to wait for child result, additional to discovery/acceptance waits.

Returns: False for unavailable server, acceptance timeout/rejection or result timeout; otherwise child result.success.

Errors: Future/malformed-result errors propagate. A timed-out or late-accepted goal is not canceled, so child work may continue after False.

Side effects: Sends child action, synchronously spins ROS within the parent callback and logs failures.

Referenced in source (2)