flexbe_states.flexible_check_condition_state module

FlexibleCheckConditionState.

class flexbe_states.flexible_check_condition_state.FlexibleCheckConditionState(*args: Any, **kwargs: Any)

Bases: EventState

Implements a state that checks if the given condition is true.

Uses multiple userdata inputs provided as a list to the calculation function and returns the corresponding outcome.

This state can be used if the further control flow of the behavior depends on a simple condition.

– predicate function The condition whose truth value will be evaluated.

It could be a private function (self.foo) manually defined in a behavior’s source code or a lambda function (e.g., lambda x: x[0]**2 < 10 and x[1] == ‘hello’), where x is the list argument passed to the function.

– input_keys string[] List of available input keys.

># input_keys object[] Input(s) to the calculation function as a list of userdata.

The individual inputs can be accessed as list elements (see lambda expression example).

<= true Returned if the condition evaluates to True <= false Returned if the condition evaluates to False

execute(userdata)

Execute the state.

on_enter(userdata)

Call on entering state.