-
Notifications
You must be signed in to change notification settings - Fork 425
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
Parameter service behavior is inconsistent with the documentation of rcl_interfaces #2512
Comments
i may be mistaken something, but here are my comments. are you suggesting we should remove or i think that application can call
this needs to be fixed and consistent, either way we go. thank you for pointing this out.
true. but server can response quick to protect itself. if undeclared parameter request is included, it can return immediately with empty result, because that is not permitted operation for the parameters that this node possesses. otherwise, server needs to deal with many default elements for each request from multiple clients.
based on this description, remote nodes can set any undeclared parameters via service request. i am not sure if this is good idea.
i am not really following this, can you rephrase this a bit? what if that is declared parameter with dynamic typing? at the node initialization it cannot specify the type, but later on it sets the type and value to align with connected sensor mode and types.
i understand this, but technically this is just a buffer overflow bug in the application...
totally agree on this. |
This issue report is only concerned with getting the behavior of the parameter services of the client libraries to conform to the documentation of the services in To make this discussion easier, I've gone ahead and implemented the changes I recommend in a draft PR #2515 There are only two things I left out of the draft PR that I think could make the situation better, but they would be somewhat disruptive, so I think there should be some buy-in before trying to do it:
If "we" are the client that's calling
You'll see in my draft PR that we actually cut down on complexity and lines of code with my suggestion, except for
Users can set parameter handler callbacks that can reject an attempt to set the value of a parameter for any reason.
From the perspective of
I would argue that if the application is complying with the documentation of |
thanks, i will take a look!
agree, so that application can check against it.
sounds good.
that is why originally i was thinking this comes down to call Just idea, what if we have
yes, this is inconsistent and bug in the system. we need to fix for sure. what i meant is after fixing this inconsistency... |
I don't think it makes sense to consider "Undeclared" a different type from "Unset". Consider a node that has Rather than thinking about "undeclared" as its own type I would recommend thinking in terms of constraints on the values. Suppose I write a node and declare a string-type parameter called Similarly, there is nothing special about the data type of an undeclared: The data type of any undeclared parameter is the null set, also called the unit type, which In general I don't think there's a point to treating the Undeclared parameters can be thought of as dynamic-type parameters which currently have a value type of "Unset", and the |
The responsibilities of the different parameter services are pretty clear in my mind:
|
thank you very much iterating and sharing thoughts, i was checking myself what could be missing here. but now it is clear to me!
i was thinking that,
i think this is originally developed exclude any parameters to be set that do not belong to node. but true, we can do this with default
sounds reasonable. i am now inclined to take this consistent behavior along with you already opened a couple of draft PRs, #2515 and ros2/rcl_interfaces#164, thanks. (i think we need to update before moving to the implementation, can we keep this open for a bit to get more feedbacks? @wjwwood @mjcarroll @alsora @clalancette what do you think? |
@mxgrey i added this to Client WG meeting. hopefully we can get some feedback from there. |
Reporting here my thoughts (discussed in the client library WG). TL;DR: I think we should change the implementation to always match the documentation. I agree that the current behavior is not intuitive, and indeed we stumbled on it also in our application. As an additional point, the current implementation (which returns an empty vector if something is not present) doesn't work well with "optional parameters". I also agree on having an explicit Note that this change will break the user applications (for example in my application we currently check for an empty vector to know if the service failed...), but I think it's ok and worth to do it. |
My main blocker right now for finishing up the PRs for this is how to improve the description fetching. The essential problem is that (1) Add a new argument to describe_parameters to override the behavior when allow_undeclared_parameters is false:
(2) have a function that gets parameter descriptions one at a time, returning
(3) reimplement Likely controversies:
|
Bug report
Required Info:
While implementing parameter services for rclrs, we noticed that the behavior of
rclcpp
andrclpy
is inconsistent with the documentation ofrcl_interfaces/srv/GetParameterTypes
which says it returns a "List of types which is the same length and order as the provided names." and also "ParameterType.PARAMETER_NOT_SET indicates that the parameter is not currently set.".However in the implementation of rclcpp and rclpy, if the node is set with
allow_undeclared_parameters(false)
and the service request includes an undeclared parameter, you get an empty response back:This contradicts the documentation for the service, which does not indicate any situation in which the response array would be a different size from the request array.
It seems the current behavior of rclcpp and rclpy was an intentional choice with the rationale that asking about an undeclared parameter should be seen as an error. However the mismatch between the behavior of the client libraries and the service documentation means either:
I would argue that the current service documentation makes more sense than the client library behavior, so the client libraries should change their behavior to comply with it for the following reasons:
rcl_interfaces
. I see parameter declaration as an implementation detail for parameter management that's internal to a node. Clients of parameter services should not generally need to be concerned about parameter declaration settings within a node that they are querying, but the current behavior is leaking that abstraction into the behavior of the parameter services.allow_undeclared_parameters(false)
node can be thought of as unsettable, and therefore its value is just permanently unset. Naturally this means any client asking for the value of that parameter should be told that the value of the parameter is unset.Furthermore if a client calls
rcl_interfaces/srv/SetParameters
with an undeclared parameter on a node withallow_undeclared_parameters(false)
then the client libraries should return something like{ successful: false, reason: "Parameter is not declared by the node, which only allows declared parameters" }
where thereason
value is a fixed and consistent string literal across all client libraries so that parameter service clients can do a simple string comparison against. I would recommend defining the string literal inside ofrcl_interfaces/msg/SetParametersResult
with a name likeREASON_UNDECLARED_PARAMETER
. Currentlyrclcpp
andrclpy
produce differentreason
values for this same situation. Admittedly the service documentation says thatreason
should only be read by humans, but I think this particular case warrants a fixed and consistent value.I'm happy to submit PRs for these recommended changes, but I thought I'd open a discussion on this first in case there are any strong objections. Tagging @fujitatomoya @ivanpauno and @wjwwood as the main people who participated in the original discussion.
The text was updated successfully, but these errors were encountered: