From ab024afb30069518046817bdb3d4aae9a3aaf4e6 Mon Sep 17 00:00:00 2001 From: zpff Date: Tue, 12 Aug 2025 15:44:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model_mgr/model_types.py | 3 ++- scene/grasp_box/config.json | 3 ++- test.py | 11 ++--------- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/model_mgr/model_types.py b/model_mgr/model_types.py index 8025485..3652821 100644 --- a/model_mgr/model_types.py +++ b/model_mgr/model_types.py @@ -163,7 +163,8 @@ class Model: self.id = data.get("id", self.id) self.pose.overwrite_from_dict(data.get("pose", {})) self.description = data.get("description", self.description) - self.ability_code = data.get("ability_code", self.ability_code) + if "ability_code" in data: + self.ability_code = data["ability_code"] self.tag_id = data.get("tag_id", self.tag_id) self.mass = data.get("mass", self.mass) self.size.overwrite_from_dict(data.get("size", {})) diff --git a/scene/grasp_box/config.json b/scene/grasp_box/config.json index ce05973..e8392c1 100644 --- a/scene/grasp_box/config.json +++ b/scene/grasp_box/config.json @@ -5,7 +5,8 @@ "id": 1, "name": "biped_s42", "obj_type": 1, - "description": "a biped robot model" + "description": "a biped robot model", + "ability_code": ["move", "both_grab", "both_place", "identify", "turn", "head"] }, { "gen": true, diff --git a/test.py b/test.py index f43e674..3a524f2 100644 --- a/test.py +++ b/test.py @@ -14,12 +14,5 @@ from model_mgr.manager import ModelManager from scene_mgr.manager import SceneManager scene_mgr = SceneManager() -model_mgr = ModelManager() - -model_mgr.load_models(scene_mgr.scene_id_dict[1].preload_models) -models = model_mgr.get_all_models() -print([x.to_dict() for x in models]) -time.sleep(30) -for model in models: - if model.name != 'biped_s42': - model_mgr.remove_model(model.id) +pr = scene_mgr.scene_id_dict[1].preload_models +print(f'preload models: {[m.model.to_dict() for m in pr]}')