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

If updating remote fails, reflect the failure locally #144

Open
wants to merge 2 commits into
base: rolling
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/rqt_reconfigure/param_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def _call_service(self, client, request, timeout=1.0):
if result is None:
raise AsyncServiceCallFailed(hint='the target node may not be spinning')

return future.result()
return result


def create_param_client(node, remote_node_name, param_change_callback=None):
Expand Down
11 changes: 9 additions & 2 deletions src/rqt_reconfigure/param_editors.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ def __init__(self, param_client, parameter, descriptor):
def update_remote(self, value):
# Update the value on Parameter Server.
try:
self._param_client.set_parameters([self.parameter])
result = self._param_client.set_parameters([self.parameter])
for res in result.results:
if not res.successful:
logging.warn('Failed to set parameters for node: ' + res.reason)
return False
except Exception as e:
logging.warn('Failed to set parameters for node: ' + str(e))
return False
return True

def update_local(self, value):
"""
Expand All @@ -95,7 +101,8 @@ def update(self, value):
old_value = self.parameter.value
self.update_local(value)
if self.parameter.value != old_value:
self.update_remote(value)
if not self.update_remote(value):
self.update_local(old_value)

def display(self, grid):
"""
Expand Down