<commit_before>PACKAGE = 'herbpy'
import logging, prpy
import openravepy

logger = logging.getLogger('herbpy')

class HERBRobot(prpy.base.WAMRobot):
    def __init__(self, left_arm_sim, right_arm_sim, right_ft_sim,
                       left_hand_sim, right_hand_sim, left_ft_sim,
                       head_sim, vision_sim, talker_sim, segway_sim):
        prpy.base.WAMRobot.__init__(self)

        # Absolute path to this package.
        from rospkg import RosPack
        ros_pack = RosPack()
        package_path = ros_pack.get_path(PACKAGE)

        # Convenience attributes for accessing self components.
        self.left_arm = self.GetManipulator('left')
        self.right_arm = self.GetManipulator('right')
        self.head = self.GetManipulator('head')
        self.left_arm.hand = self.left_arm.GetEndEffector()
        self.right_arm.hand = self.right_arm.GetEndEffector()
        self.left_hand = self.left_arm.hand
        self.right_hand = self.right_arm.hand
        self.manipulators = [ self.left_arm, self.right_arm, self.head ]

        # Dynamically switch to self-specific subclasses.
        from herbbase import HerbBase
        from prpy.base import BarrettHand, WAM
        from herbpantilt import HERBPantilt
        prpy.bind_subclass(self.left_arm, WAM, sim=left_arm_sim, owd_namespace='/left/owd')
        prpy.bind_subclass(self.right_arm, WAM, sim=right_arm_sim, owd_namespace='/right/owd')
        prpy.bind_subclass(self.head, HERBPantilt, sim=head_sim, owd_namespace='/head/owd')
        prpy.bind_subclass(self.left_arm.hand, BarrettHand, sim=left_hand_sim, manipulator=self.left_arm,
                           owd_namespace='/left/owd', bhd_namespace='/left/bhd', ft_sim=right_ft_sim)
        prpy.bind_subclass(self.right_arm.hand, BarrettHand, sim=right_hand_sim, manipulator=self.right_arm,
                           owd_namespace='/right/owd', bhd_namespace='/right/bhd', ft_sim=right_ft_sim)
        self.base = HerbBase(sim=segway_sim, robot=self)
        
        # Support for named configurations.
        import os.path
        self.configurations.add_group('left_arm', self.left_arm.GetArmIndices())
        self.configurations.add_group('right_arm', self.right_arm.GetArmIndices())
        self.configurations.add_group('head', self.head.GetArmIndices())
        self.configurations.add_group('left_hand', self.left_hand.GetIndices())
        self.configurations.add_group('right_hand', self.right_hand.GetIndices())

        if prpy.dependency_manager.is_catkin():
            from catkin.find_in_workspaces import find_in_workspaces
            configurations_paths = find_in_workspaces(search_dirs=['share'], project='herbpy',
                    path='config/configurations.yaml', first_match_only=True)
            if not configurations_paths:
                raise ValueError(
                    'Unable to load named configurations from "config/configurations.yaml".')

            configurations_path = configurations_paths[0]
        else:
            configurations_path = os.path.join(package_path, 'config/configurations.yaml')

        try:
            self.configurations.load_yaml(configurations_path)
        except IOError as e:
            raise ValueError('Failed laoding named configurations from "{:s}".'.format(
                configurations_path))

        # Support for loading tsrs from yaml
        if prpy.dependency_manager.is_catkin():
            from catkin.find_in_workspaces import find_in_workspaces
            tsr_paths = find_in_workspaces(search_dirs=['share'], project='herbpy',
                    path='config/tsrs.yaml', first_match_only=True)
            if not tsrs_paths:
                raise ValueError(
                    'Unable to load named tsrs from "config/tsrs.yaml".')

            tsrs_path = tsrs_paths[0]
        else:
            tsrs_path = os.path.join(package_path, 'config/tsrs.yaml')

        try:
            self.tsrlibrary.load_yaml(tsrs_path)
        except IOError as e:
            raise ValueError('Failed loading named tsrs from "{:s}".'.format(
                tsrs_path))

        # Initialize a default planning pipeline.
        from prpy.planning import Planner, Sequence, Ranked
        from prpy.planning import CBiRRTPlanner, CHOMPPlanner, IKPlanner, MKPlanner, NamedPlanner, SnapPlanner, SBPLPlanner, OMPLPlanner
        self.cbirrt_planner = CBiRRTPlanner()
        self.mk_planner = MKPlanner()
        self.snap_planner = SnapPlanner()
        self.named_planner = NamedPlanner()
        self.ik_planner = IKPlanner()
        self.ompl_planner = OMPLPlanner(algorithm='OMPLPlanner')
        self.planner = Sequence(self.ik_planner,
                                self.named_planner,
                                self.snap_planner, <commit_msg>Fixed TSRLibrary in Catkin.<commit_after>PACKAGE = 'herbpy'
import logging, prpy
import openravepy

logger = logging.getLogger('herbpy')

class HERBRobot(prpy.base.WAMRobot):
    def __init__(self, left_arm_sim, right_arm_sim, right_ft_sim,
                       left_hand_sim, right_hand_sim, left_ft_sim,
                       head_sim, vision_sim, talker_sim, segway_sim):
        prpy.base.WAMRobot.__init__(self, robot_name='herb')

        # Absolute path to this package.
        from rospkg import RosPack
        ros_pack = RosPack()
        package_path = ros_pack.get_path(PACKAGE)

        # Convenience attributes for accessing self components.
        self.left_arm = self.GetManipulator('left')
        self.right_arm = self.GetManipulator('right')
        self.head = self.GetManipulator('head')
        self.left_arm.hand = self.left_arm.GetEndEffector()
        self.right_arm.hand = self.right_arm.GetEndEffector()
        self.left_hand = self.left_arm.hand
        self.right_hand = self.right_arm.hand
        self.manipulators = [ self.left_arm, self.right_arm, self.head ]

        # Dynamically switch to self-specific subclasses.
        from herbbase import HerbBase
        from prpy.base import BarrettHand, WAM
        from herbpantilt import HERBPantilt
        prpy.bind_subclass(self.left_arm, WAM, sim=left_arm_sim, owd_namespace='/left/owd')
        prpy.bind_subclass(self.right_arm, WAM, sim=right_arm_sim, owd_namespace='/right/owd')
        prpy.bind_subclass(self.head, HERBPantilt, sim=head_sim, owd_namespace='/head/owd')
        prpy.bind_subclass(self.left_arm.hand, BarrettHand, sim=left_hand_sim, manipulator=self.left_arm,
                           owd_namespace='/left/owd', bhd_namespace='/left/bhd', ft_sim=right_ft_sim)
        prpy.bind_subclass(self.right_arm.hand, BarrettHand, sim=right_hand_sim, manipulator=self.right_arm,
                           owd_namespace='/right/owd', bhd_namespace='/right/bhd', ft_sim=right_ft_sim)
        self.base = HerbBase(sim=segway_sim, robot=self)
        
        # Support for named configurations.
        import os.path
        self.configurations.add_group('left_arm', self.left_arm.GetArmIndices())
        self.configurations.add_group('right_arm', self.right_arm.GetArmIndices())
        self.configurations.add_group('head', self.head.GetArmIndices())
        self.configurations.add_group('left_hand', self.left_hand.GetIndices())
        self.configurations.add_group('right_hand', self.right_hand.GetIndices())

        if prpy.dependency_manager.is_catkin():
            from catkin.find_in_workspaces import find_in_workspaces
            configurations_paths = find_in_workspaces(search_dirs=['share'], project='herbpy',
                    path='config/configurations.yaml', first_match_only=True)
            if not configurations_paths:
                raise ValueError('Unable to load named configurations from "config/configurations.yaml".')

            configurations_path = configurations_paths[0]
        else:
            configurations_path = os.path.join(package_path, 'config/configurations.yaml')

        try:
            self.configurations.load_yaml(configurations_path)
        except IOError as e:
            raise ValueError('Failed laoding named configurations from "{:s}".'.format(
                configurations_path))

        # Support for loading tsrs from yaml
        if prpy.dependency_manager.is_catkin():
            from catkin.find_in_workspaces import find_in_workspaces
            tsrs_paths = find_in_workspaces(search_dirs=['share'], project='herbpy',
                             path='config/tsrs.yaml', first_match_only=True)
            if not tsrs_paths:
                raise ValueError('Unable to load named tsrs from "config/tsrs.yaml".')

            tsrs_path = tsrs_paths[0]
        else:
            tsrs_path = os.path.join(package_path, 'config/tsrs.yaml')

        try:
            self.tsrlibrary.load_yaml(tsrs_path)
        except IOError as e:
            raise ValueError('Failed loading named tsrs from "{:s}".'.format(
                tsrs_path))

        # Initialize a default planning pipeline.
        from prpy.planning import Planner, Sequence, Ranked
        from prpy.planning import CBiRRTPlanner, CHOMPPlanner, IKPlanner, MKPlanner, NamedPlanner, SnapPlanner, SBPLPlanner, OMPLPlanner
        self.cbirrt_planner = CBiRRTPlanner()
        self.mk_planner = MKPlanner()
        self.snap_planner = SnapPlanner()
        self.named_planner = NamedPlanner()
        self.ik_planner = IKPlanner()
        self.ompl_planner = OMPLPlanner(algorithm='OMPLPlanner')
        self.planner = Sequence(self.ik_planner,
                                self.named_planner,
                                self.snap_planner, 
{'fraction_non_alphanumeric': 0.09360325576541793, 'fraction_numerical': 0.0004174058228112282, 'mean_word_length': 2.6650095602294455, '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': '2814996', 'n_tokens_mistral': 2986, 'n_tokens_neox': 2911, 'n_words': 510}