def __init__(self, config): """ Constructor for a new hypothesis by using the student t test. It includes the value, the deviation and the number of samples. :param config: Configuration from yaml file """ self._true_mean = Config.get_param(config, 'true_mean') if Config.has_key(config, 'std_deviation'): self._std_deviation = Config.get_param(config, 'std_deviation') else: self._std_deviation = None self._significance_level = Config.get_param(config, 'significance_level')
def __init__(self, config): """ Constructor for a new nominal value hypothesis. It includes the value and the deviation(s) :param config: Configuration from yaml file """ SingleValueHypothesisCheck.__init__(self) self._value_check = NominalValueFactory.create_nominal_value(config) self._deviation_checks = [] if not Config.has_key(config, 'deviation'): return for deviation_config in Config.get_param(config, 'deviation'): self._deviation_checks.append( NominalValueFactory.create_nominal_value(deviation_config))
def __init__(self, config): """ Constructor to create StdDeviationFilter object. It reads and setup the buffer (defined or not defined buffer size) :param config: Configuration from yaml file """ DeviationFilter.__init__(self) from math import sqrt self.sqrt = sqrt if Config.has_key(config, 'window_size'): from collections import deque self.window_size = Config.get_param(config, 'window_size') self._buffer = deque(maxlen=self.window_size) self.reset = self.reset_buffered else: self._buffer = [] self.reset = self.reset_unbuffered
def __init__(self, config): """ Constructor for exponentially weighted moving average (EWMA) filter object. Applies new values weighted to history. :param config: Configuration from yaml file """ ValueFilter.__init__(self) self._decay_rate = Config.get_param(config, 'decay_rate') if Config.has_key(config, 'window_size'): from collections import deque self.window_size = Config.get_param(config, 'window_size') self._ring_buffer = deque(maxlen=self.window_size) self.update = self.update_buffered self.get_value = self.get_value_buffered self.reset = self.reset_buffered else: self._current_value = None self.update = self.update_unbuffered self.get_value = self.get_value_unbuffered self.reset = self.reset_unbuffered
def __init__(self, config): """ Constructor to create min-max deviation object. It reads and setup the buffer (defined or not defined buffer size) :param config: Configuration from yaml file """ DeviationFilter.__init__(self) if Config.has_key(config, 'window_size'): from collections import deque self.window_size = Config.get_param(config, 'window_size') self._ring_buffer = deque(maxlen=self.window_size) self.update = self.update_buffered self.get_deviation = self.get_deviation_buffered self.reset = self.reset_buffered else: self._min = float("nan") self._max = float("nan") self.update = self.update_unbuffered self.get_deviation = self.get_deviation_unbuffered self.reset = self.reset_unbuffered
for node in YamlHelper.get_param(configs, 'nodes'): name = YamlHelper.get_param(node, 'name') sub_topic = YamlHelper.get_param(node, 'sub_topic', []) pub_topic = YamlHelper.get_param(node, 'pub_topic', []) model_configuration.nodes.append( node_configuration(name=str(name), pub_topic=list(pub_topic), sub_topic=list(sub_topic))) rospy.loginfo("tug_diagnosis_initialization: load observers") for observation in YamlHelper.get_param(configs, 'observations'): type = YamlHelper.get_param(observation, 'type') resource = [] if YamlHelper.has_key(observation, 'nodes'): resource = YamlHelper.get_param(observation, 'nodes', []) elif YamlHelper.has_key(observation, 'topics'): resource = YamlHelper.get_param(observation, 'topics', []) model_configuration.observers.append( observer_configuration(type=str(type), resource=list(resource))) rospy.loginfo( str(len(model_configuration.nodes)) + " nodes and " + str(len(model_configuration.observers)) + " observers loaded") rospy.loginfo("tug_diagnosis_initialization: waiting for service") rospy.wait_for_service('diagnosis_configuration_change') try: diagnosis_changer_srv = rospy.ServiceProxy(