Skip to content
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

[rospy] fix param cache when node is subscribing and setting a parameter #2021

Merged
merged 1 commit into from
Aug 12, 2020

Conversation

mgrrx
Copy link
Contributor

@mgrrx mgrrx commented Aug 12, 2020

If one ROS node is setting and at the same time subscribing to the same parameter the ROS master does not notify about a parameter change. This change makes sure that the cache is updated after a set_param call.

Before

In [1]: import rospy
In [2]: rospy.init_node('asdf', log_level=rospy.DEBUG)
In [3]: rospy.set_param('a', 5)
In [4]: rospy.get_param('a')
Out[4]: 5
In [5]: rospy.get_param_cached('a')
Out[5]: 5
In [6]: rospy.set_param('a', 10)
In [7]: rospy.get_param_cached('a')
Out[7]: 5
In [8]: rospy.get_param('a')
Out[8]: 5

After

In [1]: import rospy
In [2]: rospy.init_node('asdf', log_level=rospy.DEBUG)
In [3]: rospy.set_param("a", 5)
In [4]: rospy.get_param("a")
Out[4]: 5
In [5]: rospy.get_param_cached("a")
Out[5]: 5
In [6]: rospy.set_param("a", 10)
In [7]: rospy.get_param("a")
Out[7]: 10
In [8]: rospy.get_param_cached("a")
Out[8]: 10

If one ROS node is setting and at the same time subscribing to the same
parameter the ROS master does not notify about a parameter change.
This change makes sure that the cache is updated after a
set_param call.
@dirk-thomas
Copy link
Member

Thanks for the patch.

@dirk-thomas dirk-thomas merged commit 47ad91d into ros:noetic-devel Aug 12, 2020
jacobperron pushed a commit that referenced this pull request Oct 16, 2020
If one ROS node is setting and at the same time subscribing to the same
parameter the ROS master does not notify about a parameter change.
This change makes sure that the cache is updated after a
set_param call.
jacobperron pushed a commit that referenced this pull request Oct 22, 2020
If one ROS node is setting and at the same time subscribing to the same
parameter the ROS master does not notify about a parameter change.
This change makes sure that the cache is updated after a
set_param call.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants