diff --git a/ros2/orchestrator/orchestrator/orchestrator_lib/orchestrator.py b/ros2/orchestrator/orchestrator/orchestrator_lib/orchestrator.py index 7b9a6eb..10181f6 100644 --- a/ros2/orchestrator/orchestrator/orchestrator_lib/orchestrator.py +++ b/ros2/orchestrator/orchestrator/orchestrator_lib/orchestrator.py @@ -294,6 +294,8 @@ def dataprovider_publish(self, topic: TopicName, message: Any) -> None: return if topic not in self.interception_subs.keys(): self.l.info(f"Got a message on topic {topic} but we are not subscribed to this input. Ignoring.") + if self.intercepted_topic_callback is not None: + self.intercepted_topic_callback(topic, type(message), message) return self.__interception_subscription_callback(topic, message) # Ignore next input from this topic, since it will be published now @@ -1114,15 +1116,15 @@ def plot_graph(self) -> None: def __interception_subscription_callback(self, topic_name: TopicName, msg: Union[rosgraph_msgs.msg.Clock, bytes]): lc(self.l, f"Received message on intercepted topic {topic_name}") - if self.intercepted_topic_callback is not None: - self.intercepted_topic_callback(topic_name, self.topic_types[topic_name], msg) - if self.ignore_next_input_from_topic[topic_name]: self.ignore_next_input_from_topic[topic_name] = False self.l.info( f"Ignoring input from topic {topic_name} since it was already given to us by dataprovider_publish()") return + if self.intercepted_topic_callback is not None: + self.intercepted_topic_callback(topic_name, self.topic_types[topic_name], msg) + if topic_name == normalize_topic_name("clock"): clock_msg = cast(rosgraph_msgs.msg.Clock, msg)