2 from flexbe_core
import EventState, Logger
7 Implements a state that can perform a calculation based on userdata. 8 calculation is a function which takes exactly one parameter, input_value from userdata, 9 and its return value is stored in output_value after leaving the state. 11 -- calculation function The function that performs the desired calculation. 12 It could be a private function (self.foo) manually defined in a behavior's source code 13 or a lambda function (e.g., lambda x: x^2, where x will be the input_value). 15 ># input_value object Input to the calculation function. 17 #> output_value object The result of the calculation. 19 <= done Indicates completion of the calculation. 23 super(CalculationState, self).
__init__(outcomes=[
'done'],
24 input_keys=[
'input_value'],
25 output_keys=[
'output_value'])
38 except Exception
as e:
39 Logger.logwarn(
'Failed to execute calculation function!\n%s' % str(e))
41 Logger.logwarn(
'Passed no calculation!')
def __init__(self, calculation)
def on_enter(self, userdata)
def execute(self, userdata)