4 from flexbe_core
import EventState, Logger
14 Implements a state that checks if the given condition is true based on multiple userdata inputs provided as a list to the calculation function 15 and returns the corresponding outcome. 16 This state can be used if the further control flow of the behavior depends on a simple condition. 18 -- predicate function The condition whose truth value will be evaluated. 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[0]^2 + x[1]^2). 21 -- input_keys string[] List of available input keys. 23 ># input_keys object[] Input(s) to the calculation function as a list of userdata. 24 The individual inputs can be accessed as list elements (see lambda expression example). 26 <= true Returned if the condition evaluates to True 27 <= false Returned if the condition evaluates to False 34 super(FlexibleCheckConditionState, self).
__init__(outcomes=[
'true',
'false'],
35 input_keys=input_keys)
43 '''Execute this state''' 53 except Exception
as e:
54 Logger.logwarn(
'Failed to execute condition function!\n%s' % str(e))
56 Logger.logwarn(
'Passed no predicate!')
def __init__(self, predicate, input_keys)
def execute(self, userdata)
def on_enter(self, userdata)