Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FlexibleCalculationState does not accept correct lambda expression #6

Open
tropappar opened this issue Apr 23, 2023 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@tropappar
Copy link

According to the help of the FlexibleCalculationState state, it requires a lambda function with a list argument (e.g., lambda x: x[0]^2 + x[1]^2) but that gives following error message:

python <lambda>() got an unexpected keyword argument

What works though is a lambda function with multiple arguments (e.g., lambda x1,x2: x1^2 + x2^2). However, the behavior cannot be saved because the checking function says:

Unable to save behavior: parameter calculation of state [...] has invalid value

My current workaround is to put any acceptable value in the calculation parameter field and put the correct, desired lambda function in the source code later. But this is quite tedious because it is always overwritten when the behavior is changed with the GUI.

@dcconner dcconner self-assigned this Apr 28, 2023
@dcconner dcconner added the bug Something isn't working label Apr 28, 2023
@dcconner
Copy link
Member

good news/bad news:

Bad news: This impacts a significant amount of code in the behavior parsing and checking. I do not plan to make this change to the flexbe_app

Good news: Next week (June 2024), we plan to release the beta version of a new flexbe_webui for iron, jazzy, and rolling that has several improvements to the state machine editing and checking, and I have tested a fix to handle more complex lambda expressions. It would be possible for a motivated individual to pick out the changes and port to flexbe_app, but I plan to devote development time to flexbe_webui going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants