Skip to main content

intrinsic.solutions.execution.Executive

Wrapper for the Executive gRPC service.

stub

The gRPC stub to be used for communication with the executive service.

blackboard_stub

The gRPC stub to be used for blackboard related calls.

error_loader

Can load ErrorReports about executions

simulation

The workcell simulation module (optional).

polling_interval_in_seconds

Number of seconds to wait while polling for the operation state in blocking calls such as Executive.suspend().

execution_mode

Currently set mode of execution (normal or step-wise).

operation

simulation_mode

Currently set mode of simulation (physics or kinematics).

Child Classes

class ExecutionMode

class ResumeMode

class SimulationMode

Methods

await_value

View source

Blocks until a key is available on the blackboard.

While the key is available await_value will always return immediately until the key is removed. Changes in value are not reflected.

Args

value

wait for this value to be available on the blackboard

block_until_completed

View source

Waits until plan execution has begun and then stops.

Polls executive state every self._polling_interval_in_seconds.

Args

silence_outputs

If true, do not show success or error outputs of the execution in Jupyter.

Raises

ExecutionFailedError

On unexpected state of the executive during plan execution.

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

cancel

View source

Cancels plan execution and blocks until execution finishes.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

solutions_errors.InvalidArgumentError

On operation not in RUNNING state.

grpc.RpcError

On any other gRPC error.

cancel_async

View source

Asynchronously cancels plan execution; returns immediately.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

solutions_errors.InvalidArgumentError

On operation not in RUNNING state.

grpc.RpcError

On any other gRPC error.

connect

View source

Connect to a running executive.

Args

grpc_channel

Channel to the executive gRPC service.

error_loader

Loads error data for executive runs.

simulation

The workcell simulation module (optional).

polling_interval_in_seconds

Number of seconds to wait while polling for the operation state in blocking calls such as Executive.suspend().

Returns

A newly created instance of the Executive wrapper class.

get_errors

View source

Loads and optionally prints errors from current, failed operation.

Args

print_level

If not set to 'OFF', error reports are printed.

Returns

Error summaries.

get_value

View source

Gets the actual data written for the specified value on the blackboard.

Args

value

the value to get actual data for

Returns

Value as read from the blackboard

Raises

ValueNotAvailable error in case the value has not yet been resolved ValueError if the received value is not of the expected type based on the return value description of the skill

is_value_available

View source

Checks whether a value is available on the blackboard.

Args

value

check availability for this value

Returns

True if a value has been set False otherwise

load

View source

Loads an action or behavior tree into the executive.

Note that an action can be a general action or any skill obtained through skills.

Args

behavior_tree_or_action

A behavior tree, a list of actions (can be nested one level) or a single action.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

reset

View source

Resets the current operation to the state from when it was loaded.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

resume

View source

Resumes plan execution (SUSPENDED --> RUNNING).

Args

mode

The resume mode, STEP and NEXT work when in step-wise execution mode, CONTINUE will switch to NORMAL execution mode before resume.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

solutions_errors.InvalidArgumentError

On executive not in SUSPENDED state.

grpc.RpcError

On any other gRPC error.

run

View source

Executes an action or plan and blocks until completion.

This corresponds to running load and start after one another.

Note that an action can be a general action or any skill obtained through Skills.

If plan_or_action is None, runs the initial plan as specified in the Kubernetes template.

Implicitly calls simulation.reset() if this is the first action or plan being executed (after an executive.reset()). This makes sure that any world edits that might have occurred are reflected in the simulation.

Args

plan_or_action

A behavior tree, a list of actions (can be nested one level), or a single action.

silence_outputs

If true, do not show success or error outputs of the execution in Jupyter.

step_wise

Execute step-wise, i.e., suspend after each node of the tree.

start_node

Run the specified node as if it were the root node of a tree instead of the complete tree.

simulation_mode

Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive.

embed_skill_traces

If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces.

Raises

ExecutionFailedError

On unexpected state of the executive during plan execution.

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

Returns

The start and end timestamps which can be used to query the logs.

run_async

View source

Requests execution of an action or plan and returns immediately.

Note that an action can be a general action or any skill obtained through Skills.

If plan_or_action is None, runs the initial plan as specified in the Kubernetes template.

Implicitly calls simulation.reset() if this is the first action or plan being executed (after an executive.reset()). This makes sure that any world edits that might have occurred are reflected in the simulation.

Args

plan_or_action

A behavior tree, list of actions, or a single action or skill.

silence_outputs

If true, do not show success or error outputs of the execution in Jupyter.

step_wise

Execute step-wise, i.e., suspend after each node of the tree.

start_node

Run the specified node as if it were the root node of a tree instead of the complete tree.

simulation_mode

Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive.

embed_skill_traces

If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

start

View source

Starts the currently loaded plan.

Args

blocking

If True, waits until execution finishes. Otherwise, returns immediately after starting.

silence_outputs

If true, do not show success or error outputs of the execution in Jupyter.

step_wise

Execute step-wise, i.e., suspend after each node of the tree.

start_node

Start only the specified node instead of the complete tree.

simulation_mode

Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive.

embed_skill_traces

If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

grpc.RpcError

On any other gRPC error.

suspend

View source

Requests to suspend plan execution and blocks until SUSPENDED.

Since the executive currently cannot preempt running skills, this function waits until all running skills have terminated.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

solutions_errors.InvalidArgumentError

On executive not in RUNNING state.

grpc.RpcError

On any other gRPC error.

suspend_async

View source

Requests to suspend plan execution and returns immediately.

Raises

solutions_errors.UnavailableError

On executive service not reachable.

solutions_errors.InvalidArgumentError

On executive not in RUNNING state.

grpc.RpcError

On any other gRPC error.