-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
In MjSceneParser.create_scene, the all_objects variable is a itertools.chain object which is exhausted after the first iteration. This means self.cleanup(all_objects) always receives an empty iterator. This results in a new temporary robot xml file being created under d3il_sim/model/mj/robots/ each time an environment is instantiated. Below is a proposed fix.
def create_scene(self, mj_robots, mj_surrounding, object_list: list, dt):
if object_list is None:
object_list = []
if not isinstance(object_list, list):
object_list = [object_list]
# Build a single list so we can iterate multiple times
all_objects = chain([mj_surrounding], object_list, mj_robots)
all_objects = [obj for obj in all_objects]
for obj in all_objects:
self.load_mj_loadable(obj)
self.set_dt(dt)
model = mujoco.MjModel.from_xml_string(self.mj_xml_string, self.assets)
data = mujoco.MjData(model)
# all_objects is a real list now, not an exhausted iterator
self.cleanup(all_objects)
return model, data
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels