Source code for genericroboticarm.sila_server.feature_implementations.intermediateactionplanning_impl
# Generated by sila2.code_generator; sila2.__version__: 0.14.0
from __future__ import annotations
from typing import TYPE_CHECKING, List, Union
from sila2.framework import Command, Feature, FullyQualifiedIdentifier, Property
from sila2.server import MetadataDict
from ..generated.intermediateactionplanning import IntermediateActionPlanningBase
from ..generated.labwaretransfermanipulatorcontroller import LabwareTransferManipulatorControllerFeature
from genericroboticarm.robo_APIs import InteractiveTransfer
if TYPE_CHECKING:
from ..server import Server
[docs]
class IntermediateActionPlanningImpl(IntermediateActionPlanningBase):
robot: InteractiveTransfer
def __init__(self, parent_server: Server) -> None:
super().__init__(parent_server=parent_server)
assert isinstance(parent_server.robot, InteractiveTransfer)
self.robot = parent_server.robot
[docs]
def get_PreparableIntermediateActions(self, *, metadata: MetadataDict) -> List[str]:
return self.robot.preparable_intermediate_actions
[docs]
def get_calls_affected_by_PlannedIntermediateActions(
self,
) -> List[Union[Feature, Command, Property, FullyQualifiedIdentifier]]:
# PrepareForInput is the only transfer command that can make use of announced actions: it
# is the one that runs while the arm would otherwise wait for the other device.
# Metadata is only delivered to the calls it is declared for, and then it has to be sent
# with every one of them. So an arm that cannot prepare any intermediate action declares
# nothing here and its clients do not have to know this feature at all.
if not self.robot.preparable_intermediate_actions:
return []
return [LabwareTransferManipulatorControllerFeature["PrepareForInput"]]