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

Flask truncation of overwrite floats #577

Closed
dhblum opened this issue Sep 19, 2023 · 2 comments
Closed

Flask truncation of overwrite floats #577

dhblum opened this issue Sep 19, 2023 · 2 comments

Comments

@dhblum
Copy link
Collaborator

dhblum commented Sep 19, 2023

When writing overwrite values in /advance, the flask api in restapi.py seems to truncate floats, as they are converted to unicode by default. For example, for a particular timestep when running examples/python/testcase1_scenario.py:
Python controller sent:
{'oveAct_u': 63.82314159145608, 'oveAct_activate': 1}
Flask api sent to testcase.py:
{'oveAct_u': u'63.8231415915', 'oveAct_activate': u'1'}

On the surface this is not too much of an issue, but the rest api of boptest-service does not perform this truncation, and testing has revealed this makes a small numeric difference for the example feedback controllers for testcase1 and testcase3, causing unit tests to fail upon syncing boptest-service with the latest master branch.

This issue proposes to fix the Flask api by specifying that the overwrite value arguments in /advance be strictly defined as floats (using type=float option when defining the arguments of the api request here), which then removes any truncation from the api and delivers to testcase.py exactly what is expected.

dhblum added a commit that referenced this issue Sep 19, 2023
@dhblum dhblum mentioned this issue Sep 19, 2023
6 tasks
@dhblum
Copy link
Collaborator Author

dhblum commented Sep 21, 2023

Being addressed in #536.

@dhblum
Copy link
Collaborator Author

dhblum commented Oct 3, 2023

Closed by #536.

@dhblum dhblum closed this as completed Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant