4 from flexbe_core
import EventState, Logger
9 @author: Philipp Schillinger 14 Implements a state that can perform a calculation based on multiple userdata inputs provided as a list to the calculation function. 16 -- calculation function The function that performs the desired calculation. 17 It could be a private function (self.foo) manually defined in a behavior's source code 18 or a lambda function (e.g., lambda x: x[0]^2 + x[1]^2). 19 -- input_keys string[] List of available input keys. 21 ># input_keys object[] Input(s) to the calculation function as a list of userdata. 22 The individual inputs can be accessed as list elements (see lambda expression example). 24 #> output_value object The result of the calculation. 26 <= done Indicates completion of the calculation. 33 super(FlexibleCalculationState, self).
__init__(outcomes=[
'done'],
34 input_keys=input_keys,
35 output_keys=[
'output_value'])
43 '''Execute this state''' 56 except Exception
as e:
57 Logger.logwarn(
'Failed to execute calculation function!\n%s' % str(e))
59 Logger.logwarn(
'Passed no calculation!')
def __init__(self, calculation, input_keys)
def execute(self, userdata)
def on_enter(self, userdata)