Source code for genericroboticarm.sila_server.generated.intermediateactionplanning.intermediateactionplanning_base
# Generated by sila2.code_generator; sila2.__version__: 0.14.0
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, List, Union
from sila2.framework import Command, Feature, FullyQualifiedIdentifier, Property
from sila2.server import FeatureImplementationBase, MetadataDict
if TYPE_CHECKING:
from typing import TypeVar
from sila2.server import SilaServer
Server = TypeVar("Server", bound=SilaServer)
[docs]
class IntermediateActionPlanningBase(FeatureImplementationBase, ABC):
parent_server: Server
def __init__(self, parent_server: Server):
"""
Feature to announce the intermediate actions of a labware transfer before the transfer commands that
will carry them out are issued.
The "Labware Transfer Manipulator Controller" feature accepts intermediate actions only as a parameter of the
"Put Labware" and "Get Labware" commands, which are issued after both involved devices have finished their
"Prepare For ..." commands. Intermediate actions that do not involve the other device, like fetching a lid from
a lid storage, therefore cannot be executed while the other device is still preparing itself, although the
manipulator is idle during that time.
This feature provides the "Planned Intermediate Actions" metadata, which a client can send along with the
"Prepare For Input" command to announce the intermediate actions of the following "Get Labware" command. The
manipulator may then execute those parts of them that only concern itself while it prepares itself, and skip
them when they are requested again by the following "Get Labware" command. The "Preparable Intermediate
Actions" property tells which intermediate actions a manipulator handles that way.
Announcing intermediate actions does not change what the transfer commands have to be given: clients pass the
intermediate actions to the "Get Labware" command as usual, whether they announced them or not, and a
manipulator is free to ignore an announcement.
A manipulator that can act on announcements declares the "Prepare For Input" command of the "Labware Transfer
Manipulator Controller" feature as affected by the "Planned Intermediate Actions" metadata. Since SiLA requires
metadata to be sent with every call it affects, clients of such a manipulator have to send the metadata with
every "Prepare For Input" call, announcing an empty list of actions if there is nothing to announce. A
manipulator that cannot prepare any intermediate action declares no affected calls instead, so that its clients
do not have to know this feature at all. The "Preparable Intermediate Actions" property tells which of the two
a manipulator is.
"""
super().__init__(parent_server=parent_server)
[docs]
@abstractmethod
def get_PreparableIntermediateActions(self, *, metadata: MetadataDict) -> List[str]:
"""
The subset of the "Available Intermediate Actions" that this manipulator can already work on while it
prepares itself, if they were announced via the "Planned Intermediate Actions" metadata.
:param metadata: The SiLA Client Metadata attached to the call
:return: The subset of the "Available Intermediate Actions" that this manipulator can already work on while it
prepares itself, if they were announced via the "Planned Intermediate Actions" metadata.
"""
[docs]
@abstractmethod
def get_calls_affected_by_PlannedIntermediateActions(
self,
) -> List[Union[Feature, Command, Property, FullyQualifiedIdentifier]]:
"""
Returns the fully qualified identifiers of all features, commands and properties affected by the
SiLA Client Metadata 'PlannedIntermediateActions'.
**Description of 'PlannedIntermediateActions'**:
The intermediate actions that will be passed to the transfer command following the call this metadata
is sent with, in the same order. Sent with "Prepare For Input", it announces the intermediate actions of
the following "Get Labware" command, and may be empty. They are wrapped in a structure because SiLA Client
Metadata cannot be a plain list.
:return: Fully qualified identifiers of all features, commands and properties affected by the
SiLA Client Metadata 'PlannedIntermediateActions'.
"""