<commit_before>import rospy
from tf2_geometry_msgs import PoseStamped
from geometry_msgs.msg import Point

from dynamic_stack_decider.abstract_action_element import AbstractActionElement


class GoToRolePosition(AbstractActionElement):
    def __init__(self, blackboard, dsd, parameters=None):
        super(GoToRolePosition, self).__init__(blackboard, dsd, parameters)
        role_positions = self.blackboard.config['role_positions']
        try:
            position_relative = role_positions[self.blackboard.blackboard.duty]
        except KeyError:
            raise KeyError('Role position for {} not specified in config'.format(self.blackboard.blackboard))

        # Adapt position to field size
        # TODO know where map frame is located
        self.role_position = [position_relative[0] * self.blackboard.field_length / 2,
                              position_relative[1] * self.blackboard.field_width / 2]
<commit_msg>better error description for missing role position<commit_after>import rospy
from tf2_geometry_msgs import PoseStamped
from geometry_msgs.msg import Point

from dynamic_stack_decider.abstract_action_element import AbstractActionElement


class GoToRolePosition(AbstractActionElement):
    def __init__(self, blackboard, dsd, parameters=None):
        super(GoToRolePosition, self).__init__(blackboard, dsd, parameters)
        role_positions = self.blackboard.config['role_positions']
        try:
            position_relative = role_positions[self.blackboard.blackboard.duty]
        except KeyError:
            raise KeyError('Role position for {} not specified in config'.format(self.blackboard.blackboard.duty))

        # Adapt position to field size
        # TODO know where map frame is located
        self.role_position = [position_relative[0] * self.blackboard.field_length / 2,
                              position_relative[1] * self.blackboard.field_width / 2]

{'fraction_non_alphanumeric': 0.07157784743991641, 'fraction_numerical': 0.00522466039707419, 'mean_word_length': 3.5813397129186604, 'pattern_counts': {'":': 0, '<': 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': '2564474', 'n_tokens_mistral': 521, 'n_tokens_neox': 500, 'n_words': 124}