def test_model_directives(self): model_dir = os.path.dirname( FindResourceOrThrow("drake/multibody/parsing/test/" "process_model_directives_test/package.xml")) plant = MultibodyPlant(time_step=0.01) parser = Parser(plant=plant) parser.package_map().PopulateFromFolder(model_dir) directives_file = model_dir + "/add_scoped_top.yaml" directives = LoadModelDirectives(directives_file) added_models = ProcessModelDirectives(directives=directives, plant=plant, parser=parser) # Check for an instance. model_names = [model.model_name for model in added_models] self.assertIn("extra_model", model_names) plant.GetModelInstanceByName("extra_model") # Test that other bound symbols exist. ModelInstanceInfo.model_name ModelInstanceInfo.model_path ModelInstanceInfo.parent_frame_name ModelInstanceInfo.child_frame_name ModelInstanceInfo.X_PC ModelInstanceInfo.model_instance AddFrame.name AddFrame.X_PF frame = GetScopedFrameByName(plant, "world") self.assertIsNotNone(GetScopedFrameName(plant, frame))
def test_scoped_frame_names(self): plant = MultibodyPlant(time_step=0.01) frame = GetScopedFrameByName(plant, "world") self.assertIsNotNone(GetScopedFrameName(plant, frame))