4 from flexbe_core
import EventState, Logger
9 @author: Philipp Schillinger 14 Implements a state that can perform a calculation based on userdata. 15 calculation is a function which takes exactly one parameter, input_value from userdata, 16 and its return value is stored in output_value after leaving the state. 18 -- calculation function The function that performs the desired calculation. 19 It could be a private function (self.foo) manually defined in a behavior's source code 20 or a lambda function (e.g., lambda x: x^2, where x will be the input_value). 22 ># input_value object Input to the calculation function. 24 #> output_value object The result of the calculation. 26 <= done Indicates completion of the calculation. 35 super(CalculationState, self).
__init__(outcomes=[
'done'],
36 input_keys=[
'input_value'],
37 output_keys=[
'output_value'])
44 '''Execute this state''' 57 except Exception
as e:
58 Logger.logwarn(
'Failed to execute calculation function!\n%s' % str(e))
60 Logger.logwarn(
'Passed no calculation!')
def __init__(self, calculation)
def on_enter(self, userdata)
def execute(self, userdata)