2 from flexbe_core
import EventState, Logger
7 Implements a state that can perform a calculation based on multiple userdata inputs 8 provided as a list to the calculation function. 10 -- calculation function The function that performs the desired calculation. 11 It could be a private function (self.foo) manually defined in a behavior's source code 12 or a lambda function (e.g., lambda x: x[0]^2 + x[1]^2). 13 -- input_keys string[] List of available input keys. 15 ># input_keys object[] Input(s) to the calculation function as a list of userdata. 16 The individual inputs can be accessed as list elements (see lambda expression example). 18 #> output_value object The result of the calculation. 20 <= done Indicates completion of the calculation. 24 super(FlexibleCalculationState, self).
__init__(outcomes=[
'done'],
25 input_keys=input_keys,
26 output_keys=[
'output_value'])
39 except Exception
as e:
40 Logger.logwarn(
'Failed to execute calculation function!\n%s' % str(e))
42 Logger.logwarn(
'Passed no calculation!')
def __init__(self, calculation, input_keys)
def execute(self, userdata)
def on_enter(self, userdata)