nopasaran.primitives.action_primitives.nested_machine_utils.NestedMachinePrimitives¶
- class nopasaran.primitives.action_primitives.nested_machine_utils.NestedMachinePrimitives¶
Bases:
objectClass containing primitives for interacting with nested state machines.
- __init__()¶
Methods
__init__()call(inputs, outputs, state_machine)Load a nested machine identified by the given name and call its start method with the provided parameters.
get_parameters(inputs, outputs, state_machine)Retrieve the parameters of the current nested state machine that were passed from the parent state machine using the 'call' primitive.
return_values(inputs, outputs, state_machine)This primitive is used within a nested state machine.
- static call(inputs, outputs, state_machine)¶
Load a nested machine identified by the given name and call its start method with the provided parameters. The mandatory input argument is the name of the nested state machine to call. The optional input arguments are the parameters assigned to the nested state machine. The optional output arguments are the values returned by the nested state machine and will be stored in the specified optional output variables. The number of optional output arguments should match the number of optional input arguments specified in the ‘return_values’ primitive used within the nested state machine.
Number of input arguments: 1
Number of output arguments: 0
Optional input arguments: Yes
Optional output arguments: Yes
- Args:
inputs (List[str]): The list of input variable names. It contains one mandatory input argument, which is the name of the nested state machine to call, and optional input arguments representing the parameters assigned to the nested state machine.
outputs (List[str]): The list of output variable names. It contains the names of the variables where the returned values will be stored (optional).
state_machine: The state machine object.
- Returns:
None
- static get_parameters(inputs, outputs, state_machine)¶
Retrieve the parameters of the current nested state machine that were passed from the parent state machine using the ‘call’ primitive. These parameters are optional input arguments specified in the ‘call’ action of the parent state machine. The retrieved parameter values will be stored in the specified optional output arguments for further use within the nested machine. The number of optional input arguments in the ‘call’ primitive and the number of output arguments in ‘get_parameters’ should match.
Number of input arguments: 0
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: Yes
- Args:
inputs (List[str]): The list of input variable names.
outputs (List[str]): The list of output variable names. It contains the names of the variables where the parameter values will be stored (optional).
state_machine: The state machine object.
- Returns:
None
- static return_values(inputs, outputs, state_machine)¶
This primitive is used within a nested state machine. It enables you to specify the values that will be returned by the nested state machine when it completes its execution. The returned values can be used by the calling state machine for further processing or decision-making.
Number of input arguments: 0
Number of output arguments: 0
Optional input arguments: Yes
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names.
outputs (List[str]): The list of output variable names.
state_machine: The state machine object.
- Returns:
None