diff --git a/scenario_execution_ros/scenario_execution_ros/actions/assert_topic_latency.py b/scenario_execution_ros/scenario_execution_ros/actions/assert_topic_latency.py index d8a172ac..601fade6 100644 --- a/scenario_execution_ros/scenario_execution_ros/actions/assert_topic_latency.py +++ b/scenario_execution_ros/scenario_execution_ros/actions/assert_topic_latency.py @@ -29,7 +29,7 @@ class AssertTopicLatency(BaseAction): def __init__(self, topic_name: str, topic_type: str, latency: float, comparison_operator: bool, rolling_average_count: int, wait_for_first_message: bool): super().__init__() self.topic_name = topic_name - self.topic_type_str = topic_type + self.topic_type = topic_type self.latency = latency self.comparison_operator_feedback = comparison_operator[0] self.comparison_operator = get_comparison_operator(comparison_operator) @@ -101,8 +101,8 @@ def check_topic(self): for name, topic_type in available_topics: if name == self.topic_name: topic_type = topic_type[0].replace('/', '.') - if self.topic_type_str: - if self.topic_type_str == topic_type: + if self.topic_type: + if self.topic_type == topic_type: self.call_subscriber() self.is_topic = True return True @@ -124,14 +124,14 @@ def check_topic(self): return True def call_subscriber(self): - datatype_in_list = self.topic_type_str.split(".") - self.topic_type = getattr( + datatype_in_list = self.topic_type.split(".") + topic_type = getattr( importlib.import_module(".".join(datatype_in_list[:-1])), datatype_in_list[-1] ) self.subscription = self.node.create_subscription( - msg_type=self.topic_type, + msg_type=topic_type, topic=self.topic_name, callback=self._callback, qos_profile=get_qos_preset_profile(['sensor_data']))