google-deepmind / google-deepmind/mujoco

Systematic asset reuse for attached models

Open
#2,526 4 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
15.2k
Forks
1.8k
Avg merge
10d 16h
Merged PRs (30d)
25

Description

### The feature, motivation and pitch

`asset/model` + `` and the `mjs_attachBody`, `mjs_attachFrame` equivalent in model editing API is the most systematic and convenient way to combine components into a complex scene. But a potential limitation is that: when a model is attached multiple times, or in any other case that assets (mainly meshes) are effectively shared by multiple child models, the assets are unconditionally duplicated in the main model.

In our use case, the model size quickly grows to over 300MiB with over 1M mesh faces. The major sources of bloating are several child models with SDF collision geom (SDF marching cube resolution is hard-coded) attached several times. If we further scale up the scene (only by attaching the existing child models more times), the model size would surely exceed 1GiB. The bloating model size would not cause significant problem for "single model, multiple data" simulation on its own, but:
1. We are trying to store MJB binary for archiving and exact reproducibility;
2. We plan to experiment with certain domain randomization that goes beyond the scope of MjData, necessitating one model for each parallel worker.

### Alternatives

1. Refactor the namespacing/scoping mechanism. The current prefix/suffix mechanism is somewhat inflexible.
2. Centralized asset management and asset sharing across models: It is theoretically possible with current mjModel interface, by changing asset pointers currently pointing to the main buffer to external buffers.

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.