flexbe_states.flexible_calculation_state module

FlexibleCalculationState.

class flexbe_states.flexible_calculation_state.FlexibleCalculationState(*args: Any, **kwargs: Any)

Bases: EventState

Implements a state that can perform a calculation.

Calculation is based on multiple userdata inputs provided as a list to the calculation function.

– calculation function The function that performs the desired calculation.

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

– input_keys string[] List of userdata keys used to create a list of input data for calculation.

># 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).

#> output_value object The result of the calculation.

<= done Indicates completion of the calculation.

execute(userdata)

Set userdata with calculation result and return done.

on_enter(userdata)

Do calculation on entering state.