<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(dirname(abspath(__file__))))))
reload(sys)
sys.setdefaultencoding('utf-8')

from EmeraldAI.Logic.ROS.Helper.TFLooper import TFLooper

import rospy
import tf2_ros as tf

from geometry_msgs.msg import TransformStamped
from tf2_msgs.msg import TFMessage

nodeName = 'serial_tf_repeater'

def callback(data):
    if data._connection_header['callerid'].strip("/") == nodeName:
        return

    for t in data.transforms:
        TFLooper().add(t)


def listener():
    rateInHz = 20 # in Hz
    rospy.init_node(nodeName)
    rospy.Subscriber("tf", TFMessage, callback)

    rate = rospy.Rate(rateInHz) # hz
    while not rospy.is_shutdown():
        TFLooper().loop()
        rate.sleep()


if __name__=="__main__":
    listener()<commit_msg>limit repeater to serial converter messages<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from os.path import dirname, abspath
sys.path.append(dirname(dirname(dirname(dirname(abspath(__file__))))))
reload(sys)
sys.setdefaultencoding('utf-8')

from EmeraldAI.Logic.ROS.Helper.TFLooper import TFLooper

import rospy
import tf2_ros as tf

from geometry_msgs.msg import TransformStamped
from tf2_msgs.msg import TFMessage

nodeName = 'serial_tf_repeater'
nodeNameToRepeat = 'serial_converter_'

def callback(data):
    if not data._connection_header['callerid'].strip('/').startswith(nodeNameToRepeat):
        return

    for t in data.transforms:
        TFLooper().add(t)


def listener():
    rateInHz = 20 # in Hz
    rospy.init_node(nodeName)
    rospy.Subscriber('tf', TFMessage, callback)

    rate = rospy.Rate(rateInHz) # hz
    while not rospy.is_shutdown():
        TFLooper().loop()
        rate.sleep()


if __name__=='__main__':
    listener()
{'fraction_non_alphanumeric': 0.12378902045209902, 'fraction_numerical': 0.006458557588805167, 'mean_word_length': 4.093150684931507, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '131417', 'n_tokens_mistral': 669, 'n_tokens_neox': 646, 'n_words': 136}