-
Notifications
You must be signed in to change notification settings - Fork 38
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
Populate Range Constraints in Parameter Descriptors from Validation Functions #103
Merged
tylerjw
merged 14 commits into
PickNikRobotics:main
from
chancecardona:pr-add-descriptor-validators
Apr 12, 2023
Merged
Populate Range Constraints in Parameter Descriptors from Validation Functions #103
tylerjw
merged 14 commits into
PickNikRobotics:main
from
chancecardona:pr-add-descriptor-validators
Apr 12, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…dded validation test yaml
… bounds when appropriate.
…s for multiple validations
tylerjw
reviewed
Apr 11, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small comment, otherwise, this looks good. Thank you for this nice feature 🍾
..._parameter_library_py/generate_parameter_library_py/jinja_templates/parameter_library_header
Outdated
Show resolved
Hide resolved
tylerjw
approved these changes
Apr 12, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves Issue 96.
This uses the
declare_parameter
anddeclare_runtime_parameter
templates to populate the parameter descriptor.For this, some string checking on the validation function was added to see if it was appropriate to populate the Descriptor range constraints. In the jinja templates I simply check against the string name of the validation function and the number of arguments. This should work in all cases here, but strange things may happen if another validation function with a substring of "gt" or "lt" with 1 argument, or "bounds" with 2 args is either created in RSL or in a user defined validation function. For this purpose I figure this is acceptable.
This also may not allow setting of the descriptors dynamically (only in the declaration) but that can be a future work (unless it's a simple change) if it's a desired feature.
This should work for the RSL validation functions:
bounds
,element_bounds
,lower_bounds
,upper_bounds
,gt_eq
,lt_eq
,gt
, andlt
validation functions by using std::numerical_limits library to populate the correspondingto_value
orfrom_value
that's not defined with eithermax()
orlowest()
for that parameter cpp type.To assist in Unit Tests, a
get_descriptors
method was also added in theparameter_library_header
template.Finally, a Unit Test was created in the
example
directory and should run whencolcon test
is run.