Skip to content

Commit

Permalink
Merge pull request #3 from uulm-mrm/fix_topic_callback
Browse files Browse the repository at this point in the history
Fix issues with topic callback
  • Loading branch information
ottojo authored Sep 7, 2023
2 parents 6ecc483 + 37d8945 commit 7cf15a1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7cf15a1

Please sign in to comment.