flexbe_states.calculation_state module

CalculationState.

class flexbe_states.calculation_state.CalculationState(*args: Any, **kwargs: Any)

Bases: EventState

Implements a state that can perform a calculation based on userdata.

calculation is a function which takes exactly one parameter, input_value from userdata, and its return value is stored in output_value after leaving the state.

– 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 lambda function (e.g., lambda x: x^2, where x will be the input_value).

># input_value object Input to the calculation function.

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

Call calculation on entering state.