def test_load_subgait_unexisting_version_error(self): self.gait_version_map['walk'][ 'right_open'] = 'MV_walk_rightopen_non_existing_banana_version' with self.assertRaises(FileNotFoundError): Gait.load_subgait(self.robot, self.resources_folder, self.gait_name, 'right_open', self.gait_version_map)
def test_from_file_invalid_path(self): with self.assertRaises(FileNotFoundError): Gait.from_file( self.gait_name, self.resources_folder + "/gaits", self.robot, self.gait_version_map, )
def test_load_subgait_unexisting_subgait_error(self): with self.assertRaises(SubgaitNameNotFoundError): Gait.load_subgait( self.robot, self.resources_folder, self.gait_name, "left_open", self.gait_version_map, )
def test_load_subgait_unexisting_gait_error(self): with self.assertRaises(GaitNameNotFoundError): Gait.load_subgait( self.robot, self.resources_folder, "walk_small", "left_swing", self.gait_version_map, )
def test_load_subgait_unexisting_version_error(self): self.gait_version_map["walk"][ "right_open"] = "MV_walk_rightopen_non_existing_banana_version" with self.assertRaises(FileNotFoundError): Gait.load_subgait( self.robot, self.resources_folder, self.gait_name, "right_open", self.gait_version_map, )
def load_gaits(self): """Load the gaits in the specified gait directory.""" self.loaded_gaits = list() for gait in self._gait_version_map: loaded_gait = Gait.from_file(gait, self.gait_directory, self.robot, self._gait_version_map) self.loaded_gaits.append(loaded_gait)
def test_load_existing_subgait(self): subgait = Gait.load_subgait( self.robot, self.resources_folder, self.gait_name, "left_swing", self.gait_version_map, ) self.assertIsInstance(subgait, Subgait)
def _load_gaits(self): """Loads the gaits in the specified gait directory. :returns dict: A dictionary mapping gait name to gait instance """ gaits = {self._balance_gait.gait_name: self._balance_gait} for gait in self._gait_version_map: gaits[gait] = Gait.from_file(gait, self._gait_directory, self._robot, self._gait_version_map) if self._balance_gait.move_group: self._balance_gait.default_walk = gaits['balance_walk'] return gaits
def setUp(self): self.gait_name = 'walk' self.resources_folder = rospkg.RosPack().get_path( 'march_shared_classes') + '/test/resources' self.robot = urdf.Robot.from_xml_file( rospkg.RosPack().get_path('march_description') + '/urdf/march4.urdf') self.default_yaml = self.resources_folder + '/default.yaml' with open(self.default_yaml, 'r') as default_yaml_file: default_config = yaml.load(default_yaml_file, Loader=yaml.SafeLoader) self.gait_version_map = default_config['gaits'] self.gait = Gait.from_file(self.gait_name, self.resources_folder, self.robot, self.gait_version_map)
def setUp(self): self.gait_name = "walk" self.resources_folder = ( rospkg.RosPack().get_path("march_shared_classes") + "/test/resources") self.robot = urdf.Robot.from_xml_file( rospkg.RosPack().get_path("march_description") + "/urdf/march4.urdf") self.default_yaml = self.resources_folder + "/default.yaml" with open(self.default_yaml, "r") as default_yaml_file: default_config = yaml.load(default_yaml_file, Loader=yaml.SafeLoader) self.gait_version_map = default_config["gaits"] self.gait = Gait.from_file(self.gait_name, self.resources_folder, self.robot, self.gait_version_map)
def test_init_invalid_joint_trajectory_transition(self): self.gait.subgaits['left_swing'].joints[0].setpoints[-1].position = 124 with self.assertRaises(NonValidGaitContent): Gait(self.gait_name, self.gait.subgaits, self.gait.graph)