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

make _on_parameter_event return result correctly #817

Merged
merged 3 commits into from
Jul 18, 2022
Merged
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
13 changes: 9 additions & 4 deletions rclpy/rclpy/time_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,24 @@ def clock_callback(self, msg):
clock.set_ros_time_override(time_from_msg)

def _on_parameter_event(self, parameter_list):
successful = True
reason = ''

for parameter in parameter_list:
if parameter.name == USE_SIM_TIME_NAME:
if parameter.type_ == Parameter.Type.BOOL:
self.ros_time_is_active = parameter.value
else:
successful = False
reason = '{} parameter set to something besides a bool'.format(
USE_SIM_TIME_NAME)

node = self._get_node()
if node:
node.get_logger().error(
'{} parameter set to something besides a bool'
.format(USE_SIM_TIME_NAME))
node.get_logger().error(reason)
break

return SetParametersResult(successful=True)
return SetParametersResult(successful=successful, reason=reason)

def _get_node(self):
if self._node_weak_ref is not None:
Expand Down