-
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
Setting a parameter can create a mismatch in parameter value between the internal value and the ros2 param value #100
Comments
Yeah this is an interesting one @eeberhard. It is indeed a problem that you can modify the value of the shared parameter object that one gets "Re-synchronize" the parameters is one way, even though I wouldn't see an efficient way to do that right now. A more correct way would maybe be to prohibit a change to the shared parameter object |
Interesting. Let me just summarize again the intended behavior of the parameter validation callback: During parameter validation, we have a kind of "parameter candidate" which comes from the ROS 2 interface which is passed to Now to check that I understand the issue correctly; what I expect is that modifying the parameter candidate in the callback does modify the actual ROS 2 parameter as expected when setting a parameter through a parameter client from another node (for example the Dynamic State Engine in the AICA application framework). You are saying it does not modify the actual ROS 2 parameter when setting a parameter through the ROS 2 CLI.
I don't fully understand this; how can ROS 2 CLI set any parameter in that case? Do you just mean it can't be changed (read-only)?
Are you implying to remove the ability to modify parameter candidates entirely? For me that's a last resort, since I think this feature is otherwise a useful and powerful part of our abstraction. I think it would be better to first understand why there is a difference between setting parameters through the CLI vs through other parameter clients (if there even is a difference at all; perhaps this problem has been present no matter where the parameter change originates from). |
This is useful, but it is currently not reflected on the ros2 parameter server. To see that we have to look here. As you mention, we can modify the parameter candidate and change the value of the internal parameter like that. However, these changes are never translated back to ROS, so we have a mismatch between the ROS parameter server and the internal parameter map. Since the argument of the callback function is a const reference to a vector, we will not be able to reflect a changed parameter candidate back onto the ROS server, hence my suggestion to remove that option since it's very misleading.
There isn't. The confusion came from the fact that internally the component had the modified value, but not on the parameter server.
This has not much to do with the CLI but what one might try to avoid above issues is to use |
Looking at the node parameters interface we can see that there are three possible callbacks on set of a parameter:
We're using the |
Couldn't we use our internal store of the parameter to overwrite the candidate parameter with the "old" value to functionally reject the change? |
When setting a parameter, the
on_validate_parameter_callback
is called, and sometimes the value of the parameter is changed (for example, if the candidate value is out of range) instead of rejected. However, if we set the parameter via the ROS2 cli, ROS2 does not allow a parameter to be set or changed during the set parameter callback, which includeson_validate_parameter_callback
. Hence, the internal value of our parameter may get updated via the logic inon_validate_parameter_callback
, but the value of the ROS2 parameter is left as what has been set.From testing, both using the ros2 param cli and the AICA API (via localhost:5000) have the same issue. There needs to be a solution to re-synchronise both parameter maps.
The text was updated successfully, but these errors were encountered: