feat: 先生成静物

This commit is contained in:
zpff 2025-08-14 17:37:20 +08:00
parent ff69a10189
commit 2ce41b8372

View File

@ -1,4 +1,5 @@
import threading
import time
from typing import List
from gazebo_ctrl import GazeboROSController
@ -17,9 +18,16 @@ class ModelManager:
self.rlock = threading.RLock()
def load_models(self, pmodels: List[PreloadModel]):
static_types = [ModelType.TABLE, ModelType.TAG]
with self.rlock:
# 性能平凡的机器上,需要先加载静物,再加载动物
for pmod in pmodels:
self.add_model(pmod.model, pmod.gen)
if pmod.model.obj_type in static_types:
self.add_model(pmod.model, pmod.gen)
time.sleep(5)
for pmod in pmodels:
if pmod.model.obj_type not in static_types:
self.add_model(pmod.model, pmod.gen)
def add_model(self, model: Model, add_sim: bool = True):
with self.rlock: