-
Notifications
You must be signed in to change notification settings - Fork 164
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
Support setting parameters atomically #727
base: rolling
Are you sure you want to change the base?
Conversation
I might be wrong but based on my understanding we can only set one parameter currently using We should expose the |
The problem with that, though, is that
This we should definitely do. The other thing we could do is to fix up |
I see, makes sense! |
Right, I definitely wasn't thinking when I put this PR together 😅. Will update this PR to support multiple parameters & |
I'll suggest you do two separate PRs; the first one to add multiple param support to |
5bd9a70
to
13a8d16
Compare
This PR is based off that PR (#728) and now implements Diff: brianc/multiple_param_set...brianc/atomic_parameter_set |
Signed-off-by: Brian Chen <[email protected]>
Signed-off-by: Brian Chen <[email protected]>
13a8d16
to
fb6efc1
Compare
@@ -50,6 +50,10 @@ def load_parameter_file(*, node, node_name, parameter_file, use_wildcard): | |||
parameters = list(parameter_dict_from_yaml_file(parameter_file, use_wildcard).values()) | |||
rclpy.spin_until_future_complete(node, future) | |||
response = future.result() |
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 this call will raise exception if there is an actual exception.
future = client.load_parameter_file_atomically(parameter_file, use_wildcard) | ||
parameters = list(parameter_dict_from_yaml_file(parameter_file, use_wildcard).values()) | ||
rclpy.spin_until_future_complete(node, future) | ||
response = future.result() |
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.
same here
raise RuntimeError('Exception while calling service of node ' | ||
f'{node_name}: {future.exception()}') | ||
|
||
if response.result.successful: |
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.
if response.result.successful
is false, user can know that loading parameter operation has been failed?
f'{node_name}: {future.exception()}') | ||
|
||
if response.result.successful: | ||
msg = 'Set parameters {} successful'.format(' '.join([i.name for i in parameters])) |
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.
this whole operation is atomic, and user knows parameters as input, so i am not sure if we need print all parameters again here. probably this command prints the result only?
client.wait_for_services(timeout_sec=5.0) | ||
future = client.set_parameters_atomically(parameters) | ||
rclpy.spin_until_future_complete(node, future) | ||
response = future.result() |
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.
same here.
This PR implements a
--atomic
flag forros2 param set
for setting parameters atomically from the command line.