Пример #1
0
    def parse_parameter(self, testblock_name, metric_name, params):
        """
        Method that returns the metric method with the given parameter.
        :param params: Parameter
        """
        metric_type = "user_result"

        split_name = metric_name.split("::")
        if len(split_name) != 2:
            raise ATFConfigurationError(
                "no valid metric name for metric '%s' in testblock '%s'" %
                (metric_name, testblock_name))
        if split_name[0] != metric_type:
            raise ATFConfigurationError(
                "called invalid metric handle for metric '%s' in testblock '%s'."
                % (metric_name, testblock_name))

        if type(params) is not dict:
            rospy.logerr("metric config not a dictionary")
            raise ATFConfigurationError(
                "no valid metric configuration for metric '%s' in testblock '%s': %s"
                % (metric_name, testblock_name, str(params)))

        # check for optional parameters
        groundtruth = Groundtruth()
        try:
            groundtruth.data = params["groundtruth"]
            groundtruth.epsilon = params["groundtruth_epsilon"]
            groundtruth.available = True
        except (TypeError, KeyError):
            groundtruth.data = 0
            groundtruth.epsilon = 0
            groundtruth.available = False

        return CalculateUserResult(metric_name, testblock_name, groundtruth)
Пример #2
0
    def parse_parameter(self, testblock_name, metric_name, params):
        """
        Method that returns the metric method with the given parameter.
        :param params: Parameter
        """
        metric_type = "topic_data"

        split_name = metric_name.split("::")
        if len(split_name) != 2:
            raise ATFConfigurationError(
                "no valid metric name for metric '%s' in testblock '%s'" %
                (metric_name, testblock_name))
        if split_name[0] != metric_type:
            raise ATFConfigurationError(
                "called invalid metric handle for metric '%s' in testblock '%s'."
                % (metric_name, testblock_name))

        if type(params) is not dict:
            rospy.logerr("metric config not a dictionary")
            raise ATFConfigurationError(
                "no valid metric configuration for metric '%s' in testblock '%s': %s"
                % (metric_name, testblock_name, str(params)))

        try:
            message_field = params["message_field"]
        except (TypeError, KeyError):
            message_field = ""

        # check for optional parameters
        try:
            unit = params["unit"]
        except (TypeError, KeyError):
            unit = ""
        groundtruth = Groundtruth()
        try:
            groundtruth.data = params["groundtruth"]["data"]
            groundtruth.epsilon = params["groundtruth"]["epsilon"]
            groundtruth.available = True
        except (TypeError, KeyError):
            groundtruth.data = 0
            groundtruth.epsilon = 0
            groundtruth.available = False
        try:
            mode = params["mode"]
        except (TypeError, KeyError):
            mode = MetricResult.SPAN_MEAN
        try:
            series_mode = params["series_mode"]
        except (TypeError, KeyError):
            series_mode = None

        return CalculateTopicData(metric_name, testblock_name, params["topic"],
                                  message_field, groundtruth, mode,
                                  series_mode, unit)
Пример #3
0
    def parse_parameter(self, testblock_name, metric_name, params):
        """
        Method that returns the metric method with the given parameter.
        :param params: Parameter
        """
        metric_type = "tf_acceleration_translation"
        unit = "m/s^2"

        split_name = metric_name.split("::")
        if len(split_name) != 2:
            raise ATFConfigurationError(
                "no valid metric name for metric '%s' in testblock '%s'" %
                (metric_name, testblock_name))
        if split_name[0] != metric_type:
            raise ATFConfigurationError(
                "called invalid metric handle for metric '%s' in testblock '%s'."
                % (metric_name, testblock_name))

        if type(params) is not dict:
            rospy.logerr("metric config not a dictionary")
            raise ATFConfigurationError(
                "no valid metric configuration for metric '%s' in testblock '%s': %s"
                % (metric_name, testblock_name, str(params)))

        # check for optional parameters
        groundtruth = Groundtruth()
        try:
            groundtruth.data = params["groundtruth"]["data"]
            groundtruth.epsilon = params["groundtruth"]["epsilon"]
            groundtruth.available = True
        except (TypeError, KeyError):
            groundtruth.data = 0
            groundtruth.epsilon = 0
            groundtruth.available = False
        try:
            mode = params["mode"]
        except (TypeError, KeyError):
            mode = MetricResult.SPAN_ABSMAX
        try:
            series_mode = params["series_mode"]
        except (TypeError, KeyError):
            series_mode = None

        return CalculateTfAccelerationTranslation(metric_name, testblock_name,
                                                  params["topics"],
                                                  params["root_frame"],
                                                  params["measured_frame"],
                                                  groundtruth, mode,
                                                  series_mode, unit)