-
Notifications
You must be signed in to change notification settings - Fork 664
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
Allow letting value field empty for numeric ports #854
base: master
Are you sure you want to change the base?
Allow letting value field empty for numeric ports #854
Conversation
Note this functionality was definitely available on v4.4.2 and has broken somewhere since then |
Unit tests are failing. Please remember to run the tests before submitting a PR :) |
@facontidavide 🙇 my bad.. I was expecting that CI runs automatically. @tony-p I saw that this behavior change was introduced with commit 6c9929c, following the discussion on issue #768, opened by @KentaKato. All that said, I have not used the complex type construction from string feature. So far I have only set numeric, boolean and string values. So it can be that I'm missing some important point. |
Looking at those issues, this seems like a backwards compatibility issue for behavior trees generated with groot2. in older versions <1.5.2, an empty string would be assigned to all unassigned ports, whereas they should have been left out of the xml all together. As was the issue for complex types, an empty string is not always the same as a null pointer (empty string can have meaning). Using the latest groot2, if you were to create a new tree with newly generated models, everything should work as expected (as now the ports are left out of the generated BT). (As we are observing the same problem) there are kind of 2 solutions:
The first place I observe it is for output ports. I think an empty string for these can be safely assumed to be unassigned as values need to be assigned to a blackboard value for further use. For input ports, maybe trying to carve out a difference in meaning for non nullable types is probably the best option |
🤔 |
Unlike on v3, on v4 you cannot let the value field empty for numeric ports. You get this parsing error:
I think v3 behavior was nicer cause it gives you a clean way to make your numeric fields optional:
empty string -> null_optional value -> use your default
On v4 you need to provide a value that you know is a default (e.g. nan), but nobody else will know. This is awkward and different from string values, where empty string is allowed.
Disclaimer: I didn't dig deep into the code, so not sure that this is the best implementation. It just replicate v3 behavior.