-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add rate parameter to component interface #57
Conversation
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.
Looking good!
source/modulo_components/include/modulo_components/utilities/utilities.hpp
Outdated
Show resolved
Hide resolved
source/modulo_components/modulo_components/utilities/utilities.py
Outdated
Show resolved
Hide resolved
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.
For the descriptions, I would prefer to remove the period parameter now rather than have both. Or, to make the transition a bit more gradual, use the internal
property for period to hide it from public interfaces.
source/modulo_components/component_descriptions/modulo_component.json
Outdated
Show resolved
Hide resolved
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.
Last comment I think, then it's good to go
@@ -8,12 +8,20 @@ | |||
"registration": "modulo_components::Component", | |||
"inherits": "", | |||
"parameters": [ | |||
{ | |||
"display_name": "Rate", | |||
"description": "The frequency in Hertz for all periodic callbacks (this parameter overrides the period parameter)", |
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.
actually one last nitpick: since the rate parameter is now the "public" one and period is "internal", it's a bit weird to have this in the public description.
"description": "The frequency in Hertz for all periodic callbacks (this parameter overrides the period parameter)", | |
"description": "The frequency in Hertz for all periodic callbacks", |
"parameter_name": "rate", | ||
"parameter_type": "int", | ||
"default_value": "10" | ||
}, | ||
{ | ||
"display_name": "Period", | ||
"description": "The time interval in seconds for all periodic callbacks", |
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.
Instead, you can put the detailed description here for reference
"description": "The time interval in seconds for all periodic callbacks", | |
"description": "The time interval in seconds for all periodic callbacks. This parameter is deprecated and will be removed in the next major release. The rate parameter takes precedence and overrides the component period.", |
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.
🔥
Description
This PR solves the issue by adding the
rate
parameter to the component interface while keeping backwards compatibility with theperiod
parameter.In order to manage that, the parameter overrides of the node have to be modified before construction. Otherwise, the two parameters couldn't be made read only. It's a little bit hacky because we have no option to log messages or to intercept exceptions in a meaningful way at that point but I think it can work out quite well.
I was also able to confirm the desired behavior with a simple test case.
Review guidelines
Estimated Time of Review: 10 minutes
Checklist before merging: