intrinsic.solutions.execution.Executive
![]() View source on GitHub |
Wrapper for the Executive gRPC service.
intrinsic.solutions.execution.Executive(
stub: executive_service_pb2_grpc.ExecutiveServiceStub,
blackboard_stub: blackboard_service_pb2_grpc.ExecutiveBlackboardStub,
error_loader: error_processing.ErrorsLoader,
simulation: Optional[intrinsic.solutions.simulation.Simulation] = None,
polling_interval_in_seconds: float = _DEFAULT_POLLING_INTERVAL_IN_SECONDS
)
Args | |
|---|---|
The gRPC stub to be used for communication with the executive service. | |
The gRPC stub to be used for blackboard related calls. | |
Can load ErrorReports about executions | |
The workcell simulation module (optional). | |
Number of seconds to wait while polling for the operation state in blocking calls such as Executive.suspend(). | |
Attributes | |
|---|---|
Currently set mode of execution (normal or step-wise). | |
Currently set mode of simulation (physics or kinematics). | |
Child Classes
Methods
await_value
View source
await_value(
value: blackboard_value.BlackboardValue
) -> None
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 | |
|---|---|
| wait for this value to be available on the blackboard |
block_until_completed
View source
block_until_completed(
*, silence_outputs: bool = False
) -> None
Waits until plan execution has begun and then stops.
Polls executive state every self._polling_interval_in_seconds.
| Args | |
|---|---|
| If true, do not show success or error outputs of the execution in Jupyter. |
| Raises | |
|---|---|
| On unexpected state of the executive during plan execution. |
| On executive service not reachable. |
| On any other gRPC error. |
cancel
View source
cancel() -> None
Cancels plan execution and blocks until execution finishes.
| Raises | |
|---|---|
| On executive service not reachable. |
| On operation not in RUNNING state. |
| On any other gRPC error. |
cancel_async
View source
cancel_async() -> None
Asynchronously cancels plan execution; returns immediately.
| Raises | |
|---|---|
| On executive service not reachable. |
| On operation not in RUNNING state. |
| On any other gRPC error. |
connect
View source
@classmethodconnect( grpc_channel: grpc.Channel, error_loader: error_processing.ErrorsLoader, simulation: Optional[intrinsic.solutions.simulation.Simulation] = None, polling_interval_in_seconds: float = _DEFAULT_POLLING_INTERVAL_IN_SECONDS ) -> 'Executive'
Connect to a running executive.
| Args | |
|---|---|
| Channel to the executive gRPC service. |
| Loads error data for executive runs. |
| The workcell simulation module (optional). |
| 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
get_errors(
print_level: error_processing.PrintLevel = error_processing.PrintLevel.OFF
) -> error_processing.ErrorGroup
Loads and optionally prints errors from current, failed operation.
| Args | |
|---|---|
| If not set to 'OFF', error reports are printed. |
| Returns | |
|---|---|
Error summaries. |
get_value
View source
get_value(
value: blackboard_value.BlackboardValue
) -> Any
Gets the actual data written for the specified value on the blackboard.
| Args | |
|---|---|
| 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
is_value_available(
value: blackboard_value.BlackboardValue
) -> bool
Checks whether a value is available on the blackboard.
| Args | |
|---|---|
| check availability for this value |
| Returns | |
|---|---|
True if a value has been set False otherwise |
load
View source
load(
behavior_tree_or_action: Optional[BehaviorTreeOrActionType]
) -> None
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 | |
|---|---|
| A behavior tree, a list of actions (can be nested one level) or a single action. |
| Raises | |
|---|---|
| On executive service not reachable. |
| On any other gRPC error. |
reset
View source
reset() -> None
Resets the current operation to the state from when it was loaded.
| Raises | |
|---|---|
| On executive service not reachable. |
| On any other gRPC error. |
resume
View source
resume(
mode: Optional['Executive.ResumeMode'] = None
) -> None
Resumes plan execution (SUSPENDED --> RUNNING).
| Args | |
|---|---|
| The resume mode, STEP and NEXT work when in step-wise execution mode, CONTINUE will switch to NORMAL execution mode before resume. |
| Raises | |
|---|---|
| On executive service not reachable. |
| On executive not in SUSPENDED state. |
| On any other gRPC error. |
run
View source
run(
plan_or_action: Optional[BehaviorTreeOrActionType],
*,
silence_outputs: bool = False,
step_wise: bool = False,
start_node: Optional[intrinsic.solutions.behavior_tree.NodeIdentifierType] = None,
simulation_mode: Optional['Executive.SimulationMode'] = None,
embed_skill_traces: bool = False
)
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 | |
|---|---|
| A behavior tree, a list of actions (can be nested one level), or a single action. |
| If true, do not show success or error outputs of the execution in Jupyter. |
| Execute step-wise, i.e., suspend after each node of the tree. |
| Run the specified node as if it were the root node of a tree instead of the complete tree. |
| Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive. |
| If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces. |
| Raises | |
|---|---|
| On unexpected state of the executive during plan execution. |
| On executive service not reachable. |
| On any other gRPC error. |
| Returns | |
|---|---|
The start and end timestamps which can be used to query the logs. |
run_async
View source
run_async(
plan_or_action: Optional[BehaviorTreeOrActionType] = None,
*,
silence_outputs: bool = False,
step_wise: bool = False,
start_node: Optional[intrinsic.solutions.behavior_tree.NodeIdentifierType] = None,
simulation_mode: Optional['Executive.SimulationMode'] = None,
embed_skill_traces: bool = False
)
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 | |
|---|---|
| A behavior tree, list of actions, or a single action or skill. |
| If true, do not show success or error outputs of the execution in Jupyter. |
| Execute step-wise, i.e., suspend after each node of the tree. |
| Run the specified node as if it were the root node of a tree instead of the complete tree. |
| Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive. |
| If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces. |
| Raises | |
|---|---|
| On executive service not reachable. |
| On any other gRPC error. |
start
View source
start(
blocking: bool = True,
silence_outputs: bool = False,
*,
step_wise: bool = False,
start_node: Optional[intrinsic.solutions.behavior_tree.NodeIdentifierType] = None,
simulation_mode: Optional['Executive.SimulationMode'] = None,
embed_skill_traces: bool = False
) -> None
Starts the currently loaded plan.
| Args | |
|---|---|
| If True, waits until execution finishes. Otherwise, returns immediately after starting. |
| If true, do not show success or error outputs of the execution in Jupyter. |
| Execute step-wise, i.e., suspend after each node of the tree. |
| Start only the specified node instead of the complete tree. |
| Set the simulation mode on the start request. If None will execute in whatever mode is currently set in the executive. |
| If true, execution traces in Google Cloud will incorporate all information from skill traces, otherwise execution traces contain links to individual skill traces. |
| Raises | |
|---|---|
| On executive service not reachable. |
| On any other gRPC error. |
suspend
View source
suspend() -> None
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 | |
|---|---|
| On executive service not reachable. |
| On executive not in RUNNING state. |
| On any other gRPC error. |
suspend_async
View source
suspend_async() -> None
Requests to suspend plan execution and returns immediately.
| Raises | |
|---|---|
| On executive service not reachable. |
| On executive not in RUNNING state. |
| On any other gRPC error. |
