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

Implement YarpParametersHandler bindings #309

Merged
merged 6 commits into from
May 26, 2021

Conversation

GiulioRomualdi
Copy link
Member

This PR implements the python bindings for the YarpParametersHandler class.

It is possible to load the parameters directly from the configuration file thanks to set_from_file method. While writing the tests I noticed a bug in the setParameter method for the YarpParametersHandler #308. I think this is te reason why the test is failing:

40: =================================== FAILURES ===================================
40: __________________________________ test_bool ___________________________________
40: 
40:     def test_bool():
40:     
40:         handler = blf.YarpParametersHandler()
40:     
40:         handler.set_parameter_bool(name="my_bool", value=True)
40:     
40: >       assert handler.get_parameter_bool(name="my_bool") is True
40: E       ValueError: Failed to find a parameter that matches the type
40: 
40: ../../../src/bipedal-locomotion-framework/bindings/python/ParametersHandler/tests/test_parameters_handler_yarp.py:13: ValueError
40: ----------------------------- Captured stdout call -----------------------------
40: [2021-05-24 16:37:43.244] [thread: 80274] [blf] [error] [BipedalLocomotion::YarpUtilities::getElementFromSearchable] The value named: my_bool is not a bool.
40: _______________________________ test_vector_bool _______________________________
40: 
40:     def test_vector_bool():
40:     
40:         handler = blf.YarpParametersHandler()
40:     
40:         handler.set_parameter_vector_bool(name="my_vector_bool",value= [True, False, True])
40:     
40:         assert handler.get_parameter_vector_bool(name="my_vector_bool") == [True, False, True]
40:     
40:         with pytest.raises(ValueError):
40: >           handler.get_parameter_vector_int(name="my_vector_bool")
40: E           Failed: DID NOT RAISE <class 'ValueError'>
40: 
40: ../../../src/bipedal-locomotion-framework/bindings/python/ParametersHandler/tests/test_parameters_handler_yarp.py:88: Failed
40: _______________________________ test_vector_int ________________________________
40: 
40:     def test_vector_int():
40:     
40:         handler = blf.YarpParametersHandler()
40:     
40:         handler.set_parameter_vector_int(name="my_vector_int", value=[-1, 2, 10])
40:     
40:         assert handler.get_parameter_vector_int(name="my_vector_int") == [-1, 2, 10]
40:     
40:         with pytest.raises(ValueError):
40: >           handler.get_parameter_vector_bool(name="my_vector_int")
40: E           Failed: DID NOT RAISE <class 'ValueError'>

Copy link
Member

@diegoferigo diegoferigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall the PR looks good to me 👍 I didn't catch anything off.

@traversaro traversaro removed their request for review May 24, 2021 15:20
@GiulioRomualdi
Copy link
Member Author

#311 should fix the error in the tests

@GiulioRomualdi GiulioRomualdi force-pushed the bindings/ParametersHandlerYarp branch 2 times, most recently from 4d6e123 to ebfeb54 Compare May 26, 2021 07:58
@GiulioRomualdi
Copy link
Member Author

GiulioRomualdi commented May 26, 2021

#313 should fix the last bug

@GiulioRomualdi GiulioRomualdi force-pushed the bindings/ParametersHandlerYarp branch from ebfeb54 to 98ade51 Compare May 26, 2021 11:01
@GiulioRomualdi
Copy link
Member Author

CI failure is now related to librealsense IntelRealSense/librealsense#9102

@GiulioRomualdi GiulioRomualdi force-pushed the bindings/ParametersHandlerYarp branch from 3c1e59b to f900479 Compare May 26, 2021 20:55
@GiulioRomualdi
Copy link
Member Author

Failure fixed in #314

@GiulioRomualdi GiulioRomualdi merged commit 8e174c2 into master May 26, 2021
@GiulioRomualdi GiulioRomualdi deleted the bindings/ParametersHandlerYarp branch May 26, 2021 21:16
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

Successfully merging this pull request may close these issues.

2 participants