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
Parameters support ranges #72
Conversation
Proposed a change to add description strings here: #73 |
In #71 we talked about potentially supporting minimum and maximum constraints separately which I don't see supported here. @jacobperron suggested using arrays to make one end optional. Or we could encode them as separate constraints. The other thing that we aren't supporting here is open intervals. I'm not sure that we need to but wanted to make sure it was a conscious decision. |
And over there I suggested you make a pr to this pr to demonstrate what you mean. I didn't do it because I don't understand how it would work or what its purpose is.
What is an "open interval"? |
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.
I've left a couple of comments / questions; just to add one more opinion in general terms I'm aligned with this draft 👍
In #71 we talked about potentially supporting minimum and maximum constraints separately which I don't see supported here.
Isn't this what @wjwwood is saying in the last paragraph here when talking about numeric constraints? If that's the case, it could be added as another constraint in the ParameterDescriptor
.
What is an "open interval"?
I think @tfoote is referring to constraints such as [1.0, 0.1, 5.0) i.e. excluding one of the bounds (please correct me if that's not the case). Considering the step is always discrete one way or another, this can be achieved by tweaking the bounds so as not to include the number in the border.
In other words, if I want a value to be between 1 and 5 with a step of 0.1, I can specify the constraint as [1.0, 0.1, 4.9] without needing any extra functionality.
I think that moving on with from/to is ok. |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
I created this PR #74 with changes based on the discussion on this PR. |
* Added changes based on comments on PR #72 Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Minor changes based on comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Augmented comments on ParameterDescriptor constraints Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comment on 'step' field of FloatingPointRange. One sentence per line on ParameterDescriptor Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comments on IntegerRange and FloatingPointRange, to_value is valid even if it is not multiple of step Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Addressed multiple comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Improved documentation Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Oxford comma FTW! Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
e61fc50
to
0bdddd8
Compare
* Added changes based on comments on PR #72 Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Minor changes based on comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Augmented comments on ParameterDescriptor constraints Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comment on 'step' field of FloatingPointRange. One sentence per line on ParameterDescriptor Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comments on IntegerRange and FloatingPointRange, to_value is valid even if it is not multiple of step Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Addressed multiple comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Improved documentation Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Oxford comma FTW! Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
Signed-off-by: William Woodall <william@osrfoundation.org>
* Added changes based on comments on PR #72 Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Minor changes based on comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Augmented comments on ParameterDescriptor constraints Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comment on 'step' field of FloatingPointRange. One sentence per line on ParameterDescriptor Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Changed comments on IntegerRange and FloatingPointRange, to_value is valid even if it is not multiple of step Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Addressed multiple comments Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Improved documentation Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> * Oxford comma FTW! Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar> Signed-off-by: William Woodall <william@osrfoundation.org>
0bdddd8
to
ecb74a7
Compare
Signed-off-by: William Woodall <william@osrfoundation.org>
Ok, I targeted this at master and rebased to resolve some conflicts and took it out of draft mode. I'll let others push this through final review and CI and stuff, if that's ok. |
# with the available constraints, e.g. "only prime numbers". | ||
# By convention, this should only be used to clarify constraints which cannot | ||
# be completely expressed with the parameter constraints below. | ||
string additional_constraints |
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.
I would argue the text can already be part of the description and doesn't have to be separate. E.g. a UI could show the description in a tooltip. I find it rather intuitive if it needs to concatenate two descriptions to provide all information.
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.
The idea is that is only about constraints, and should be short. Where as the description would be longer and have information like what units it is in or how it used in the node.
I feel that it has value as a separate field. Consider that you're just using float range, you may still put in the text description that the parameter should be between 0.0 and 1.0. I don't see this as any different, you might want to speak about some of the constraints in the description, but repeat them more specifically or concisely in this field.
Also, I imagine that the GUI may not show the description all the time, perhaps only on hover, whereas this string would be shown always, maybe just under things like sliders or combo boxes as a footnote.
It would be nice to hear what others think about this, I did ask for feedback on it originally (#73) and no one said anything.
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.
I think there is a semantic difference between the describing a parameter and describing the constraints on a parameter. So having two fields makes sense to me.
On another note, I could see this field being abused (for better or worse) to actually do constraint checking in user-defined callbacks. For example, in the Navigation WG meeting today, there was a discussion about having a mechanism for constraining parameter updates in certain states of a lifecycle node. This string could be used to encode a valid state. I'm not sure if this is something we should be worried about though.
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.
I suppose they could abuse it that way, but they could also just put that into the description :x
That's only helpful, however, if the GUI understands it. So if you have cooperation with the GUI and code, why not just propose a new constraint for this message or just publish another message with your custom constraints...
W.r.t. the constraints being based on the lifecycle state, we should make it so that the ParameterDescriptor can be updated (currently you have to undeclare and re-declare a parameter to do that), so that they can simply update the constraints when the node itself changes states.
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.
ROS 1 has range limits as well as a description for dynamic parameters. That has worked well in the past without a second text field describing the constraint in text form. Without a strong reason I don't think we should add a second description just based on the thoughts about how it could useful.
First get a minimal version merged and implemented from APIs in C++ and Python, do constraint checking, and have an rqt plugin to interact with these parameters and then consider extending it if there is a strong need / use case to do so.
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.
I think the idea of how it should be used is sufficiently concrete to include it now, so I think we should keep it.
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.
To be clear here, I'm fine with removing it, if the consensus is to do that, but my personal opinion is that it should stay. Right now we've got a -1 from @dirk-thomas, +1 from me, and I'll call it a +0 from @jacobperron?
If anyone has a +/-1 opinion could comment here so we can have some more decisive conclusion would be nice.
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.
+1
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
I pushed a change that makes the double value in FloatingPointRange a float64 value, same type as used in ParameterValue.msg |
Signed-off-by: Gonzalo de Pedro <gonzalo@depedro.com.ar>
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.
LGTM! Would be good to get second approval though.
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.
I'd like to see a resolution on the conversation about additional_constraints
, but otherwise lgtm. (cannot approve my own pr)
Based on the recommendation from @dirk-thomas here: #71 (comment)
So that we can iterate on it more effectively. See also the discussion in that issue.
This is currently targeted at the
read_only_parameters
branch because that one adds theread_only
constraint already, but I will re-target the pull request tomaster
once that one is merged.Connects to #71