diff --git a/rclpy/rclpy/time_source.py b/rclpy/rclpy/time_source.py index ec052e7ad..cc2820c38 100644 --- a/rclpy/rclpy/time_source.py +++ b/rclpy/rclpy/time_source.py @@ -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: